History

kprobes: Prohibit probing on BUG() and WARN() address

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.

Masami Hiramatsu committed 7 years ago

Commit e336b401 parent d9f3b452 files · +7 −1Browse files

Showing the changes to include/linux (1 of 2 files). Show all

Unified · Split

include/linux/bug.h+5−0
@@ -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
50static inline void *find_bug(unsigned long bugaddr)
51{
52 return NULL;
53}
54
50static inline enum bug_trap_type report_bug(unsigned long bug_addr,55static inline enum bug_trap_type report_bug(unsigned long bug_addr,
51 struct pt_regs *regs)56 struct pt_regs *regs)
52{57{

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t