ec8f24b7faaf3 (Thomas Gleixner 2019-05-19 13:07:45 +0100 1) # SPDX-License-Identifier: GPL-2.0-only
dc7d552705215 (Jason Wessel 2008-04-17 20:05:37 +0200 2)
e024cbd257efc (Jan Engelhardt 2008-04-25 18:35:29 +0200 3) config HAVE_ARCH_KGDB
e024cbd257efc (Jan Engelhardt 2008-04-25 18:35:29 +0200 4) bool
e024cbd257efc (Jan Engelhardt 2008-04-25 18:35:29 +0200 5)
8c080d3a974ad (Vincent Chen 2020-06-23 13:36:42 +0800 6) # set if architecture has the its kgdb_arch_handle_qxfer_pkt
8c080d3a974ad (Vincent Chen 2020-06-23 13:36:42 +0800 7) # function to enable gdb stub to address XML packet sent from GDB.
8c080d3a974ad (Vincent Chen 2020-06-23 13:36:42 +0800 8) config HAVE_ARCH_KGDB_QXFER_PKT
8c080d3a974ad (Vincent Chen 2020-06-23 13:36:42 +0800 9) bool
8c080d3a974ad (Vincent Chen 2020-06-23 13:36:42 +0800 10)
dc7d552705215 (Jason Wessel 2008-04-17 20:05:37 +0200 11) menuconfig KGDB
dcc7871128e99 (Jason Wessel 2010-05-20 21:04:21 -0500 12) bool "KGDB: kernel debugger"
dc7d552705215 (Jason Wessel 2008-04-17 20:05:37 +0200 13) depends on HAVE_ARCH_KGDB
525c1f9204928 (Kees Cook 2013-01-16 18:54:16 -0800 14) depends on DEBUG_KERNEL
dc7d552705215 (Jason Wessel 2008-04-17 20:05:37 +0200 15) help
dc7d552705215 (Jason Wessel 2008-04-17 20:05:37 +0200 16) If you say Y here, it will be possible to remotely debug the
5f5ddfb3605d2 (Jason Wessel 2008-08-01 08:39:34 -0500 17) kernel using gdb. It is recommended but not required, that
5f5ddfb3605d2 (Jason Wessel 2008-08-01 08:39:34 -0500 18) you also turn on the kernel config option
5f5ddfb3605d2 (Jason Wessel 2008-08-01 08:39:34 -0500 19) CONFIG_FRAME_POINTER to aid in producing more reliable stack
5f5ddfb3605d2 (Jason Wessel 2008-08-01 08:39:34 -0500 20) backtraces in the external debugger. Documentation of
5f5ddfb3605d2 (Jason Wessel 2008-08-01 08:39:34 -0500 21) kernel debugger is available at http://kgdb.sourceforge.net
08c76a2f43297 (Mauro Carvalho Chehab 2017-05-14 12:06:29 -0300 22) as well as in Documentation/dev-tools/kgdb.rst. If
5f5ddfb3605d2 (Jason Wessel 2008-08-01 08:39:34 -0500 23) unsure, say N.
dc7d552705215 (Jason Wessel 2008-04-17 20:05:37 +0200 24)
e024cbd257efc (Jan Engelhardt 2008-04-25 18:35:29 +0200 25) if KGDB
dc7d552705215 (Jason Wessel 2008-04-17 20:05:37 +0200 26)
f2d10ff4a9038 (Daniel Thompson 2020-09-27 22:15:29 +0100 27) config KGDB_HONOUR_BLOCKLIST
f2d10ff4a9038 (Daniel Thompson 2020-09-27 22:15:29 +0100 28) bool "KGDB: use kprobe blocklist to prohibit unsafe breakpoints"
f2d10ff4a9038 (Daniel Thompson 2020-09-27 22:15:29 +0100 29) depends on HAVE_KPROBES
f2d10ff4a9038 (Daniel Thompson 2020-09-27 22:15:29 +0100 30) depends on MODULES
f2d10ff4a9038 (Daniel Thompson 2020-09-27 22:15:29 +0100 31) select KPROBES
f2d10ff4a9038 (Daniel Thompson 2020-09-27 22:15:29 +0100 32) default y
f2d10ff4a9038 (Daniel Thompson 2020-09-27 22:15:29 +0100 33) help
f2d10ff4a9038 (Daniel Thompson 2020-09-27 22:15:29 +0100 34) If set to Y the debug core will use the kprobe blocklist to
f2d10ff4a9038 (Daniel Thompson 2020-09-27 22:15:29 +0100 35) identify symbols where it is unsafe to set breakpoints.
f2d10ff4a9038 (Daniel Thompson 2020-09-27 22:15:29 +0100 36) In particular this disallows instrumentation of functions
f2d10ff4a9038 (Daniel Thompson 2020-09-27 22:15:29 +0100 37) called during debug trap handling and thus makes it very
f2d10ff4a9038 (Daniel Thompson 2020-09-27 22:15:29 +0100 38) difficult to inadvertently provoke recursive trap handling.
f2d10ff4a9038 (Daniel Thompson 2020-09-27 22:15:29 +0100 39)
f2d10ff4a9038 (Daniel Thompson 2020-09-27 22:15:29 +0100 40) If unsure, say Y.
f2d10ff4a9038 (Daniel Thompson 2020-09-27 22:15:29 +0100 41)
dc7d552705215 (Jason Wessel 2008-04-17 20:05:37 +0200 42) config KGDB_SERIAL_CONSOLE
dc7d552705215 (Jason Wessel 2008-04-17 20:05:37 +0200 43) tristate "KGDB: use kgdb over the serial console"
dc7d552705215 (Jason Wessel 2008-04-17 20:05:37 +0200 44) select CONSOLE_POLL
dc7d552705215 (Jason Wessel 2008-04-17 20:05:37 +0200 45) select MAGIC_SYSRQ
c5d2cac0f1caa (Jiri Slaby 2016-05-23 16:26:20 -0700 46) depends on TTY && HW_CONSOLE
dc7d552705215 (Jason Wessel 2008-04-17 20:05:37 +0200 47) default y
dc7d552705215 (Jason Wessel 2008-04-17 20:05:37 +0200 48) help
dc7d552705215 (Jason Wessel 2008-04-17 20:05:37 +0200 49) Share a serial console with kgdb. Sysrq-g must be used
dc7d552705215 (Jason Wessel 2008-04-17 20:05:37 +0200 50) to break in initially.
e8d31c204e36e (Jason Wessel 2008-03-07 16:34:17 -0600 51)
e8d31c204e36e (Jason Wessel 2008-03-07 16:34:17 -0600 52) config KGDB_TESTS
e8d31c204e36e (Jason Wessel 2008-03-07 16:34:17 -0600 53) bool "KGDB: internal test suite"
e8d31c204e36e (Jason Wessel 2008-03-07 16:34:17 -0600 54) default n
e8d31c204e36e (Jason Wessel 2008-03-07 16:34:17 -0600 55) help
e8d31c204e36e (Jason Wessel 2008-03-07 16:34:17 -0600 56) This is a kgdb I/O module specifically designed to test
e8d31c204e36e (Jason Wessel 2008-03-07 16:34:17 -0600 57) kgdb's internal functions. This kgdb I/O module is
e8d31c204e36e (Jason Wessel 2008-03-07 16:34:17 -0600 58) intended to for the development of new kgdb stubs
e8d31c204e36e (Jason Wessel 2008-03-07 16:34:17 -0600 59) as well as regression testing the kgdb internals.
e8d31c204e36e (Jason Wessel 2008-03-07 16:34:17 -0600 60) See the drivers/misc/kgdbts.c for the details about
e8d31c204e36e (Jason Wessel 2008-03-07 16:34:17 -0600 61) the tests. The most basic of this I/O module is to boot
e8d31c204e36e (Jason Wessel 2008-03-07 16:34:17 -0600 62) a kernel boot arguments "kgdbwait kgdbts=V1F100"
974460c5bfd9f (Jason Wessel 2008-03-20 13:43:44 -0500 63)
974460c5bfd9f (Jason Wessel 2008-03-20 13:43:44 -0500 64) config KGDB_TESTS_ON_BOOT
974460c5bfd9f (Jason Wessel 2008-03-20 13:43:44 -0500 65) bool "KGDB: Run tests on boot"
974460c5bfd9f (Jason Wessel 2008-03-20 13:43:44 -0500 66) depends on KGDB_TESTS
974460c5bfd9f (Jason Wessel 2008-03-20 13:43:44 -0500 67) default n
974460c5bfd9f (Jason Wessel 2008-03-20 13:43:44 -0500 68) help
974460c5bfd9f (Jason Wessel 2008-03-20 13:43:44 -0500 69) Run the kgdb tests on boot up automatically without the need
974460c5bfd9f (Jason Wessel 2008-03-20 13:43:44 -0500 70) to pass in a kernel parameter
974460c5bfd9f (Jason Wessel 2008-03-20 13:43:44 -0500 71)
974460c5bfd9f (Jason Wessel 2008-03-20 13:43:44 -0500 72) config KGDB_TESTS_BOOT_STRING
974460c5bfd9f (Jason Wessel 2008-03-20 13:43:44 -0500 73) string "KGDB: which internal kgdb tests to run"
974460c5bfd9f (Jason Wessel 2008-03-20 13:43:44 -0500 74) depends on KGDB_TESTS_ON_BOOT
974460c5bfd9f (Jason Wessel 2008-03-20 13:43:44 -0500 75) default "V1F100"
974460c5bfd9f (Jason Wessel 2008-03-20 13:43:44 -0500 76) help
974460c5bfd9f (Jason Wessel 2008-03-20 13:43:44 -0500 77) This is the command string to send the kgdb test suite on
974460c5bfd9f (Jason Wessel 2008-03-20 13:43:44 -0500 78) boot. See the drivers/misc/kgdbts.c for detailed
974460c5bfd9f (Jason Wessel 2008-03-20 13:43:44 -0500 79) information about other strings you could use beyond the
974460c5bfd9f (Jason Wessel 2008-03-20 13:43:44 -0500 80) default of V1F100.
e024cbd257efc (Jan Engelhardt 2008-04-25 18:35:29 +0200 81)
f503b5ae53cb5 (Jason Wessel 2010-05-20 21:04:25 -0500 82) config KGDB_LOW_LEVEL_TRAP
f503b5ae53cb5 (Jason Wessel 2010-05-20 21:04:25 -0500 83) bool "KGDB: Allow debugging with traps in notifiers"
5dd11d5d47d24 (Jason Wessel 2010-05-20 21:04:26 -0500 84) depends on X86 || MIPS
f503b5ae53cb5 (Jason Wessel 2010-05-20 21:04:25 -0500 85) default n
f503b5ae53cb5 (Jason Wessel 2010-05-20 21:04:25 -0500 86) help
68d4b3dfcaf24 (Krzysztof Kozlowski 2019-12-06 17:04:08 -0800 87) This will add an extra call back to kgdb for the breakpoint
68d4b3dfcaf24 (Krzysztof Kozlowski 2019-12-06 17:04:08 -0800 88) exception handler which will allow kgdb to step through a
68d4b3dfcaf24 (Krzysztof Kozlowski 2019-12-06 17:04:08 -0800 89) notify handler.
f503b5ae53cb5 (Jason Wessel 2010-05-20 21:04:25 -0500 90)
dcc7871128e99 (Jason Wessel 2010-05-20 21:04:21 -0500 91) config KGDB_KDB
dcc7871128e99 (Jason Wessel 2010-05-20 21:04:21 -0500 92) bool "KGDB_KDB: include kdb frontend for kgdb"
dcc7871128e99 (Jason Wessel 2010-05-20 21:04:21 -0500 93) default n
dcc7871128e99 (Jason Wessel 2010-05-20 21:04:21 -0500 94) help
dcc7871128e99 (Jason Wessel 2010-05-20 21:04:21 -0500 95) KDB frontend for kernel
dcc7871128e99 (Jason Wessel 2010-05-20 21:04:21 -0500 96)
b8017177cdfd4 (Daniel Thompson 2014-11-06 14:36:47 +0000 97) config KDB_DEFAULT_ENABLE
b8017177cdfd4 (Daniel Thompson 2014-11-06 14:36:47 +0000 98) hex "KDB: Select kdb command functions to be enabled by default"
b8017177cdfd4 (Daniel Thompson 2014-11-06 14:36:47 +0000 99) depends on KGDB_KDB
b8017177cdfd4 (Daniel Thompson 2014-11-06 14:36:47 +0000 100) default 0x1
b8017177cdfd4 (Daniel Thompson 2014-11-06 14:36:47 +0000 101) help
b8017177cdfd4 (Daniel Thompson 2014-11-06 14:36:47 +0000 102) Specifiers which kdb commands are enabled by default. This may
b8017177cdfd4 (Daniel Thompson 2014-11-06 14:36:47 +0000 103) be set to 1 or 0 to enable all commands or disable almost all
b8017177cdfd4 (Daniel Thompson 2014-11-06 14:36:47 +0000 104) commands.
b8017177cdfd4 (Daniel Thompson 2014-11-06 14:36:47 +0000 105)
b8017177cdfd4 (Daniel Thompson 2014-11-06 14:36:47 +0000 106) Alternatively the following bitmask applies:
b8017177cdfd4 (Daniel Thompson 2014-11-06 14:36:47 +0000 107)
b8017177cdfd4 (Daniel Thompson 2014-11-06 14:36:47 +0000 108) 0x0002 - allow arbitrary reads from memory and symbol lookup
b8017177cdfd4 (Daniel Thompson 2014-11-06 14:36:47 +0000 109) 0x0004 - allow arbitrary writes to memory
b8017177cdfd4 (Daniel Thompson 2014-11-06 14:36:47 +0000 110) 0x0008 - allow current register state to be inspected
b8017177cdfd4 (Daniel Thompson 2014-11-06 14:36:47 +0000 111) 0x0010 - allow current register state to be modified
b8017177cdfd4 (Daniel Thompson 2014-11-06 14:36:47 +0000 112) 0x0020 - allow passive inspection (backtrace, process list, lsmod)
b8017177cdfd4 (Daniel Thompson 2014-11-06 14:36:47 +0000 113) 0x0040 - allow flow control management (breakpoint, single step)
b8017177cdfd4 (Daniel Thompson 2014-11-06 14:36:47 +0000 114) 0x0080 - enable signalling of processes
b8017177cdfd4 (Daniel Thompson 2014-11-06 14:36:47 +0000 115) 0x0100 - allow machine to be rebooted
b8017177cdfd4 (Daniel Thompson 2014-11-06 14:36:47 +0000 116)
b8017177cdfd4 (Daniel Thompson 2014-11-06 14:36:47 +0000 117) The config option merely sets the default at boot time. Both
b8017177cdfd4 (Daniel Thompson 2014-11-06 14:36:47 +0000 118) issuing 'echo X > /sys/module/kdb/parameters/cmd_enable' or
68d4b3dfcaf24 (Krzysztof Kozlowski 2019-12-06 17:04:08 -0800 119) setting with kdb.cmd_enable=X kernel command line option will
b8017177cdfd4 (Daniel Thompson 2014-11-06 14:36:47 +0000 120) override the default settings.
b8017177cdfd4 (Daniel Thompson 2014-11-06 14:36:47 +0000 121)
ada64e4c98eb5 (Jason Wessel 2010-05-20 21:04:24 -0500 122) config KDB_KEYBOARD
ada64e4c98eb5 (Jason Wessel 2010-05-20 21:04:24 -0500 123) bool "KGDB_KDB: keyboard as input device"
ada64e4c98eb5 (Jason Wessel 2010-05-20 21:04:24 -0500 124) depends on VT && KGDB_KDB
ada64e4c98eb5 (Jason Wessel 2010-05-20 21:04:24 -0500 125) default n
ada64e4c98eb5 (Jason Wessel 2010-05-20 21:04:24 -0500 126) help
ada64e4c98eb5 (Jason Wessel 2010-05-20 21:04:24 -0500 127) KDB can use a PS/2 type keyboard for an input device
ada64e4c98eb5 (Jason Wessel 2010-05-20 21:04:24 -0500 128)
3b0eb71ec9e22 (Robert Obermeier 2012-12-16 05:59:36 +0100 129) config KDB_CONTINUE_CATASTROPHIC
3b0eb71ec9e22 (Robert Obermeier 2012-12-16 05:59:36 +0100 130) int "KDB: continue after catastrophic errors"
3b0eb71ec9e22 (Robert Obermeier 2012-12-16 05:59:36 +0100 131) depends on KGDB_KDB
3b0eb71ec9e22 (Robert Obermeier 2012-12-16 05:59:36 +0100 132) default "0"
3b0eb71ec9e22 (Robert Obermeier 2012-12-16 05:59:36 +0100 133) help
3b0eb71ec9e22 (Robert Obermeier 2012-12-16 05:59:36 +0100 134) This integer controls the behaviour of kdb when the kernel gets a
3b0eb71ec9e22 (Robert Obermeier 2012-12-16 05:59:36 +0100 135) catastrophic error, i.e. for a panic or oops.
3b0eb71ec9e22 (Robert Obermeier 2012-12-16 05:59:36 +0100 136) When KDB is active and a catastrophic error occurs, nothing extra
3b0eb71ec9e22 (Robert Obermeier 2012-12-16 05:59:36 +0100 137) will happen until you type 'go'.
3b0eb71ec9e22 (Robert Obermeier 2012-12-16 05:59:36 +0100 138) CONFIG_KDB_CONTINUE_CATASTROPHIC == 0 (default). The first time
3b0eb71ec9e22 (Robert Obermeier 2012-12-16 05:59:36 +0100 139) you type 'go', you will be warned by kdb. The secend time you type
3b0eb71ec9e22 (Robert Obermeier 2012-12-16 05:59:36 +0100 140) 'go', KDB tries to continue. No guarantees that the
3b0eb71ec9e22 (Robert Obermeier 2012-12-16 05:59:36 +0100 141) kernel is still usable in this situation.
3b0eb71ec9e22 (Robert Obermeier 2012-12-16 05:59:36 +0100 142) CONFIG_KDB_CONTINUE_CATASTROPHIC == 1. KDB tries to continue.
3b0eb71ec9e22 (Robert Obermeier 2012-12-16 05:59:36 +0100 143) No guarantees that the kernel is still usable in this situation.
3b0eb71ec9e22 (Robert Obermeier 2012-12-16 05:59:36 +0100 144) CONFIG_KDB_CONTINUE_CATASTROPHIC == 2. KDB forces a reboot.
3b0eb71ec9e22 (Robert Obermeier 2012-12-16 05:59:36 +0100 145) If you are not sure, say 0.
3b0eb71ec9e22 (Robert Obermeier 2012-12-16 05:59:36 +0100 146)
b1a57bbfcc17c (Douglas Anderson 2020-05-07 13:08:42 -0700 147) config ARCH_HAS_EARLY_DEBUG
b1a57bbfcc17c (Douglas Anderson 2020-05-07 13:08:42 -0700 148) bool
b1a57bbfcc17c (Douglas Anderson 2020-05-07 13:08:42 -0700 149) default n
b1a57bbfcc17c (Douglas Anderson 2020-05-07 13:08:42 -0700 150) help
b1a57bbfcc17c (Douglas Anderson 2020-05-07 13:08:42 -0700 151) If an architecture can definitely handle entering the debugger
b1a57bbfcc17c (Douglas Anderson 2020-05-07 13:08:42 -0700 152) when early_param's are parsed then it select this config.
b1a57bbfcc17c (Douglas Anderson 2020-05-07 13:08:42 -0700 153) Otherwise, if "kgdbwait" is passed on the kernel command line it
b1a57bbfcc17c (Douglas Anderson 2020-05-07 13:08:42 -0700 154) won't actually be processed until dbg_late_init() just after the
b1a57bbfcc17c (Douglas Anderson 2020-05-07 13:08:42 -0700 155) call to kgdb_arch_late() is made.
b1a57bbfcc17c (Douglas Anderson 2020-05-07 13:08:42 -0700 156)
b1a57bbfcc17c (Douglas Anderson 2020-05-07 13:08:42 -0700 157) NOTE: Even if this isn't selected by an architecture we will
b1a57bbfcc17c (Douglas Anderson 2020-05-07 13:08:42 -0700 158) still try to register kgdb to handle breakpoints and crashes
b1a57bbfcc17c (Douglas Anderson 2020-05-07 13:08:42 -0700 159) when early_param's are parsed, we just won't act on the
b1a57bbfcc17c (Douglas Anderson 2020-05-07 13:08:42 -0700 160) "kgdbwait" parameter until dbg_late_init(). If you get a
b1a57bbfcc17c (Douglas Anderson 2020-05-07 13:08:42 -0700 161) crash and try to drop into kgdb somewhere between these two
b1a57bbfcc17c (Douglas Anderson 2020-05-07 13:08:42 -0700 162) places you might or might not end up being able to use kgdb
b1a57bbfcc17c (Douglas Anderson 2020-05-07 13:08:42 -0700 163) depending on exactly how far along the architecture has initted.
b1a57bbfcc17c (Douglas Anderson 2020-05-07 13:08:42 -0700 164)
e024cbd257efc (Jan Engelhardt 2008-04-25 18:35:29 +0200 165) endif # KGDB