netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* 2.6.39-rc6-mmotm0506 - another lockdep splat (networking this time)
@ 2011-05-10  1:05 Valdis.Kletnieks
  2011-05-10  2:23 ` Eric Dumazet
  0 siblings, 1 reply; 6+ messages in thread
From: Valdis.Kletnieks @ 2011-05-10  1:05 UTC (permalink / raw)
  To: Andrew Morton, David S. Miller; +Cc: linux-kernel, netdev

[-- Attachment #1: Type: text/plain, Size: 2458 bytes --]

Seen during boot this afternoon:

[   43.309549] 
[   43.309550] ===================================================
[   43.309553] [ INFO: suspicious rcu_dereference_check() usage. ]
[   43.309555] ---------------------------------------------------
[   43.309558] include/linux/inetdevice.h:226 invoked rcu_dereference_check() without protection!
[   43.309560] 
[   43.309561] other info that might help us debug this:
[   43.309561] 
[   43.309563] 
[   43.309564] rcu_scheduler_active = 1, debug_locks = 1
[   43.309567] 2 locks held by ip/1193:
[   43.309568]  #0:  (nlk->cb_mutex){+.+...}, at: [<ffffffff81426c1d>] netlink_dump+0x45/0x1d0
[   43.309579]  #1:  (rcu_read_lock){.+.+..}, at: [<ffffffff8141b9b9>] rtnl_dump_ifinfo+0x0/0x156
[   43.309587] 
[   43.309587] stack backtrace:
[   43.309590] Pid: 1193, comm: ip Not tainted 2.6.39-rc6-mmotm0506 #1
[   43.309592] Call Trace:
[   43.309599]  [<ffffffff81066b6e>] lockdep_rcu_dereference+0x9a/0xa2
[   43.309604]  [<ffffffff81468d41>] __in_dev_get_rtnl+0x3c/0x47
[   43.309607]  [<ffffffff81468ef0>] inet_fill_link_af+0x12/0x5b
[   43.309611]  [<ffffffff8141b8fc>] rtnl_fill_ifinfo+0x665/0x710
[   43.309616]  [<ffffffff8141ba76>] rtnl_dump_ifinfo+0xbd/0x156
[   43.309620]  [<ffffffff81426c37>] netlink_dump+0x5f/0x1d0
[   43.309624]  [<ffffffff81404e3e>] ? consume_skb+0x8a/0x8f
[   43.309628]  [<ffffffff81426fc8>] netlink_recvmsg+0x1dd/0x31d
[   43.309632]  [<ffffffff813ff21f>] ? rcu_read_unlock+0x21/0x23
[   43.309636]  [<ffffffff813fab57>] sock_recvmsg+0xed/0x112
[   43.309641]  [<ffffffff810d1ebf>] ? might_fault+0x4e/0x9e
[   43.309645]  [<ffffffff81068816>] ? __lock_release+0x93/0x9c
[   43.309649]  [<ffffffff810d1ebf>] ? might_fault+0x4e/0x9e
[   43.309652]  [<ffffffff810d1f08>] ? might_fault+0x97/0x9e
[   43.309656]  [<ffffffff814065f8>] ? copy_from_user+0x3c/0x44
[   43.309660]  [<ffffffff813fc047>] __sys_recvmsg+0x16c/0x224
[   43.309665]  [<ffffffff81059240>] ? up_read+0x23/0x27
[   43.309669]  [<ffffffff81065165>] ? arch_local_irq_save+0x9/0xc
[   43.309673]  [<ffffffff810f736b>] ? fcheck_files+0xb4/0xeb
[   43.309676]  [<ffffffff810f79f3>] ? fget_light+0x35/0x96
[   43.309680]  [<ffffffff813fdded>] sys_recvmsg+0x3d/0x5b
[   43.309686]  [<ffffffff815705bb>] system_call_fastpath+0x16/0x1b
[   44.437679] e1000e 0000:00:19.0: irq 46 for MSI/MSI-X
[   44.488363] e1000e 0000:00:19.0: irq 46 for MSI/MSI-X
[   44.494680] ADDRCONF(NETDEV_UP): eth0: link is not ready



[-- Attachment #2: Type: application/pgp-signature, Size: 227 bytes --]

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

* Re: 2.6.39-rc6-mmotm0506 - another lockdep splat (networking this time)
  2011-05-10  1:05 2.6.39-rc6-mmotm0506 - another lockdep splat (networking this time) Valdis.Kletnieks
@ 2011-05-10  2:23 ` Eric Dumazet
  2011-05-10  3:47   ` Eric Dumazet
  0 siblings, 1 reply; 6+ messages in thread
From: Eric Dumazet @ 2011-05-10  2:23 UTC (permalink / raw)
  To: Valdis.Kletnieks; +Cc: Andrew Morton, David S. Miller, linux-kernel, netdev

Le lundi 09 mai 2011 à 21:05 -0400, Valdis.Kletnieks@vt.edu a écrit :
> Seen during boot this afternoon:
> 
> [   43.309549] 
> [   43.309550] ===================================================
> [   43.309553] [ INFO: suspicious rcu_dereference_check() usage. ]
> [   43.309555] ---------------------------------------------------
> [   43.309558] include/linux/inetdevice.h:226 invoked rcu_dereference_check() without protection!
> [   43.309560] 
> [   43.309561] other info that might help us debug this:
> [   43.309561] 
> [   43.309563] 
> [   43.309564] rcu_scheduler_active = 1, debug_locks = 1
> [   43.309567] 2 locks held by ip/1193:
> [   43.309568]  #0:  (nlk->cb_mutex){+.+...}, at: [<ffffffff81426c1d>] netlink_dump+0x45/0x1d0
> [   43.309579]  #1:  (rcu_read_lock){.+.+..}, at: [<ffffffff8141b9b9>] rtnl_dump_ifinfo+0x0/0x156

strange : rcu_read_lock() is correctly held at this point

> [   43.309587] 
> [   43.309587] stack backtrace:
> [   43.309590] Pid: 1193, comm: ip Not tainted 2.6.39-rc6-mmotm0506 #1
> [   43.309592] Call Trace:
> [   43.309599]  [<ffffffff81066b6e>] lockdep_rcu_dereference+0x9a/0xa2
> [   43.309604]  [<ffffffff81468d41>] __in_dev_get_rtnl+0x3c/0x47
> [   43.309607]  [<ffffffff81468ef0>] inet_fill_link_af+0x12/0x5b
> [   43.309611]  [<ffffffff8141b8fc>] rtnl_fill_ifinfo+0x665/0x710
> [   43.309616]  [<ffffffff8141ba76>] rtnl_dump_ifinfo+0xbd/0x156
> [   43.309620]  [<ffffffff81426c37>] netlink_dump+0x5f/0x1d0
> [   43.309624]  [<ffffffff81404e3e>] ? consume_skb+0x8a/0x8f
> [   43.309628]  [<ffffffff81426fc8>] netlink_recvmsg+0x1dd/0x31d
> [   43.309632]  [<ffffffff813ff21f>] ? rcu_read_unlock+0x21/0x23
> [   43.309636]  [<ffffffff813fab57>] sock_recvmsg+0xed/0x112
> [   43.309641]  [<ffffffff810d1ebf>] ? might_fault+0x4e/0x9e
> [   43.309645]  [<ffffffff81068816>] ? __lock_release+0x93/0x9c
> [   43.309649]  [<ffffffff810d1ebf>] ? might_fault+0x4e/0x9e
> [   43.309652]  [<ffffffff810d1f08>] ? might_fault+0x97/0x9e
> [   43.309656]  [<ffffffff814065f8>] ? copy_from_user+0x3c/0x44
> [   43.309660]  [<ffffffff813fc047>] __sys_recvmsg+0x16c/0x224
> [   43.309665]  [<ffffffff81059240>] ? up_read+0x23/0x27
> [   43.309669]  [<ffffffff81065165>] ? arch_local_irq_save+0x9/0xc
> [   43.309673]  [<ffffffff810f736b>] ? fcheck_files+0xb4/0xeb
> [   43.309676]  [<ffffffff810f79f3>] ? fget_light+0x35/0x96
> [   43.309680]  [<ffffffff813fdded>] sys_recvmsg+0x3d/0x5b
> [   43.309686]  [<ffffffff815705bb>] system_call_fastpath+0x16/0x1b
> [   44.437679] e1000e 0000:00:19.0: irq 46 for MSI/MSI-X
> [   44.488363] e1000e 0000:00:19.0: irq 46 for MSI/MSI-X
> [   44.494680] ADDRCONF(NETDEV_UP): eth0: link is not ready
> 
> 

Thanks for the report, I am taking a look how to fix this.

I am testing following patch, I'll provide an official one when
validated.



diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index cd9ca08..6b1eb92 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -1369,7 +1369,7 @@ errout:
 
 static size_t inet_get_link_af_size(const struct net_device *dev)
 {
-	struct in_device *in_dev = __in_dev_get_rtnl(dev);
+	struct in_device *in_dev = __in_dev_get_rcu(dev);
 
 	if (!in_dev)
 		return 0;
@@ -1379,7 +1379,7 @@ static size_t inet_get_link_af_size(const struct net_device *dev)
 
 static int inet_fill_link_af(struct sk_buff *skb, const struct net_device *dev)
 {
-	struct in_device *in_dev = __in_dev_get_rtnl(dev);
+	struct in_device *in_dev = __in_dev_get_rcu(dev);
 	struct nlattr *nla;
 	int i;
 

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

* Re: 2.6.39-rc6-mmotm0506 - another lockdep splat (networking this time)
  2011-05-10  2:23 ` Eric Dumazet
@ 2011-05-10  3:47   ` Eric Dumazet
  2011-05-10  3:58     ` David Miller
  0 siblings, 1 reply; 6+ messages in thread
From: Eric Dumazet @ 2011-05-10  3:47 UTC (permalink / raw)
  To: Valdis.Kletnieks; +Cc: Andrew Morton, David S. Miller, linux-kernel, netdev

Le mardi 10 mai 2011 à 04:23 +0200, Eric Dumazet a écrit :

> Thanks for the report, I am taking a look how to fix this.
> 

OK here is the official patch submission

Thanks Valdis !

[PATCH net-next-2.6] net: fix two lockdep splats

Commit e67f88dd12f6 (net: dont hold rtnl mutex during netlink dump
callbacks) switched rtnl protection to RCU, but we forgot to adjust two
rcu_dereference() lockdep annotations :

inet_get_link_af_size() or inet_fill_link_af() might be called with
rcu_read_lock or rtnl held, so use rcu_dereference_rtnl()
instead of rtnl_dereference()

Reported-by: Valdis Kletnieks <Valdis.Kletnieks@vt.edu>
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---
 net/ipv4/devinet.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index cd9ca08..6b1eb92 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -1369,7 +1369,7 @@ errout:
 
 static size_t inet_get_link_af_size(const struct net_device *dev)
 {
-	struct in_device *in_dev = __in_dev_get_rtnl(dev);
+	struct in_device *in_dev = rcu_dereference_rtnl(dev->ip_ptr);
 
 	if (!in_dev)
 		return 0;
@@ -1379,7 +1379,7 @@ static size_t inet_get_link_af_size(const struct net_device *dev)
 
 static int inet_fill_link_af(struct sk_buff *skb, const struct net_device *dev)
 {
-	struct in_device *in_dev = __in_dev_get_rtnl(dev);
+	struct in_device *in_dev = rcu_dereference_rtnl(dev->ip_ptr);
 	struct nlattr *nla;
 	int i;
 

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

* Re: 2.6.39-rc6-mmotm0506 - another lockdep splat (networking this time)
  2011-05-10  3:47   ` Eric Dumazet
@ 2011-05-10  3:58     ` David Miller
  2011-05-10 21:48       ` Eric Dumazet
  0 siblings, 1 reply; 6+ messages in thread
From: David Miller @ 2011-05-10  3:58 UTC (permalink / raw)
  To: eric.dumazet; +Cc: Valdis.Kletnieks, akpm, linux-kernel, netdev

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Tue, 10 May 2011 05:47:51 +0200

> [PATCH net-next-2.6] net: fix two lockdep splats
> 
> Commit e67f88dd12f6 (net: dont hold rtnl mutex during netlink dump
> callbacks) switched rtnl protection to RCU, but we forgot to adjust two
> rcu_dereference() lockdep annotations :
> 
> inet_get_link_af_size() or inet_fill_link_af() might be called with
> rcu_read_lock or rtnl held, so use rcu_dereference_rtnl()
> instead of rtnl_dereference()
> 
> Reported-by: Valdis Kletnieks <Valdis.Kletnieks@vt.edu>
> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>

Applied, thanks everyone.

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

* Re: 2.6.39-rc6-mmotm0506 - another lockdep splat (networking this time)
  2011-05-10  3:58     ` David Miller
@ 2011-05-10 21:48       ` Eric Dumazet
  2011-05-10 21:59         ` David Miller
  0 siblings, 1 reply; 6+ messages in thread
From: Eric Dumazet @ 2011-05-10 21:48 UTC (permalink / raw)
  To: David Miller; +Cc: Valdis.Kletnieks, akpm, linux-kernel, netdev

Le lundi 09 mai 2011 à 20:58 -0700, David Miller a écrit :
> From: Eric Dumazet <eric.dumazet@gmail.com>
> Date: Tue, 10 May 2011 05:47:51 +0200
> 
> > [PATCH net-next-2.6] net: fix two lockdep splats
> > 
> > Commit e67f88dd12f6 (net: dont hold rtnl mutex during netlink dump
> > callbacks) switched rtnl protection to RCU, but we forgot to adjust two
> > rcu_dereference() lockdep annotations :
> > 
> > inet_get_link_af_size() or inet_fill_link_af() might be called with
> > rcu_read_lock or rtnl held, so use rcu_dereference_rtnl()
> > instead of rtnl_dereference()
> > 
> > Reported-by: Valdis Kletnieks <Valdis.Kletnieks@vt.edu>
> > Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
> 
> Applied, thanks everyone.

David, I found you applied this patch for net-2.6, but it was
net-next-2.6 material only ...

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

* Re: 2.6.39-rc6-mmotm0506 - another lockdep splat (networking this time)
  2011-05-10 21:48       ` Eric Dumazet
@ 2011-05-10 21:59         ` David Miller
  0 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2011-05-10 21:59 UTC (permalink / raw)
  To: eric.dumazet; +Cc: Valdis.Kletnieks, akpm, linux-kernel, netdev

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Tue, 10 May 2011 23:48:36 +0200

> Le lundi 09 mai 2011 à 20:58 -0700, David Miller a écrit :
>> From: Eric Dumazet <eric.dumazet@gmail.com>
>> Date: Tue, 10 May 2011 05:47:51 +0200
>> 
>> > [PATCH net-next-2.6] net: fix two lockdep splats
>> > 
>> > Commit e67f88dd12f6 (net: dont hold rtnl mutex during netlink dump
>> > callbacks) switched rtnl protection to RCU, but we forgot to adjust two
>> > rcu_dereference() lockdep annotations :
>> > 
>> > inet_get_link_af_size() or inet_fill_link_af() might be called with
>> > rcu_read_lock or rtnl held, so use rcu_dereference_rtnl()
>> > instead of rtnl_dereference()
>> > 
>> > Reported-by: Valdis Kletnieks <Valdis.Kletnieks@vt.edu>
>> > Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
>> 
>> Applied, thanks everyone.
> 
> David, I found you applied this patch for net-2.6, but it was
> net-next-2.6 material only ...

Thanks for catching that, I'll fix this.

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

end of thread, other threads:[~2011-05-10 21:59 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-10  1:05 2.6.39-rc6-mmotm0506 - another lockdep splat (networking this time) Valdis.Kletnieks
2011-05-10  2:23 ` Eric Dumazet
2011-05-10  3:47   ` Eric Dumazet
2011-05-10  3:58     ` David Miller
2011-05-10 21:48       ` Eric Dumazet
2011-05-10 21:59         ` David Miller

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