Skip to content

Commit

Permalink
kdb: Add message about CONFIG_DEBUG_RODATA on failure to install brea…
Browse files Browse the repository at this point in the history
…kpoint

On x86, if CONFIG_DEBUG_RODATA is set, one cannot set breakpoints
via KDB.  Apparently this is a well-known problem, as at least one distribution
now ships with both KDB enabled and CONFIG_DEBUG_RODATA=y for security reasons.

This patch adds an printk message to the breakpoint failure case,
in order to provide suggestions about how to use the debugger.

Reported-by: Tim Bird <[email protected]>
Signed-off-by: Jason Wessel <[email protected]>
Acked-by: Tim Bird <[email protected]>
  • Loading branch information
jwessel committed Mar 22, 2012
1 parent b8adde8 commit 1ba0c17
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions kernel/debug/kdb/kdb_bp.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,13 @@ static int _kdb_bp_install(struct pt_regs *regs, kdb_bp_t *bp)
} else {
kdb_printf("%s: failed to set breakpoint at 0x%lx\n",
__func__, bp->bp_addr);
#ifdef CONFIG_DEBUG_RODATA
if (!bp->bp_type) {
kdb_printf("Software breakpoints are unavailable.\n"
" Change the kernel CONFIG_DEBUG_RODATA=n\n"
" OR use hw breaks: help bph\n");
}
#endif
return 1;
}
return 0;
Expand Down

0 comments on commit 1ba0c17

Please sign in to comment.