From: Catalin Marinas <catalin.marinas@arm.com>
To: Gu Bowen <gubowen5@huawei.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Waiman Long <llong@redhat.com>,
stable@vger.kernel.org, linux-mm@kvack.org,
Breno Leitao <leitao@debian.org>,
John Ogness <john.ogness@linutronix.de>,
Lu Jialin <lujialin4@huawei.com>
Subject: Re: [PATCH v5] mm: Fix possible deadlock in kmemleak
Date: Tue, 26 Aug 2025 20:37:31 +0100 [thread overview]
Message-ID: <aK4M-2ZWN3aq7mwx@arm.com> (raw)
In-Reply-To: <20250822073541.1886469-1-gubowen5@huawei.com>
On Fri, Aug 22, 2025 at 03:35:41PM +0800, Gu Bowen wrote:
> There are some AA deadlock issues in kmemleak, similar to the situation
> reported by Breno [1]. The deadlock path is as follows:
>
> mem_pool_alloc()
> -> raw_spin_lock_irqsave(&kmemleak_lock, flags);
> -> pr_warn()
> -> netconsole subsystem
> -> netpoll
> -> __alloc_skb
> -> __create_object
> -> raw_spin_lock_irqsave(&kmemleak_lock, flags);
>
> To solve this problem, switch to printk_safe mode before printing warning
> message, this will redirect all printk()-s to a special per-CPU buffer,
> which will be flushed later from a safe context (irq work), and this
> deadlock problem can be avoided. The proper API to use should be
> printk_deferred_enter()/printk_deferred_exit() [2]. Another way is to
> place the warn print after kmemleak is released.
>
> [1]
> https://lore.kernel.org/all/20250731-kmemleak_lock-v1-1-728fd470198f@debian.org/#t
> [2]
> https://lore.kernel.org/all/5ca375cd-4a20-4807-b897-68b289626550@redhat.com/
> ====================
>
> Signed-off-by: Gu Bowen <gubowen5@huawei.com>
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
next prev parent reply other threads:[~2025-08-26 19:37 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-22 7:35 [PATCH v5] mm: Fix possible deadlock in kmemleak Gu Bowen
2025-08-22 7:24 ` kernel test robot
2025-08-26 8:23 ` Breno Leitao
2025-08-26 19:37 ` Catalin Marinas [this message]
2025-08-26 23:23 ` Waiman Long
2025-09-19 10:37 ` Breno Leitao
2025-09-25 14:33 ` Catalin Marinas
2025-09-26 14:57 ` Breno Leitao
2025-09-29 14:07 ` John Ogness
2025-09-29 14:40 ` Breno Leitao
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aK4M-2ZWN3aq7mwx@arm.com \
--to=catalin.marinas@arm.com \
--cc=akpm@linux-foundation.org \
--cc=gregkh@linuxfoundation.org \
--cc=gubowen5@huawei.com \
--cc=john.ogness@linutronix.de \
--cc=leitao@debian.org \
--cc=linux-mm@kvack.org \
--cc=llong@redhat.com \
--cc=lujialin4@huawei.com \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.