diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2015-01-09 23:51:10 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-01-09 23:51:10 -0500 |
commit | aa9291355e19f804570466756ed7d874cd2e99ff (patch) | |
tree | d10deae14e4c2522a207b0fe3c3b57e32f87afa2 /include | |
parent | dc9319f5a3e1f67d2a2fbf190e30f6d03f569fed (diff) | |
parent | 0f16996cf2ed7c368dd95b4c517ce572b96a10f5 (diff) |
Merge tag 'for_linus-3.19-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/jwessel/kgdb
Pull kgdb/kdb fixes from Jason Wessel:
"These have been around since 3.17 and in kgdb-next for the last 9
weeks and some will go back to -stable.
Summary of changes:
Cleanups
- kdb: Remove unused command flags, repeat flags and KDB_REPEAT_NONE
Fixes
- kgdb/kdb: Allow access on a single core, if a CPU round up is
deemed impossible, which will allow inspection of the now "trashed"
kernel
- kdb: Add enable mask for the command groups
- kdb: access controls to restrict sensitive commands"
* tag 'for_linus-3.19-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/jwessel/kgdb:
kernel/debug/debug_core.c: Logging clean-up
kgdb: timeout if secondary CPUs ignore the roundup
kdb: Allow access to sensitive commands to be restricted by default
kdb: Add enable mask for groups of commands
kdb: Categorize kdb commands (similar to SysRq categorization)
kdb: Remove KDB_REPEAT_NONE flag
kdb: Use KDB_REPEAT_* values as flags
kdb: Rename kdb_register_repeat() to kdb_register_flags()
kdb: Rename kdb_repeat_t to kdb_cmdflags_t, cmd_repeat to cmd_flags
kdb: Remove currently unused kdbtab_t->cmd_flags
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/kdb.h | 62 |
1 files changed, 53 insertions, 9 deletions
diff --git a/include/linux/kdb.h b/include/linux/kdb.h index 290db1269c4c..75ae2e2631fc 100644 --- a/include/linux/kdb.h +++ b/include/linux/kdb.h | |||
@@ -13,11 +13,54 @@ | |||
13 | * Copyright (C) 2009 Jason Wessel <jason.wessel@windriver.com> | 13 | * Copyright (C) 2009 Jason Wessel <jason.wessel@windriver.com> |
14 | */ | 14 | */ |
15 | 15 | ||
16 | /* Shifted versions of the command enable bits are be used if the command | ||
17 | * has no arguments (see kdb_check_flags). This allows commands, such as | ||
18 | * go, to have different permissions depending upon whether it is called | ||
19 | * with an argument. | ||
20 | */ | ||
21 | #define KDB_ENABLE_NO_ARGS_SHIFT 10 | ||
22 | |||
16 | typedef enum { | 23 | typedef enum { |
17 | KDB_REPEAT_NONE = 0, /* Do not repeat this command */ | 24 | KDB_ENABLE_ALL = (1 << 0), /* Enable everything */ |
18 | KDB_REPEAT_NO_ARGS, /* Repeat the command without arguments */ | 25 | KDB_ENABLE_MEM_READ = (1 << 1), |
19 | KDB_REPEAT_WITH_ARGS, /* Repeat the command including its arguments */ | 26 | KDB_ENABLE_MEM_WRITE = (1 << 2), |
20 | } kdb_repeat_t; | 27 | KDB_ENABLE_REG_READ = (1 << 3), |
28 | KDB_ENABLE_REG_WRITE = (1 << 4), | ||
29 | KDB_ENABLE_INSPECT = (1 << 5), | ||
30 | KDB_ENABLE_FLOW_CTRL = (1 << 6), | ||
31 | KDB_ENABLE_SIGNAL = (1 << 7), | ||
32 | KDB_ENABLE_REBOOT = (1 << 8), | ||
33 | /* User exposed values stop here, all remaining flags are | ||
34 | * exclusively used to describe a commands behaviour. | ||
35 | */ | ||
36 | |||
37 | KDB_ENABLE_ALWAYS_SAFE = (1 << 9), | ||
38 | KDB_ENABLE_MASK = (1 << KDB_ENABLE_NO_ARGS_SHIFT) - 1, | ||
39 | |||
40 | KDB_ENABLE_ALL_NO_ARGS = KDB_ENABLE_ALL << KDB_ENABLE_NO_ARGS_SHIFT, | ||
41 | KDB_ENABLE_MEM_READ_NO_ARGS = KDB_ENABLE_MEM_READ | ||
42 | << KDB_ENABLE_NO_ARGS_SHIFT, | ||
43 | KDB_ENABLE_MEM_WRITE_NO_ARGS = KDB_ENABLE_MEM_WRITE | ||
44 | << KDB_ENABLE_NO_ARGS_SHIFT, | ||
45 | KDB_ENABLE_REG_READ_NO_ARGS = KDB_ENABLE_REG_READ | ||
46 | << KDB_ENABLE_NO_ARGS_SHIFT, | ||
47 | KDB_ENABLE_REG_WRITE_NO_ARGS = KDB_ENABLE_REG_WRITE | ||
48 | << KDB_ENABLE_NO_ARGS_SHIFT, | ||
49 | KDB_ENABLE_INSPECT_NO_ARGS = KDB_ENABLE_INSPECT | ||
50 | << KDB_ENABLE_NO_ARGS_SHIFT, | ||
51 | KDB_ENABLE_FLOW_CTRL_NO_ARGS = KDB_ENABLE_FLOW_CTRL | ||
52 | << KDB_ENABLE_NO_ARGS_SHIFT, | ||
53 | KDB_ENABLE_SIGNAL_NO_ARGS = KDB_ENABLE_SIGNAL | ||
54 | << KDB_ENABLE_NO_ARGS_SHIFT, | ||
55 | KDB_ENABLE_REBOOT_NO_ARGS = KDB_ENABLE_REBOOT | ||
56 | << KDB_ENABLE_NO_ARGS_SHIFT, | ||
57 | KDB_ENABLE_ALWAYS_SAFE_NO_ARGS = KDB_ENABLE_ALWAYS_SAFE | ||
58 | << KDB_ENABLE_NO_ARGS_SHIFT, | ||
59 | KDB_ENABLE_MASK_NO_ARGS = KDB_ENABLE_MASK << KDB_ENABLE_NO_ARGS_SHIFT, | ||
60 | |||
61 | KDB_REPEAT_NO_ARGS = 0x40000000, /* Repeat the command w/o arguments */ | ||
62 | KDB_REPEAT_WITH_ARGS = 0x80000000, /* Repeat the command with args */ | ||
63 | } kdb_cmdflags_t; | ||
21 | 64 | ||
22 | typedef int (*kdb_func_t)(int, const char **); | 65 | typedef int (*kdb_func_t)(int, const char **); |
23 | 66 | ||
@@ -62,6 +105,7 @@ extern atomic_t kdb_event; | |||
62 | #define KDB_BADLENGTH (-19) | 105 | #define KDB_BADLENGTH (-19) |
63 | #define KDB_NOBP (-20) | 106 | #define KDB_NOBP (-20) |
64 | #define KDB_BADADDR (-21) | 107 | #define KDB_BADADDR (-21) |
108 | #define KDB_NOPERM (-22) | ||
65 | 109 | ||
66 | /* | 110 | /* |
67 | * kdb_diemsg | 111 | * kdb_diemsg |
@@ -146,17 +190,17 @@ static inline const char *kdb_walk_kallsyms(loff_t *pos) | |||
146 | 190 | ||
147 | /* Dynamic kdb shell command registration */ | 191 | /* Dynamic kdb shell command registration */ |
148 | extern int kdb_register(char *, kdb_func_t, char *, char *, short); | 192 | extern int kdb_register(char *, kdb_func_t, char *, char *, short); |
149 | extern int kdb_register_repeat(char *, kdb_func_t, char *, char *, | 193 | extern int kdb_register_flags(char *, kdb_func_t, char *, char *, |
150 | short, kdb_repeat_t); | 194 | short, kdb_cmdflags_t); |
151 | extern int kdb_unregister(char *); | 195 | extern int kdb_unregister(char *); |
152 | #else /* ! CONFIG_KGDB_KDB */ | 196 | #else /* ! CONFIG_KGDB_KDB */ |
153 | static inline __printf(1, 2) int kdb_printf(const char *fmt, ...) { return 0; } | 197 | static inline __printf(1, 2) int kdb_printf(const char *fmt, ...) { return 0; } |
154 | static inline void kdb_init(int level) {} | 198 | static inline void kdb_init(int level) {} |
155 | static inline int kdb_register(char *cmd, kdb_func_t func, char *usage, | 199 | static inline int kdb_register(char *cmd, kdb_func_t func, char *usage, |
156 | char *help, short minlen) { return 0; } | 200 | char *help, short minlen) { return 0; } |
157 | static inline int kdb_register_repeat(char *cmd, kdb_func_t func, char *usage, | 201 | static inline int kdb_register_flags(char *cmd, kdb_func_t func, char *usage, |
158 | char *help, short minlen, | 202 | char *help, short minlen, |
159 | kdb_repeat_t repeat) { return 0; } | 203 | kdb_cmdflags_t flags) { return 0; } |
160 | static inline int kdb_unregister(char *cmd) { return 0; } | 204 | static inline int kdb_unregister(char *cmd) { return 0; } |
161 | #endif /* CONFIG_KGDB_KDB */ | 205 | #endif /* CONFIG_KGDB_KDB */ |
162 | enum { | 206 | enum { |