Skip to content

Commit 6d8c162

Browse files
committed
kdb: Allow access to sensitive commands to be restricted by default
jira VULN-1501 cve-pre CVE-2022-21499 commit-author Daniel Thompson <daniel.thompson@linaro.org> commit b801717 Currently kiosk mode must be explicitly requested by the bootloader or userspace. It is convenient to be able to change the default value in a similar manner to CONFIG_MAGIC_SYSRQ_DEFAULT_MASK. Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org> Cc: Jason Wessel <jason.wessel@windriver.com> Signed-off-by: Jason Wessel <jason.wessel@windriver.com> (cherry picked from commit b801717) Signed-off-by: Jonathan Maple <jmaple@ciq.com>
1 parent cde04a3 commit 6d8c162

2 files changed

Lines changed: 26 additions & 1 deletion

File tree

kernel/debug/kdb/kdb_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
#undef MODULE_PARAM_PREFIX
4848
#define MODULE_PARAM_PREFIX "kdb."
4949

50-
static int kdb_cmd_enabled;
50+
static int kdb_cmd_enabled = CONFIG_KDB_DEFAULT_ENABLE;
5151
module_param_named(cmd_enable, kdb_cmd_enabled, int, 0600);
5252

5353
#define GREP_LEN 256

lib/Kconfig.kgdb

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,31 @@ config KGDB_KDB
7373
help
7474
KDB frontend for kernel
7575

76+
config KDB_DEFAULT_ENABLE
77+
hex "KDB: Select kdb command functions to be enabled by default"
78+
depends on KGDB_KDB
79+
default 0x1
80+
help
81+
Specifiers which kdb commands are enabled by default. This may
82+
be set to 1 or 0 to enable all commands or disable almost all
83+
commands.
84+
85+
Alternatively the following bitmask applies:
86+
87+
0x0002 - allow arbitrary reads from memory and symbol lookup
88+
0x0004 - allow arbitrary writes to memory
89+
0x0008 - allow current register state to be inspected
90+
0x0010 - allow current register state to be modified
91+
0x0020 - allow passive inspection (backtrace, process list, lsmod)
92+
0x0040 - allow flow control management (breakpoint, single step)
93+
0x0080 - enable signalling of processes
94+
0x0100 - allow machine to be rebooted
95+
96+
The config option merely sets the default at boot time. Both
97+
issuing 'echo X > /sys/module/kdb/parameters/cmd_enable' or
98+
setting with kdb.cmd_enable=X kernel command line option will
99+
override the default settings.
100+
76101
config KDB_KEYBOARD
77102
bool "KGDB_KDB: keyboard as input device"
78103
depends on VT && KGDB_KDB

0 commit comments

Comments
 (0)