kgdb: Honour the kprobe blocklist when setting breakpoints
Currently kgdb has absolutely no safety rails in place to discourage or prevent a user from placing a breakpoint in dangerous places such as the debugger's own trap entry/exit and other places where it is not safe to take synchronous traps. Introduce a new config symbol KGDB_HONOUR_BLOCKLIST and modify the default implementation of kgdb_validate_break_address() so that we use the kprobe blocklist to prohibit instrumentation of critical functions if the config symbol is set. The config symbol dependencies are set to ensure that the blocklist will be enabled by default if we enable KGDB and are compiling for an architecture where we HAVE_KPROBES. Suggested-by: Peter Zijlstra <peterz@infradead.org> Reviewed-by: Douglas Anderson <dianders@chromium.org> Reviewed-by: Masami Hiramatsu <mhiramat@kernel.org> Link: https://lore.kernel.org/r/20200927211531.1380577-2-daniel.thompson@linaro.org Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org>
This commit is contained in:
@@ -24,6 +24,21 @@ menuconfig KGDB
|
||||
|
||||
if KGDB
|
||||
|
||||
config KGDB_HONOUR_BLOCKLIST
|
||||
bool "KGDB: use kprobe blocklist to prohibit unsafe breakpoints"
|
||||
depends on HAVE_KPROBES
|
||||
depends on MODULES
|
||||
select KPROBES
|
||||
default y
|
||||
help
|
||||
If set to Y the debug core will use the kprobe blocklist to
|
||||
identify symbols where it is unsafe to set breakpoints.
|
||||
In particular this disallows instrumentation of functions
|
||||
called during debug trap handling and thus makes it very
|
||||
difficult to inadvertently provoke recursive trap handling.
|
||||
|
||||
If unsure, say Y.
|
||||
|
||||
config KGDB_SERIAL_CONSOLE
|
||||
tristate "KGDB: use kgdb over the serial console"
|
||||
select CONSOLE_POLL
|
||||
|
Reference in New Issue
Block a user