Commit bf20753c0cdf842c5c65af688c2cefd1eafa7630
Exists in
master
and in
7 other branches
Merge branch 'core-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel…
…/git/tip/linux-2.6-tip * 'core-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: lockdep: continue lock debugging despite some taints lockdep: warn about lockdep disabling after kernel taint
Showing 3 changed files Side-by-side Diff
include/linux/debug_locks.h
... | ... | @@ -2,11 +2,18 @@ |
2 | 2 | #define __LINUX_DEBUG_LOCKING_H |
3 | 3 | |
4 | 4 | #include <linux/kernel.h> |
5 | +#include <asm/atomic.h> | |
5 | 6 | |
6 | 7 | struct task_struct; |
7 | 8 | |
8 | 9 | extern int debug_locks; |
9 | 10 | extern int debug_locks_silent; |
11 | + | |
12 | + | |
13 | +static inline int __debug_locks_off(void) | |
14 | +{ | |
15 | + return xchg(&debug_locks, 0); | |
16 | +} | |
10 | 17 | |
11 | 18 | /* |
12 | 19 | * Generic 'turn off all lock debugging' function: |
kernel/panic.c
... | ... | @@ -213,8 +213,16 @@ |
213 | 213 | |
214 | 214 | void add_taint(unsigned flag) |
215 | 215 | { |
216 | - /* can't trust the integrity of the kernel anymore: */ | |
217 | - debug_locks = 0; | |
216 | + /* | |
217 | + * Can't trust the integrity of the kernel anymore. | |
218 | + * We don't call directly debug_locks_off() because the issue | |
219 | + * is not necessarily serious enough to set oops_in_progress to 1 | |
220 | + * Also we want to keep up lockdep for staging development and | |
221 | + * post-warning case. | |
222 | + */ | |
223 | + if (flag != TAINT_CRAP && flag != TAINT_WARN && __debug_locks_off()) | |
224 | + printk(KERN_WARNING "Disabling lockdep due to kernel taint\n"); | |
225 | + | |
218 | 226 | set_bit(flag, &tainted_mask); |
219 | 227 | } |
220 | 228 | EXPORT_SYMBOL(add_taint); |