From: Manfred Spraul <manfred@colorfullife.com>
To: Michael Kerrisk <mtk-lkml@gmx.net>
Cc: alan@redhat.com, michael.kerrisk@gmx.net, linux-kernel@vger.kernel.org
Subject: Re: System V semaphore bug in kernel 2.6
Date: Thu, 09 Dec 2004 18:25:54 +0100 [thread overview]
Message-ID: <41B88AA2.6070603@colorfullife.com> (raw)
In-Reply-To: <25686.1102607983@www38.gmx.net>
Michael Kerrisk wrote:
>Hello Manfred, Alan,
>
>I assume you are still the relevant people to know about
>this nowadays...
>
>Somewhere in the reworking of the System V semaphore code
>(ipc/sem.c or nearby) in Linux 2.6, a bug appears to have
>been introduced.
>
>
>
ipc/sem.c. The change that now semaphores are actively given to the
waiting task broke your test.
What happens is:
child 3 does a semaphore operation. It succeeds. update_queue is called:
- try_atomic_semop checks if it can wake up child 2. Answer: No.
- try_atomic_semop(): kernel checks if it can wake up child 1. Answer: Yes.
Bug: It must now check again if there is a thread that is waiting for
semaphore value==0. This check is now missing. In 2.4, there was another
round of update_queue calls just before child 1 returns to user space.
That call then wakes up child 1. This call was removed.
One approach to fix that is a loop in update_queue: If a
try_atomic_semop call from within update_queue modified the array, then
check again from the beginning of the queue.
What do you think? I'll write a patch.
--
Manfred
next prev parent reply other threads:[~2004-12-09 17:26 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-12-09 15:59 Michael Kerrisk
2004-12-09 17:25 ` Manfred Spraul [this message]
2004-12-09 18:27 ` [PATCH] fix missing wakeup in ipc/sem Manfred Spraul
2004-12-10 12:41 ` Michael Kerrisk
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=41B88AA2.6070603@colorfullife.com \
--to=manfred@colorfullife.com \
--cc=alan@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=michael.kerrisk@gmx.net \
--cc=mtk-lkml@gmx.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome