Since BUG() and WARN() may use a trap (e.g. UD2 on x86) to get the address where the BUG() has occurred, kprobes can not do single-step out-of-line that instruction. So prohibit probing on such address. Without this fix, if someone put a kprobe on WARN(), the kernel will crash with invalid opcode error instead of outputing warning message, because kernel can not find correct bug address.
Showing the changes to include/linux (1 of 2 files). Show all
Unified · Split
| @@ -47,6 +47,11 @@ void generic_bug_clear_once(void); · 46 unmodified lines | |||
| 47 | 47 | ||
| 48 | #else /* !CONFIG_GENERIC_BUG */ | 48 | #else /* !CONFIG_GENERIC_BUG */ |
| 49 | 49 | ||
| 50 | static inline void *find_bug(unsigned long bugaddr) | ||
| 51 | { | ||
| 52 | return NULL; | ||
| 53 | } | ||
| 54 | |||
| 50 | static inline enum bug_trap_type report_bug(unsigned long bug_addr, | 55 | static inline enum bug_trap_type report_bug(unsigned long bug_addr, |
| 51 | struct pt_regs *regs) | 56 | struct pt_regs *regs) |
| 52 | { | 57 | { |