Skip to contentSkip to conversation

kasan: support panic_on_warn

PATCH Applied Dmitry Vyukov 2 participants 2 messages Oct 17, 2016

Subsystems (2)
lore
Share & tools
lore

Dmitry Vyukov

author reviewer
#0 lore raw

PATCH v2 1/1 kasan: support panic_on_warn

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.

---

Changes from v1:
- don't reset panic_on_warn before calling panic()

---
 mm/kasan/report.c | 2 ++
 1 file changed, 2 insertions(+)
mm/kasan/report.c +2 -0
index 24c1211..0ee8211 100644
@@ -133,6 +133,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();
 }
 
Signature · 7 lines
2.8.0.rc3.226.g39d4020

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Acked-by on v2 1/1
#1 lore raw
Quoted 9 lines · Dmitry Vyukov

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.

Quoted 8 lines
Quoted 14 lines

---

Changes from v1:
- don't reset panic_on_warn before calling panic()

---
 mm/kasan/report.c | 2 ++
 1 file changed, 2 insertions(+)
mm/kasan/report.c +0 -0
index 24c1211..0ee8211 100644

mm/kasan/report.c static void kasan_end_report(unsigned long *flags) · line 140

Quoted 8 lines
mm/kasan/report.c +2 -0
@@ -133,6 +133,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();
 }
 

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>