public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: linux-kernel@vger.kernel.org
Cc: sergey.senozhatsky@gmail.com
Subject: Re: suspicious rcu_dereference_check() usage splat
Date: Mon, 8 Nov 2010 12:24:37 -0800	[thread overview]
Message-ID: <20101108202437.GH4032@linux.vnet.ibm.com> (raw)
In-Reply-To: <20101108153957.GA3418@deepthought.bhanu.net>

On Mon, Nov 08, 2010 at 11:39:57PM +0800, Arun Bhanu wrote:
> * Paul E. McKenney (paulmck@linux.vnet.ibm.com) wrote:
> > On Sun, Nov 07, 2010 at 03:14:14PM +0800, Arun Bhanu wrote:
> > > I got the following splat while booting 2.6.37-rc1+
> > > (ff8b16d7e15a8ba2a6086645614a483e048e3fbf).
> > > 
> > > [    9.381536] ===================================================
> > > [    9.382380] [ INFO: suspicious rcu_dereference_check() usage. ]
> > > [    9.382867] ---------------------------------------------------
> > > [    9.383412] kernel/pid.c:419 invoked rcu_dereference_check() without protection!
> > > [    9.383959] 
> > > [    9.383959] other info that might help us debug this:
> > > [    9.383960] 
> > > [    9.385599] 
> > > [    9.385599] rcu_scheduler_active = 1, debug_locks = 0
> > > [    9.386686] 1 lock held by readahead/365:
> > > [    9.387227]  #0:  (tasklist_lock){.+.+..}, at: [<c05188f3>] sys_ioprio_set+0x84/0x261
> > > [    9.387765] 
> > > [    9.387765] stack backtrace:
> > > [    9.388840] Pid: 365, comm: readahead Not tainted 2.6.37-rc1-ab1.fc14.i686.PAE+ #1
> > > [    9.389374] Call Trace:
> > > [    9.389909]  [<c07e57ba>] ? printk+0x25/0x2b
> > > [    9.390453]  [<c046b21a>] lockdep_rcu_dereference+0x7d/0x86
> > > [    9.390986]  [<c0459304>] find_task_by_pid_ns+0x3f/0x53
> > > [    9.391521]  [<c0459335>] find_task_by_vpid+0x1d/0x1f
> > > [    9.392050]  [<c051891b>] sys_ioprio_set+0xac/0x261
> > > [    9.392574]  [<c046d80f>] ? trace_hardirqs_on_caller+0xfe/0x11f
> > > [    9.393110]  [<c040951f>] sysenter_do_call+0x12/0x38
> > > 
> > > Complete dmesg and config attached. Let me know if you want me to test
> > > any patches.
> > 
> > Could you please try the patch at http://lkml.org/lkml/2010/10/29/168?
> 
> Thanks for the pointer. With the above patch applied I am no longer
> seeing the splat.
> 
> Tested-by: Arun Bhanu <arun@bhanu.net>

Very good!!!

Looking over the patch again, the scope of the RCU read-side critical
section needs to expand to cover the use of the pointer as well as the
call to find_task_by_vpid().  So, for example:

		case IOPRIO_WHO_PROCESS:
			rcu_read_lock();
			if (!who)
				p = current;
			else
				p = find_task_by_vpid(who);
			if (p)
				ret = set_task_ioprio(p, ioprio);
			rcu_read_unlock();
			break;
		case IOPRIO_WHO_PGRP:


Otherwise, the task could go away before the last use.

Sergey, could you please make this change and re-post your patch?

							Thanx, Paul

> > > -Arun
> 
> [snip]
> 
> -Arun

  reply	other threads:[~2010-11-08 20:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-07  7:14 suspicious rcu_dereference_check() usage splat Arun Bhanu
2010-11-07 18:50 ` Paul E. McKenney
2010-11-08 15:39   ` Arun Bhanu
2010-11-08 20:24     ` Paul E. McKenney [this message]
2010-11-09  9:09       ` Sergey Senozhatsky
2010-11-09 20:20         ` 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=20101108202437.GH4032@linux.vnet.ibm.com \
    --to=paulmck@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sergey.senozhatsky@gmail.com \
    /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