kasan: support panic_on_warn
authorDmitry Vyukov <[email protected]>
Tue, 13 Dec 2016 00:44:53 +0000 (16:44 -0800)
committerLinus Torvalds <[email protected]>
Tue, 13 Dec 2016 02:55:09 +0000 (18:55 -0800)
If user sets panic_on_warn, he wants kernel to panic if there is
anything barely wrong with the kernel.  KASAN-detected errors are
definitely not less benign than an arbitrary kernel WARNING.

Panic after KASAN errors if panic_on_warn is set.

We use this for continuous fuzzing where we want kernel to stop and
reboot on any error.

Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Dmitry Vyukov <[email protected]>
Acked-by: Andrey Ryabinin <[email protected]>
Cc: Alexander Potapenko <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
mm/kasan/report.c

index 073325aedc68542a3b05f3859d89a9872aef815f..b82b3e2151574ae1abbb2cd57624114727975410 100644 (file)
@@ -136,6 +136,8 @@ static void kasan_end_report(unsigned long *flags)
        pr_err("==================================================================\n");
        add_taint(TAINT_BAD_PAGE, LOCKDEP_NOW_UNRELIABLE);
        spin_unlock_irqrestore(&report_lock, *flags);
+       if (panic_on_warn)
+               panic("panic_on_warn set ...\n");
        kasan_enable_current();
 }