Loading include/linux/bug.h +6 −0 Original line number Diff line number Diff line Loading @@ -121,4 +121,10 @@ static inline enum bug_trap_type report_bug(unsigned long bug_addr, } #endif /* CONFIG_GENERIC_BUG */ #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 */ kernel/workqueue.c +1 −0 Original line number Diff line number Diff line Loading @@ -2116,6 +2116,7 @@ __acquires(&pool->lock) current->comm, preempt_count(), task_pid_nr(current), worker->current_func); debug_show_held_locks(current); BUG_ON(PANIC_CORRUPTION); dump_stack(); } Loading lib/Kconfig.debug +7 −0 Original line number Diff line number Diff line Loading @@ -2038,6 +2038,13 @@ config TEST_STATIC_KEYS 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" Loading lib/list_debug.c +9 −2 Original line number Diff line number Diff line Loading @@ -11,6 +11,7 @@ #include <linux/bug.h> #include <linux/kernel.h> #include <linux/rculist.h> #include <linux/bug.h> /* * Insert a new entry between two known consecutive entries. Loading @@ -34,6 +35,10 @@ void __list_add(struct list_head *new, WARN(new == prev || new == next, "list_add double add: new=%p, prev=%p, next=%p.\n", new, prev, next); BUG_ON((prev->next != next || next->prev != prev || new == prev || new == next) && PANIC_CORRUPTION); next->prev = new; new->next = next; new->prev = prev; Loading @@ -58,9 +63,11 @@ void __list_del_entry(struct list_head *entry) "list_del corruption. prev->next should be %p, " "but was %p\n", entry, prev->next) || WARN(next->prev != entry, "list_del corruption. next->prev should be %p, " "but was %p\n", entry, next->prev)) "list_del corruption. next->prev should be %p, but was %p\n", entry, next->prev)) { BUG_ON(PANIC_CORRUPTION); return; } __list_del(prev, next); } Loading Loading
include/linux/bug.h +6 −0 Original line number Diff line number Diff line Loading @@ -121,4 +121,10 @@ static inline enum bug_trap_type report_bug(unsigned long bug_addr, } #endif /* CONFIG_GENERIC_BUG */ #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 */
kernel/workqueue.c +1 −0 Original line number Diff line number Diff line Loading @@ -2116,6 +2116,7 @@ __acquires(&pool->lock) current->comm, preempt_count(), task_pid_nr(current), worker->current_func); debug_show_held_locks(current); BUG_ON(PANIC_CORRUPTION); dump_stack(); } Loading
lib/Kconfig.debug +7 −0 Original line number Diff line number Diff line Loading @@ -2038,6 +2038,13 @@ config TEST_STATIC_KEYS 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" Loading
lib/list_debug.c +9 −2 Original line number Diff line number Diff line Loading @@ -11,6 +11,7 @@ #include <linux/bug.h> #include <linux/kernel.h> #include <linux/rculist.h> #include <linux/bug.h> /* * Insert a new entry between two known consecutive entries. Loading @@ -34,6 +35,10 @@ void __list_add(struct list_head *new, WARN(new == prev || new == next, "list_add double add: new=%p, prev=%p, next=%p.\n", new, prev, next); BUG_ON((prev->next != next || next->prev != prev || new == prev || new == next) && PANIC_CORRUPTION); next->prev = new; new->next = next; new->prev = prev; Loading @@ -58,9 +63,11 @@ void __list_del_entry(struct list_head *entry) "list_del corruption. prev->next should be %p, " "but was %p\n", entry, prev->next) || WARN(next->prev != entry, "list_del corruption. next->prev should be %p, " "but was %p\n", entry, next->prev)) "list_del corruption. next->prev should be %p, but was %p\n", entry, next->prev)) { BUG_ON(PANIC_CORRUPTION); return; } __list_del(prev, next); } Loading