lkml.org 
[lkml]   [2008]   [Mar]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH 1/2] Bsd_acct: plain current->real_parent access is not always safe
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 <xemul@openvz.org>

---
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)
#endif
#if ACCT_VERSION==3
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();
#endif

spin_lock_irq(&current->sighand->siglock);
--
1.5.3.4


\
 
 \ /
  Last update: 2008-03-17 11:51    [W:0.020 / U:0.728 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site