netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* 2.6.35-rc2-git1 - lib/idr.c:605 invoked rcu_dereference_check() without protection!
@ 2010-06-07 18:23 Miles Lane
  2010-06-08  0:12 ` Paul E. McKenney
  0 siblings, 1 reply; 4+ messages in thread
From: Miles Lane @ 2010-06-07 18:23 UTC (permalink / raw)
  To: paulmck
  Cc: Vivek Goyal, Eric Paris, David Woodhouse, Lai Jiangshan,
	Ingo Molnar, Peter Zijlstra, LKML, nauman, eric.dumazet, netdev,
	Jens Axboe, Gui Jianfeng, Li Zefan, Johannes Berg

[    2.677955] [ INFO: suspicious rcu_dereference_check() usage. ]
[    2.679089] ---------------------------------------------------
[    2.680276] lib/idr.c:605 invoked rcu_dereference_check() without protection!
[    2.681499]
[    2.681500] other info that might help us debug this:
[    2.681501]
[    2.685509]
[    2.685510] rcu_scheduler_active = 1, debug_locks = 1
[    2.688221] 1 lock held by swapper/1:
[    2.689587]  #0:  (mtd_table_mutex){+.+...}, at:
[<ffffffff812bea45>] register_mtd_user+0x1a/0x69
[    2.691096]
[    2.691098] stack backtrace:
[    2.694059] Pid: 1, comm: swapper Not tainted 2.6.35-rc2-git1 #8
[    2.695601] Call Trace:
[    2.697243]  [<ffffffff81064e9c>] lockdep_rcu_dereference+0x9d/0xa5
[    2.698868]  [<ffffffff811b9c86>] idr_get_next+0x60/0x124
[    2.700556]  [<ffffffff812be779>] __mtd_next_device+0x1b/0x1d
[    2.702238]  [<ffffffff812bea7c>] register_mtd_user+0x51/0x69
[    2.703964]  [<ffffffff816cca45>] init_mtdchar+0xb3/0xd3
[    2.705686]  [<ffffffff816cc992>] ? init_mtdchar+0x0/0xd3
[    2.707470]  [<ffffffff810001ef>] do_one_initcall+0x59/0x14e
[    2.709255]  [<ffffffff816a768a>] kernel_init+0x144/0x1ce
[    2.711082]  [<ffffffff81003054>] kernel_thread_helper+0x4/0x10
[    2.712862]  [<ffffffff813ca480>] ? restore_args+0x0/0x30
[    2.714647]  [<ffffffff816a7546>] ? kernel_init+0x0/0x1ce
[    2.716415]  [<ffffffff81003050>] ? kernel_thread_helper+0x0/0x10

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: 2.6.35-rc2-git1 - lib/idr.c:605 invoked rcu_dereference_check() without protection!
  2010-06-07 18:23 2.6.35-rc2-git1 - lib/idr.c:605 invoked rcu_dereference_check() without protection! Miles Lane
@ 2010-06-08  0:12 ` Paul E. McKenney
  2010-06-08  4:28   ` Miles Lane
  0 siblings, 1 reply; 4+ messages in thread
From: Paul E. McKenney @ 2010-06-08  0:12 UTC (permalink / raw)
  To: Miles Lane
  Cc: Vivek Goyal, Eric Paris, David Woodhouse, Lai Jiangshan,
	Ingo Molnar, Peter Zijlstra, LKML, nauman, eric.dumazet, netdev,
	Jens Axboe, Gui Jianfeng, Li Zefan, Johannes Berg

On Mon, Jun 07, 2010 at 02:23:17PM -0400, Miles Lane wrote:
> [    2.677955] [ INFO: suspicious rcu_dereference_check() usage. ]
> [    2.679089] ---------------------------------------------------
> [    2.680276] lib/idr.c:605 invoked rcu_dereference_check() without protection!
> [    2.681499]
> [    2.681500] other info that might help us debug this:
> [    2.681501]
> [    2.685509]
> [    2.685510] rcu_scheduler_active = 1, debug_locks = 1
> [    2.688221] 1 lock held by swapper/1:
> [    2.689587]  #0:  (mtd_table_mutex){+.+...}, at:
> [<ffffffff812bea45>] register_mtd_user+0x1a/0x69
> [    2.691096]
> [    2.691098] stack backtrace:
> [    2.694059] Pid: 1, comm: swapper Not tainted 2.6.35-rc2-git1 #8
> [    2.695601] Call Trace:
> [    2.697243]  [<ffffffff81064e9c>] lockdep_rcu_dereference+0x9d/0xa5
> [    2.698868]  [<ffffffff811b9c86>] idr_get_next+0x60/0x124
> [    2.700556]  [<ffffffff812be779>] __mtd_next_device+0x1b/0x1d
> [    2.702238]  [<ffffffff812bea7c>] register_mtd_user+0x51/0x69
> [    2.703964]  [<ffffffff816cca45>] init_mtdchar+0xb3/0xd3
> [    2.705686]  [<ffffffff816cc992>] ? init_mtdchar+0x0/0xd3
> [    2.707470]  [<ffffffff810001ef>] do_one_initcall+0x59/0x14e
> [    2.709255]  [<ffffffff816a768a>] kernel_init+0x144/0x1ce
> [    2.711082]  [<ffffffff81003054>] kernel_thread_helper+0x4/0x10
> [    2.712862]  [<ffffffff813ca480>] ? restore_args+0x0/0x30
> [    2.714647]  [<ffffffff816a7546>] ? kernel_init+0x0/0x1ce
> [    2.716415]  [<ffffffff81003050>] ? kernel_thread_helper+0x0/0x10

This looks like a new one!  Does the following patch take care of it?

							Thanx, Paul

------------------------------------------------------------------------

commit 2d54a6c31b72c902b09d365e9c66205a5c07e549
Author: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Date:   Mon Jun 7 17:09:45 2010 -0700

    idr: fix RCU lockdep splat in idr_get_next()
    
    Convert to rcu_dereference_raw() given that many callers may have many
    different locking models.
    
    Located-by: Miles Lane <miles.lane@gmail.com>
    Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>

diff --git a/lib/idr.c b/lib/idr.c
index 2eb1dca..f099f25 100644
--- a/lib/idr.c
+++ b/lib/idr.c
@@ -599,7 +599,7 @@ void *idr_get_next(struct idr *idp, int *nextidp)
 	/* find first ent */
 	n = idp->layers * IDR_BITS;
 	max = 1 << n;
-	p = rcu_dereference(idp->top);
+	p = rcu_dereference_raw(idp->top);
 	if (!p)
 		return NULL;
 
@@ -607,7 +607,7 @@ void *idr_get_next(struct idr *idp, int *nextidp)
 		while (n > 0 && p) {
 			n -= IDR_BITS;
 			*paa++ = p;
-			p = rcu_dereference(p->ary[(id >> n) & IDR_MASK]);
+			p = rcu_dereference_raw(p->ary[(id >> n) & IDR_MASK]);
 		}
 
 		if (p) {

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: 2.6.35-rc2-git1 - lib/idr.c:605 invoked rcu_dereference_check() without protection!
  2010-06-08  0:12 ` Paul E. McKenney
@ 2010-06-08  4:28   ` Miles Lane
  2010-06-08 16:25     ` Paul E. McKenney
  0 siblings, 1 reply; 4+ messages in thread
From: Miles Lane @ 2010-06-08  4:28 UTC (permalink / raw)
  To: paulmck
  Cc: Vivek Goyal, Eric Paris, David Woodhouse, Lai Jiangshan,
	Ingo Molnar, Peter Zijlstra, LKML, nauman, eric.dumazet, netdev,
	Jens Axboe, Gui Jianfeng, Li Zefan, Johannes Berg

On Mon, Jun 7, 2010 at 8:12 PM, Paul E. McKenney
<paulmck@linux.vnet.ibm.com> wrote:
> On Mon, Jun 07, 2010 at 02:23:17PM -0400, Miles Lane wrote:
>> [    2.677955] [ INFO: suspicious rcu_dereference_check() usage. ]
>> [    2.679089] ---------------------------------------------------
>> [    2.680276] lib/idr.c:605 invoked rcu_dereference_check() without protection!
>> [    2.681499]
>> [    2.681500] other info that might help us debug this:
>> [    2.681501]
>> [    2.685509]
>> [    2.685510] rcu_scheduler_active = 1, debug_locks = 1
>> [    2.688221] 1 lock held by swapper/1:
>> [    2.689587]  #0:  (mtd_table_mutex){+.+...}, at:
>> [<ffffffff812bea45>] register_mtd_user+0x1a/0x69
>> [    2.691096]
>> [    2.691098] stack backtrace:
>> [    2.694059] Pid: 1, comm: swapper Not tainted 2.6.35-rc2-git1 #8
>> [    2.695601] Call Trace:
>> [    2.697243]  [<ffffffff81064e9c>] lockdep_rcu_dereference+0x9d/0xa5
>> [    2.698868]  [<ffffffff811b9c86>] idr_get_next+0x60/0x124
>> [    2.700556]  [<ffffffff812be779>] __mtd_next_device+0x1b/0x1d
>> [    2.702238]  [<ffffffff812bea7c>] register_mtd_user+0x51/0x69
>> [    2.703964]  [<ffffffff816cca45>] init_mtdchar+0xb3/0xd3
>> [    2.705686]  [<ffffffff816cc992>] ? init_mtdchar+0x0/0xd3
>> [    2.707470]  [<ffffffff810001ef>] do_one_initcall+0x59/0x14e
>> [    2.709255]  [<ffffffff816a768a>] kernel_init+0x144/0x1ce
>> [    2.711082]  [<ffffffff81003054>] kernel_thread_helper+0x4/0x10
>> [    2.712862]  [<ffffffff813ca480>] ? restore_args+0x0/0x30
>> [    2.714647]  [<ffffffff816a7546>] ? kernel_init+0x0/0x1ce
>> [    2.716415]  [<ffffffff81003050>] ? kernel_thread_helper+0x0/0x10
>
> This looks like a new one!  Does the following patch take care of it?
>
>                                                        Thanx, Paul
>
> ------------------------------------------------------------------------
>
> commit 2d54a6c31b72c902b09d365e9c66205a5c07e549
> Author: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> Date:   Mon Jun 7 17:09:45 2010 -0700
>
>    idr: fix RCU lockdep splat in idr_get_next()
>
>    Convert to rcu_dereference_raw() given that many callers may have many
>    different locking models.
>
>    Located-by: Miles Lane <miles.lane@gmail.com>
>    Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
>
> diff --git a/lib/idr.c b/lib/idr.c
> index 2eb1dca..f099f25 100644
> --- a/lib/idr.c
> +++ b/lib/idr.c
> @@ -599,7 +599,7 @@ void *idr_get_next(struct idr *idp, int *nextidp)
>        /* find first ent */
>        n = idp->layers * IDR_BITS;
>        max = 1 << n;
> -       p = rcu_dereference(idp->top);
> +       p = rcu_dereference_raw(idp->top);
>        if (!p)
>                return NULL;
>
> @@ -607,7 +607,7 @@ void *idr_get_next(struct idr *idp, int *nextidp)
>                while (n > 0 && p) {
>                        n -= IDR_BITS;
>                        *paa++ = p;
> -                       p = rcu_dereference(p->ary[(id >> n) & IDR_MASK]);
> +                       p = rcu_dereference_raw(p->ary[(id >> n) & IDR_MASK]);
>                }
>
>                if (p) {
>

Tested.  Looks good!

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: 2.6.35-rc2-git1 - lib/idr.c:605 invoked rcu_dereference_check() without protection!
  2010-06-08  4:28   ` Miles Lane
@ 2010-06-08 16:25     ` Paul E. McKenney
  0 siblings, 0 replies; 4+ messages in thread
From: Paul E. McKenney @ 2010-06-08 16:25 UTC (permalink / raw)
  To: Miles Lane
  Cc: Vivek Goyal, Eric Paris, David Woodhouse, Lai Jiangshan,
	Ingo Molnar, Peter Zijlstra, LKML, nauman, eric.dumazet, netdev,
	Jens Axboe, Gui Jianfeng, Li Zefan, Johannes Berg

On Tue, Jun 08, 2010 at 12:28:15AM -0400, Miles Lane wrote:
> On Mon, Jun 7, 2010 at 8:12 PM, Paul E. McKenney
> <paulmck@linux.vnet.ibm.com> wrote:
> > On Mon, Jun 07, 2010 at 02:23:17PM -0400, Miles Lane wrote:
> >> [    2.677955] [ INFO: suspicious rcu_dereference_check() usage. ]
> >> [    2.679089] ---------------------------------------------------
> >> [    2.680276] lib/idr.c:605 invoked rcu_dereference_check() without protection!
> >> [    2.681499]
> >> [    2.681500] other info that might help us debug this:
> >> [    2.681501]
> >> [    2.685509]
> >> [    2.685510] rcu_scheduler_active = 1, debug_locks = 1
> >> [    2.688221] 1 lock held by swapper/1:
> >> [    2.689587]  #0:  (mtd_table_mutex){+.+...}, at:
> >> [<ffffffff812bea45>] register_mtd_user+0x1a/0x69
> >> [    2.691096]
> >> [    2.691098] stack backtrace:
> >> [    2.694059] Pid: 1, comm: swapper Not tainted 2.6.35-rc2-git1 #8
> >> [    2.695601] Call Trace:
> >> [    2.697243]  [<ffffffff81064e9c>] lockdep_rcu_dereference+0x9d/0xa5
> >> [    2.698868]  [<ffffffff811b9c86>] idr_get_next+0x60/0x124
> >> [    2.700556]  [<ffffffff812be779>] __mtd_next_device+0x1b/0x1d
> >> [    2.702238]  [<ffffffff812bea7c>] register_mtd_user+0x51/0x69
> >> [    2.703964]  [<ffffffff816cca45>] init_mtdchar+0xb3/0xd3
> >> [    2.705686]  [<ffffffff816cc992>] ? init_mtdchar+0x0/0xd3
> >> [    2.707470]  [<ffffffff810001ef>] do_one_initcall+0x59/0x14e
> >> [    2.709255]  [<ffffffff816a768a>] kernel_init+0x144/0x1ce
> >> [    2.711082]  [<ffffffff81003054>] kernel_thread_helper+0x4/0x10
> >> [    2.712862]  [<ffffffff813ca480>] ? restore_args+0x0/0x30
> >> [    2.714647]  [<ffffffff816a7546>] ? kernel_init+0x0/0x1ce
> >> [    2.716415]  [<ffffffff81003050>] ? kernel_thread_helper+0x0/0x10
> >
> > This looks like a new one!  Does the following patch take care of it?
> >
> >                                                        Thanx, Paul
> >
> > ------------------------------------------------------------------------
> >
> > commit 2d54a6c31b72c902b09d365e9c66205a5c07e549
> > Author: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> > Date:   Mon Jun 7 17:09:45 2010 -0700
> >
> >    idr: fix RCU lockdep splat in idr_get_next()
> >
> >    Convert to rcu_dereference_raw() given that many callers may have many
> >    different locking models.
> >
> >    Located-by: Miles Lane <miles.lane@gmail.com>
> >    Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> >
> > diff --git a/lib/idr.c b/lib/idr.c
> > index 2eb1dca..f099f25 100644
> > --- a/lib/idr.c
> > +++ b/lib/idr.c
> > @@ -599,7 +599,7 @@ void *idr_get_next(struct idr *idp, int *nextidp)
> >        /* find first ent */
> >        n = idp->layers * IDR_BITS;
> >        max = 1 << n;
> > -       p = rcu_dereference(idp->top);
> > +       p = rcu_dereference_raw(idp->top);
> >        if (!p)
> >                return NULL;
> >
> > @@ -607,7 +607,7 @@ void *idr_get_next(struct idr *idp, int *nextidp)
> >                while (n > 0 && p) {
> >                        n -= IDR_BITS;
> >                        *paa++ = p;
> > -                       p = rcu_dereference(p->ary[(id >> n) & IDR_MASK]);
> > +                       p = rcu_dereference_raw(p->ary[(id >> n) & IDR_MASK]);
> >                }
> >
> >                if (p) {
> >
> 
> Tested.  Looks good!

Thank you very much for both locating this one and for testing the fix!
I have added your Tested-by.

							Thanx, Paul

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-06-08 16:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-07 18:23 2.6.35-rc2-git1 - lib/idr.c:605 invoked rcu_dereference_check() without protection! Miles Lane
2010-06-08  0:12 ` Paul E. McKenney
2010-06-08  4:28   ` Miles Lane
2010-06-08 16:25     ` Paul E. McKenney

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).