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: <20250327115802.4e2d5d88@kernel.org>
Date: Thu, 27 Mar 2025 11:58:02 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Stanislav Fomichev <sdf@...ichev.me>
Cc: netdev@...r.kernel.org, davem@...emloft.net, edumazet@...gle.com,
 pabeni@...hat.com, Cosmin Ratiu <cratiu@...dia.com>
Subject: Re: [PATCH net v2 02/11] net: hold instance lock during
 NETDEV_REGISTER/UP/UNREGISTER

On Thu, 27 Mar 2025 06:56:50 -0700 Stanislav Fomichev wrote:
>  static void call_netdevice_unregister_notifiers(struct notifier_block *nb,
> -						struct net_device *dev)
> +						struct net_device *dev,
> +						struct net_device *locked)
>  {
>  	if (dev->flags & IFF_UP) {
>  		call_netdevice_notifier(nb, NETDEV_GOING_DOWN,
>  					dev);
>  		call_netdevice_notifier(nb, NETDEV_DOWN, dev);
>  	}
> +	if (dev != locked)
> +		netdev_lock_ops(dev);
>  	call_netdevice_notifier(nb, NETDEV_UNREGISTER, dev);
> +	if (dev != locked)
> +		netdev_unlock_ops(dev);
>  }
>  
>  static int call_netdevice_register_net_notifiers(struct notifier_block *nb,
> -						 struct net *net)
> +						 struct net *net,
> +						 struct net_device *locked)
>  {
>  	struct net_device *dev;
>  	int err;
>  
>  	for_each_netdev(net, dev) {
> +		if (locked != dev)
> +			netdev_lock_ops(dev);
>  		err = call_netdevice_register_notifiers(nb, dev);
> +		if (locked != dev)
> +			netdev_unlock_ops(dev);
>  		if (err)
>  			goto rollback;
>  	}

Any strong reason we wouldn't split the netns change into two chunks, 
and release the ops lock while we move the notifiers?
I'm thinking rename netif_change_net_namespace() back to
dev_change_net_namespace(), move it up in setlink, and let it take 
the lock.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ