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.

Signed-off-by: Dmitry Vyukov <dvyu...@google.com>
Cc: kasan-...@googlegroups.com
Cc: Andrey Ryabinin <aryabi...@virtuozzo.com>
Cc: Alexander Potapenko <gli...@google.com>
Cc: Andrew Morton <a...@linux-foundation.org>
Cc: linux...@kvack.org
Cc: linux-kernel@vger.kernel.org
 mm/kasan/report.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/mm/kasan/report.c b/mm/kasan/report.c
index 24c1211..ca0bd48 100644
--- a/mm/kasan/report.c
+++ b/mm/kasan/report.c
@@ -133,6 +133,10 @@ static void kasan_end_report(unsigned long *flags)
        spin_unlock_irqrestore(&report_lock, *flags);
+       if (panic_on_warn) {
+               panic_on_warn = 0;
+               panic("panic_on_warn set ...\n");
+       }

Reply via email to