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: <aJf-gL4n6xF5V-rk@MacBook-Air.local>
Date: Sat, 9 Aug 2025 19:05:52 -0700
From: Joe Damato <joe@...a.to>
To: Jakub Kicinski <kuba@...nel.org>
Cc: davem@...emloft.net, netdev@...r.kernel.org, edumazet@...gle.com,
	pabeni@...hat.com, andrew+netdev@...n.ch, horms@...nel.org,
	willemdebruijn.kernel@...il.com, skhawaja@...gle.com,
	sdf@...ichev.me, shuah@...nel.org, linux-kselftest@...r.kernel.org
Subject: Re: [PATCH net v2 3/3] net: prevent deadlocks when enabling NAPIs
 with mixed kthread config

On Fri, Aug 08, 2025 at 05:12:05PM -0700, Jakub Kicinski wrote:
> The following order of calls currently deadlocks if:
>  - device has threaded=1; and
>  - NAPI has persistent config with threaded=0.
> 
>   netif_napi_add_weight_config()
>     dev->threaded == 1
>       napi_kthread_create()
> 
>   napi_enable()
>     napi_restore_config()
>       napi_set_threaded(0)
>         napi_stop_kthread()
> 	  while (NAPIF_STATE_SCHED)
> 	    msleep(20)
> 
> We deadlock because disabled NAPI has STATE_SCHED set.
> Creating a thread in netif_napi_add() just to destroy it in
> napi_disable() is fairly ugly in the first place. Let's read
> both the device config and the NAPI config in netif_napi_add().
> 
> Fixes: e6d76268813d ("net: Update threaded state in napi config in netif_set_threaded")
> Signed-off-by: Jakub Kicinski <kuba@...nel.org>
> ---
>  net/core/dev.h | 8 ++++++++
>  net/core/dev.c | 5 +++--
>  2 files changed, 11 insertions(+), 2 deletions(-)
> 

Reviewed-by: Joe Damato <joe@...a.to>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ