[PATCH] KASan: turn warning into panic if CONFIG_BUG_ON_DATA_CORRUPTION=y

Ahmad Fatoum a.fatoum at pengutronix.de
Mon Jan 26 02:56:05 PST 2026


Especially for use during automated testing, it's useful to have barebox
panic on KASAN issues.

Let's do so when CONFIG_BUG_ON_DATA_CORRUPTION=y.

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 lib/kasan/report.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/kasan/report.c b/lib/kasan/report.c
index b7844e93553c..c15a9c942f35 100644
--- a/lib/kasan/report.c
+++ b/lib/kasan/report.c
@@ -179,6 +179,9 @@ static void __kasan_report(unsigned long addr, size_t size, bool is_write,
 	}
 
 	end_report(&flags);
+
+	if (IS_ENABLED(CONFIG_BUG_ON_DATA_CORRUPTION))
+		panic_no_stacktrace("");
 }
 
 bool kasan_report(unsigned long addr, size_t size, bool is_write,
-- 
2.47.3




More information about the barebox mailing list