diff --git a/include/linux/bug.h b/include/linux/bug.h index da4231c905c8..e170bda4db9f 100644 --- a/include/linux/bug.h +++ b/include/linux/bug.h @@ -71,4 +71,9 @@ static inline __must_check bool check_data_corruption(bool v) { return v; } corruption; \ })) +#ifdef CONFIG_PANIC_ON_DATA_CORRUPTION +#define PANIC_CORRUPTION 1 +#else +#define PANIC_CORRUPTION 0 +#endif /* CONFIG_PANIC_ON_DATA_CORRUPTION */ #endif /* _LINUX_BUG_H */ diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index d87c2fa56ed5..7d0fa2f9f431 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -2061,6 +2061,13 @@ config BUG_ON_DATA_CORRUPTION If unsure, say N. +config PANIC_ON_DATA_CORRUPTION + bool "Cause a Kernel Panic When Data Corruption is detected" + help + Select this option to upgrade warnings for potentially + recoverable data corruption scenarios to system-halting panics, + for easier detection and debug. + source "samples/Kconfig" source "lib/Kconfig.kgdb"