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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aJCKtmtus770t5LA@arm.com>
Date: Mon, 4 Aug 2025 11:25:58 +0100
From: Catalin Marinas <catalin.marinas@....com>
To: Breno Leitao <leitao@...ian.org>
Cc: Andrew Morton <akpm@...ux-foundation.org>, linux-mm@...ck.org,
	linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
	kuba@...nel.org, stable@...rel.org, kernel-team@...a.com
Subject: Re: [PATCH] mm/kmemleak: avoid deadlock by moving pr_warn() outside
 kmemleak_lock

On Thu, Jul 31, 2025 at 02:57:18AM -0700, Breno Leitao wrote:
> When netpoll is enabled, calling pr_warn_once() while holding
> kmemleak_lock in mem_pool_alloc() can cause a deadlock due to lock
> inversion with the netconsole subsystem. This occurs because
> pr_warn_once() may trigger netpoll, which eventually leads to
> __alloc_skb() and back into kmemleak code, attempting to reacquire
> kmemleak_lock.
> 
> This is the path for the deadlock.
> 
> mem_pool_alloc()
>   -> raw_spin_lock_irqsave(&kmemleak_lock, flags);
>       -> pr_warn_once()
>           -> netconsole subsystem
> 	     -> netpoll
> 	         -> __alloc_skb
> 		   -> __create_object
> 		     -> raw_spin_lock_irqsave(&kmemleak_lock, flags);
> 
> Fix this by setting a flag and issuing the pr_warn_once() after
> kmemleak_lock is released.
> 
> Reported-by: Jakub Kicinski <kuba@...nel.org>
> Fixes: c5665868183fec ("mm: kmemleak: use the memory pool for early allocations")
> Signed-off-by: Breno Leitao <leitao@...ian.org>

I think Andrew already added this to mm-stable but, for the record:

Acked-by: Catalin Marinas <catalin.marinas@....com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ