Messages in this thread | | | Date | Fri, 27 Sep 2013 07:50:44 +0200 | From | Manfred Spraul <> | Subject | Re: [PATCH 4/4] ipc,msg: prevent race with rmid in msgsnd,msgrcv |
| |
Hi Andrew,
Could you include the patch in -mm and push it towards Linus?
On 09/16/2013 05:04 AM, Davidlohr Bueso wrote: > This fixes a race in both msgrcv() and msgsnd() between finding the msg and > actually dealing with the queue, as another thread can delete shmid > underneath us if we are preempted before acquiring the kern_ipc_perm.lock. > > Manfred illustrates this nicely: > > Assume a preemptible kernel that is preempted just after >> msq = msq_obtain_object_check(ns, msqid) > in do_msgrcv(). > The only lock that is held is rcu_read_lock(). > > Now the other thread processes IPC_RMID. > When the first task is resumed, then it will happily wait for messages on a > deleted queue. > > Fix this by checking for if the queue has been deleted after taking the lock. > > Reported-by: Manfred Spraul <manfred@colorfullife.com> > Cc: stable@vger.kernel.org # for 3.11 > Signed-off-by: Davidlohr Bueso <davidlohr@hp.com> Signed-off-by: Manfred Spraul <manfred@colorfullife.com>
| |