LKML Archive on
help / color / mirror / Atom feed
* [PATCH 1/2] Bsd_acct: plain current->real_parent access is not always safe
@ 2008-03-17 10:48 Pavel Emelyanov
  0 siblings, 0 replies; only message in thread
From: Pavel Emelyanov @ 2008-03-17 10:48 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Oleg Nesterov, Linux Kernel Mailing List

This is minor, but dereferencing even current real_parent is not
safe on debug kernels, since the memory, this points to, can be
unmapped - RCU protection is required.

Besides, the tgid field is deprecated and is to be replaced with
task_tgid_xxx call (the 2nd patch), so RCU will be required anyway.

Signed-off-by: Pavel Emelyanov <>

 kernel/acct.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/kernel/acct.c b/kernel/acct.c
index 521dfa5..7ff5339 100644
--- a/kernel/acct.c
+++ b/kernel/acct.c
@@ -482,7 +482,9 @@ static void do_acct_process(struct file *file)
 	ac.ac_pid = current->tgid;
-	ac.ac_ppid = current->real_parent->tgid;
+	rcu_read_lock();
+	ac.ac_ppid = rcu_dereference(current->real_parent)->tgid;
+	rcu_read_unlock();

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-03-17 10:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-17 10:48 [PATCH 1/2] Bsd_acct: plain current->real_parent access is not always safe Pavel Emelyanov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).