Re: [PATCH] [ipc/sem.c] fix race with concurrent semtimedop()timeouts and IPC_RMID

From: Eric Dumazet
Date: Thu Jul 21 2011 - 04:12:31 EST

Le mercredi 20 juillet 2011 Ã 23:58 -0700, Andrew Morton a Ãcrit :
> On Thu, 21 Jul 2011 08:42:53 +0200 Manfred Spraul <manfred@xxxxxxxxxxxxxxxx> wrote:
> > If a semaphore array is removed and in parallel a sleeping task is woken up
> > (signal or timeout, does not matter), then the woken up task does not wait
> > until wake_up_sem_queue_do() is completed. This will cause crashes, because
> > wake_up_sem_queue_do() will read from a stale pointer.
> >
> > The fix is simple: Regardless of anything, always call get_queue_result().
> > This function waits until wake_up_sem_queue_do() has finished it's task.
> >
> > Andrew, could you please take care of merging the patch?
> yup, thanks for this. It's good to hear from you, and that you've
> still got what it takes :)
> Do you know how long this bug has been around for? Somewhere between
> 2.6.32 and 2.6.36, but that a large interval!

As I said, bug was introduced in commit
(ipc/sem.c: move wake_up_process out of the spinlock section)

(so first faulty kernel version is 2.6.35)

Please also add this bugzilla reference :

Reported-by: Harald Laabs <kernelml@xxxxxxx>
Acked-by: Eric Dumazet <eric.dumazet@xxxxxxxxx>

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at