From: Oleg Nesterov <oleg@redhat.com>
To: akpm@linux-foundation.org
Cc: linux-kernel@vger.kernel.org, roland@redhat.com, mingo@elte.hu,
rnalumasu@gmail.com
Subject: do_wait() vs do_notify_parent_cldstop() theoretical race?
Date: Sun, 23 Nov 2008 22:55:11 +0100 [thread overview]
Message-ID: <20081123215511.GB9097@redhat.com> (raw)
In-Reply-To: <20081123213929.GA9097@redhat.com>
Looking at do_wait(), suddenly I am starting to suspect we have the
highly theoretical race with do_notify_parent_cldstop().
do_wait:
add_wait_queue(...);
current->state = TASK_INTERRUPTIBLE;
read_lock(tasklist_lock);
... try to find the "interesting" task ...
read_unlock(tasklist_lock);
if (!retval) // not found
schedule();
We don't race with do_notify_parent() because it takes tasklist
for writing. But do_notify_parent_cldstop() can run in parallel
under read_lock(tasklist).
Now suppose that "->state = TASK_INTERRUPTIBLE" leaks deeply into
the critical section. In theory, it is possible that wait_consider_task()
checks task_is_stopped_or_traced() or SIGNAL_STOP_CONTINUED first, then
CPU sets state = TASK_INTERRUPTIBLE. And we can miss the event if
do_notify_parent_cldstop() happens in between.
No?
Oleg.
next prev parent reply other threads:[~2008-11-23 20:55 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <200811212015.mALKFMs4019558@imap1.linux-foundation.org>
2008-11-23 21:39 ` + do_wait-wakeup-optimization.patch added to -mm tree Oleg Nesterov
2008-11-23 21:55 ` Oleg Nesterov [this message]
2008-11-24 7:31 ` do_wait() vs do_notify_parent_cldstop() theoretical race? Roland McGrath
2008-12-04 1:05 ` Roland McGrath
2008-11-24 7:26 ` + do_wait-wakeup-optimization.patch added to -mm tree Roland McGrath
2008-12-04 15:26 ` Oleg Nesterov
2008-12-04 20:59 ` Roland McGrath
2008-12-04 1:06 ` Roland McGrath
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=20081123215511.GB9097@redhat.com \
--to=oleg@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=rnalumasu@gmail.com \
--cc=roland@redhat.com \
/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