On 8/19/2025 11:30 PM, Catalin Marinas wrote:
On Mon, Aug 18, 2025 at 05:09:44PM +0800, Gu Bowen wrote:
Our syztester report the lockdep WARNING [1], which was identified in stable kernel version 5.10. However, this deadlock path no longer exists due to the refactoring of console_lock in v6.2-rc1 [2]. Coincidentally, there are two types of deadlocks that we have found here. One is the ABBA deadlock, as mentioned above [1], and the other is the AA deadlock was reported by Breno [3]. The latter's deadlock issue persists.
It's better to include the lockdep warning here rather than linking to other threads. Also since we are targeting upstream with this patch, I don't think we should mention lockdep warnings for 5.10.
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() [4].
[1] https://lore.kernel.org/all/20250730094914.566582-1-gubowen5@huawei.com/ [2] https://lore.kernel.org/all/20221116162152.193147-1-john.ogness@linutronix.d... [3] https://lore.kernel.org/all/20250731-kmemleak_lock-v1-1-728fd470198f@debian.... [4] https://lore.kernel.org/all/5ca375cd-4a20-4807-b897-68b289626550@redhat.com/ ====================
I suggest you add the 5.10 mention here if you want, text after "---" is normally stripped (well, not sure with Andrew's scripts).
Otherwise the patch looks fine.
Thank you for your advice, I will pay attention to these points in the future.
Best Regards, Guber