From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: linux-kernel@vger.kernel.org
Cc: oleg@tv-sign.ru, akpm@linux-foundation.org, johnstul@us.ibm.com,
mingo@elte.hu, tglx@linutronix.de, zippel@linux-m68k.org
Subject: [PATCH] POSIX timers RCU optimization fix for clock_gettime
Date: Sat, 3 Feb 2007 20:15:24 -0800 [thread overview]
Message-ID: <20070204041524.GA6582@linux.vnet.ibm.com> (raw)
Fixes an exit()/posix_cpu_clock_get() race spotted by Oleg Nesterov.
Solution is to move the p->signal check under the tasklist_lock.
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---
posix-cpu-timers.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff -urpNa -X dontdiff linux-2.6.20-rc6-clockrcu/kernel/posix-cpu-timers.c linux-2.6.20-rc6-clockrcu-fixes/kernel/posix-cpu-timers.c
--- linux-2.6.20-rc6-clockrcu/kernel/posix-cpu-timers.c 2007-02-01 13:03:57.000000000 -0800
+++ linux-2.6.20-rc6-clockrcu-fixes/kernel/posix-cpu-timers.c 2007-02-03 16:53:41.000000000 -0800
@@ -312,10 +312,13 @@ int posix_cpu_clock_get(const clockid_t
error = cpu_clock_sample(which_clock,
p, &rtn);
}
- } else if (p->tgid == pid && p->signal) {
+ } else {
read_lock(&tasklist_lock);
- error = cpu_clock_sample_group(which_clock,
- p, &rtn);
+ if (p->tgid == pid && p->signal) {
+ error =
+ cpu_clock_sample_group(which_clock,
+ p, &rtn);
+ }
read_unlock(&tasklist_lock);
}
}
reply other threads:[~2007-02-04 4:15 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20070204041524.GA6582@linux.vnet.ibm.com \
--to=paulmck@linux.vnet.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=johnstul@us.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=oleg@tv-sign.ru \
--cc=tglx@linutronix.de \
--cc=zippel@linux-m68k.org \
/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