]> Git Repo - linux.git/commitdiff
ubsan: check panic_on_warn
authorKees Cook <[email protected]>
Tue, 7 Apr 2020 03:12:38 +0000 (20:12 -0700)
committerLinus Torvalds <[email protected]>
Tue, 7 Apr 2020 17:43:44 +0000 (10:43 -0700)
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]>
lib/ubsan.c

index 7b9b58aee72c9080923f309cdc47de9756ff7c37..429663eef6a7d03ee2371a9fb5d90f1ab600f49f 100644 (file)
@@ -156,6 +156,17 @@ static void ubsan_epilogue(void)
                "========================================\n");
 
        current->in_ubsan--;
+
+       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");
+       }
 }
 
 static void handle_overflow(struct overflow_data *data, void *lhs,
This page took 0.055552 seconds and 4 git commands to generate.