lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <672305efd02d3d29520f49a1c18e2f4da6e90902.camel@nvidia.com>
Date: Wed, 26 Mar 2025 15:37:14 +0000
From: Cosmin Ratiu <cratiu@...dia.com>
To: "stfomichev@...il.com" <stfomichev@...il.com>
CC: "pabeni@...hat.com" <pabeni@...hat.com>, "edumazet@...gle.com"
	<edumazet@...gle.com>, "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
	"davem@...emloft.net" <davem@...emloft.net>, "sdf@...ichev.me"
	<sdf@...ichev.me>, "kuba@...nel.org" <kuba@...nel.org>
Subject: Re: [PATCH net-next 2/9] net: hold instance lock during
 NETDEV_REGISTER/UP/UNREGISTER

On Wed, 2025-03-26 at 08:23 -0700, Stanislav Fomichev wrote:
> @@ -2028,7 +2028,7 @@ int unregister_netdevice_notifier(struct
> notifier_block *nb)
>  
>  	for_each_net(net) {
>  		__rtnl_net_lock(net);
> -		call_netdevice_unregister_net_notifiers(nb, net,
> true);
> +		call_netdevice_unregister_net_notifiers(nb, net,
> NULL);
>  		__rtnl_net_unlock(net);
>  	}

I tested. The deadlock is back now, because dev != NULL and if the lock
is held (like in the below stack), the mutex_lock will be attempted
again:

WARNING: possible recursive locking detected
6.14.0-rc6+ #148 Tainted: G        W      
--------------------------------------------
ip/1766 is trying to acquire lock:
ffff888110e18c80 (&dev->lock){+.+.}-{4:4}, at:
call_netdevice_unregister_notifiers+0x7d/0x140

but task is already holding lock:
ffff888130ae0c80 (&dev->lock){+.+.}-{4:4}, at:
do_setlink.isra.0+0x5b/0x1220

other info that might help us debug this: 
 Possible unsafe locking scenario:

       CPU0
       ----
  lock(&dev->lock);
  lock(&dev->lock);

 *** DEADLOCK ***

 May be due to missing lock nesting notation

2 locks held by ip/1766:
 #0: ffffffff82df18c8 (rtnl_mutex){+.+.}-{4:4}, at:
rtnl_newlink+0x35d/0xb50
 #1: ffff888130ae0c80 (&dev->lock){+.+.}-{4:4}, at:
do_setlink.isra.0+0x5b/0x1220

stack backtrace:

print_deadlock_bug+0x274/0x3b0
__lock_acquire+0x1229/0x2470
lock_acquire+0xb7/0x2b0
__mutex_lock+0xa6/0xd20
call_netdevice_unregister_notifiers+0x7d/0x140
netif_change_net_namespace+0x4ba/0xa90
do_setlink.isra.0+0xd5/0x1220

Cosmin.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ