--- zzzz-none-000/linux-5.4.213/mm/kasan/report.c 2022-09-15 10:04:56.000000000 +0000 +++ miami-7690-761/linux-5.4.213/mm/kasan/report.c 2024-05-29 11:20:02.000000000 +0000 @@ -92,14 +92,24 @@ pr_err("==================================================================\n"); add_taint(TAINT_BAD_PAGE, LOCKDEP_NOW_UNRELIABLE); spin_unlock_irqrestore(&report_lock, *flags); - if (panic_on_warn) + if (panic_on_warn) { + /* + * This thread may hit another WARN() in the panic path. + * Resetting this prevents additional WARN() from panicking the + * system on this thread. Other threads are blocked by the + * panic_mutex in panic(). + */ + panic_on_warn = 0; panic("panic_on_warn set ...\n"); + } kasan_enable_current(); } static void print_track(struct kasan_track *track, const char *prefix) { pr_err("%s by task %u:\n", prefix, track->pid); + +#ifdef CONFIG_STACKDEPOT if (track->stack) { unsigned long *entries; unsigned int nr_entries; @@ -107,8 +117,11 @@ nr_entries = stack_depot_fetch(track->stack, &entries); stack_trace_print(entries, nr_entries, 0); } else { +#endif pr_err("(stack is not available)\n"); +#ifdef CONFIG_STACKDEPOT } +#endif } struct page *kasan_addr_to_page(const void *addr)