Re: [syzbot] [bluetooth?] INFO: task hung in hci_conn_failed

From: Hillf Danton
Date: Tue Jan 30 2024 - 06:31:10 EST


On Mon, 29 Jan 2024 12:25:13 -0800 Boqun Feng <boqun.feng@xxxxxxxxx>
>
> Looks to me that debug_show_all_locks() doesn't hold the lockdep lock,
> so it's really a best effort race read of all tasks on lock hold
> information. Maybe Hillf wants the following? (Completely untested, it
> will stop your whole system and print lock holding information).

#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master

--- a/kernel/locking/lockdep.c
+++ b/kernel/locking/lockdep.c
@@ -6611,6 +6611,8 @@ void debug_show_all_locks(void)
}
pr_warn("\nShowing all locks held in the system:\n");

+ local_irq_disable();
+ lockdep_lock();
rcu_read_lock();
for_each_process_thread(g, p) {
if (!p->lockdep_depth)
@@ -6620,6 +6622,8 @@ void debug_show_all_locks(void)
touch_all_softlockup_watchdogs();
}
rcu_read_unlock();
+ lockdep_unlock();
+ local_irq_enable();

pr_warn("\n");
pr_warn("=============================================\n\n");
--