kernel/lib: add additional debug capabilities for data corruption

Data corruptions in the kernel often end up in system crashes that
are easier to debug closer to the time of detection. Specifically,
if we do not panic immediately after lock or list corruptions have been
detected, the problem context is lost in the ensuing system mayhem.
Add support for BUG_ON immediately after such corruptions are detected.
The CONFIG option controls the enabling/disabling of the feature.

Change-Id: I9b2eb62da506a13007acff63e85e9515145909ff
Signed-off-by: Syed Rameez Mustafa <rameezmustafa@codeaurora.org>
Signed-off-by: Patrick Daly <pdaly@codeaurora.org>
Signed-off-by: Isaac J. Manjarres <isaacm@codeaurora.org>
This commit is contained in:
Syed Rameez Mustafa 2013-07-15 11:52:09 -07:00 committed by Gerrit - the friendly Code Review server
parent 096d47461c
commit 8c97fea74f
2 changed files with 14 additions and 0 deletions

View File

@ -81,4 +81,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 */

View File

@ -2134,6 +2134,15 @@ 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.
If we do not panic immediately after corruptions have been detected,
the problem context is lost in the ensuing system mayhem.
source "samples/Kconfig"
source "lib/Kconfig.kgdb"