All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: mingo@elte.hu, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2.6.35-rc3] Add RCU check for find_task_by_vpid().
Date: Fri, 25 Jun 2010 10:48:12 -0700	[thread overview]
Message-ID: <20100625174812.GF2432@linux.vnet.ibm.com> (raw)
In-Reply-To: <201006260108.JFJ86910.VMFOLOFFJOtSQH@I-love.SAKURA.ne.jp>

On Sat, Jun 26, 2010 at 01:08:19AM +0900, Tetsuo Handa wrote:
> find_task_by_vpid() says "Must be called under rcu_read_lock().". But due to
> commit 3120438 "rcu: Disable lockdep checking in RCU list-traversal primitives",
> we are currently unable to catch "find_task_by_vpid() with tasklist_lock held
> but RCU lock not held" errors.
> 
>   ===================================================
>   [ INFO: suspicious rcu_dereference_check() usage. ]
>   ---------------------------------------------------
>   kernel/pid.c:386 invoked rcu_dereference_check() without protection!
>   
>   other info that might help us debug this:
>   
>   
>   rcu_scheduler_active = 1, debug_locks = 1
>   1 lock held by rc.sysinit/1102:
>    #0:  (tasklist_lock){.+.+..}, at: [<c1048340>] sys_setpgid+0x40/0x160
>   
>   stack backtrace:
>   Pid: 1102, comm: rc.sysinit Not tainted 2.6.35-rc3-dirty #1
>   Call Trace:
>    [<c105e714>] lockdep_rcu_dereference+0x94/0xb0
>    [<c104b4cd>] find_task_by_pid_ns+0x6d/0x70
>    [<c104b4e8>] find_task_by_vpid+0x18/0x20
>    [<c1048347>] sys_setpgid+0x47/0x160
>    [<c1002b50>] sysenter_do_call+0x12/0x36
> 
> Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
> ---
> diff --git a/kernel/pid.c b/kernel/pid.c
> index e9fd8c1..a257471 100644
> --- a/kernel/pid.c
> +++ b/kernel/pid.c
> @@ -382,6 +382,9 @@ EXPORT_SYMBOL(pid_task);
>   */
>  struct task_struct *find_task_by_pid_ns(pid_t nr, struct pid_namespace *ns)
>  {
> +#ifdef __do_rcu_dereference_check
> +	__do_rcu_dereference_check(rcu_read_lock_held());
> +#endif

How about the following?

	WARN_ON_ONCE(!rcu_read_lock_held());

>  	return pid_task(find_pid_ns(nr, ns), PIDTYPE_PID);
>  }
> 

  reply	other threads:[~2010-06-25 17:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-25 16:08 [PATCH 2.6.35-rc3] Add RCU check for find_task_by_vpid() Tetsuo Handa
2010-06-25 17:48 ` Paul E. McKenney [this message]
2010-06-25 22:41   ` Tetsuo Handa
2010-06-28 23:41     ` Paul E. McKenney

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=20100625174812.GF2432@linux.vnet.ibm.com \
    --to=paulmck@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=penguin-kernel@I-love.SAKURA.ne.jp \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.