Skip to content

Commit 1d28c8d

Browse files
keestorvalds
authored andcommitted
ubsan: check panic_on_warn
Syzkaller expects kernel warnings to panic when the panic_on_warn sysctl is set. More work is needed here to have UBSan reuse the WARN infrastructure, but for now, just check the flag manually. Signed-off-by: Kees Cook <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Cc: Alexander Potapenko <[email protected]> Cc: Andrey Konovalov <[email protected]> Cc: Andrey Ryabinin <[email protected]> Cc: Ard Biesheuvel <[email protected]> Cc: Arnd Bergmann <[email protected]> Cc: Dan Carpenter <[email protected]> Cc: Dmitry Vyukov <[email protected]> Cc: Elena Petrova <[email protected]> Cc: "Gustavo A. R. Silva" <[email protected]> Link: https://lore.kernel.org/lkml/CACT4Y+bsLJ-wFx_TaXqax3JByUOWB3uk787LsyMVcfW6JzzGvg@mail.gmail.com Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Linus Torvalds <[email protected]>
1 parent ae2e1aa commit 1d28c8d

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

lib/ubsan.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,17 @@ static void ubsan_epilogue(void)
156156
"========================================\n");
157157

158158
current->in_ubsan--;
159+
160+
if (panic_on_warn) {
161+
/*
162+
* This thread may hit another WARN() in the panic path.
163+
* Resetting this prevents additional WARN() from panicking the
164+
* system on this thread. Other threads are blocked by the
165+
* panic_mutex in panic().
166+
*/
167+
panic_on_warn = 0;
168+
panic("panic_on_warn set ...\n");
169+
}
159170
}
160171

161172
static void handle_overflow(struct overflow_data *data, void *lhs,

0 commit comments

Comments
 (0)