Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754538AbYCQKt0 (ORCPT ); Mon, 17 Mar 2008 06:49:26 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752428AbYCQKtT (ORCPT ); Mon, 17 Mar 2008 06:49:19 -0400 Received: from sacred.ru ([62.205.161.221]:34616 "EHLO sacred.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752114AbYCQKtS (ORCPT ); Mon, 17 Mar 2008 06:49:18 -0400 Message-ID: <47DE4C7D.5090207@openvz.org> Date: Mon, 17 Mar 2008 13:48:29 +0300 From: Pavel Emelyanov User-Agent: Thunderbird 2.0.0.12 (X11/20080213) MIME-Version: 1.0 To: Andrew Morton CC: Oleg Nesterov , Linux Kernel Mailing List Subject: [PATCH 1/2] Bsd_acct: plain current->real_parent access is not always safe Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-3.0 (sacred.ru [62.205.161.221]); Mon, 17 Mar 2008 13:48:26 +0300 (MSK) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1130 Lines: 36 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) #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(¤t->sighand->siglock); -- 1.5.3.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/