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
Showing the changes to include/linux (1 of 8 files). Show all
Unified · Split
| @@ -13,11 +13,54 @@ · 12 unmodified lines | ||
| 13 | 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 | 23 | typedef enum { |
| 17 | − KDB_REPEAT_NONE = 0, /* Do not repeat this command */ | |
| 18 | − KDB_REPEAT_NO_ARGS, /* Repeat the command without arguments */ | |
| 19 | − KDB_REPEAT_WITH_ARGS, /* Repeat the command including its arguments */ | |
| 20 | −} kdb_repeat_t; | |
| 24 | + KDB_ENABLE_ALL = (1 << 0), /* Enable everything */ | |
| 25 | + KDB_ENABLE_MEM_READ = (1 << 1), | |
| 26 | + KDB_ENABLE_MEM_WRITE = (1 << 2), | |
| 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 | 65 | typedef int (*kdb_func_t)(int, const char **); |
| 23 | 66 | |
| @@ -62,6 +105,7 @@ extern atomic_t kdb_event; · 38 unmodified lines | ||
| 62 | 105 | #define KDB_BADLENGTH (-19) |
| 63 | 106 | #define KDB_NOBP (-20) |
| 64 | 107 | #define KDB_BADADDR (-21) |
| 108 | +#define KDB_NOPERM (-22) | |
| 65 | 109 | |
| 66 | 110 | /* |
| 67 | 111 | * kdb_diemsg |
| @@ -146,17 +190,17 @@ static inline const char *kdb_walk_kallsyms(loff_t *pos) · 78 unmodified lines | ||
| 146 | 190 | |
| 147 | 191 | /* Dynamic kdb shell command registration */ |
| 148 | 192 | extern int kdb_register(char *, kdb_func_t, char *, char *, short); |
| 149 | −extern int kdb_register_repeat(char *, kdb_func_t, char *, char *, | |
| 150 | − short, kdb_repeat_t); | |
| 193 | +extern int kdb_register_flags(char *, kdb_func_t, char *, char *, | |
| 194 | + short, kdb_cmdflags_t); | |
| 151 | 195 | extern int kdb_unregister(char *); |
| 152 | 196 | #else /* ! CONFIG_KGDB_KDB */ |
| 153 | 197 | static inline __printf(1, 2) int kdb_printf(const char *fmt, ...) { return 0; } |
| 154 | 198 | static inline void kdb_init(int level) {} |
| 155 | 199 | static inline int kdb_register(char *cmd, kdb_func_t func, char *usage, |
| 156 | 200 | char *help, short minlen) { return 0; } |
| 157 | −static inline int kdb_register_repeat(char *cmd, kdb_func_t func, char *usage, | |
| 158 | − char *help, short minlen, | |
| 159 | − kdb_repeat_t repeat) { return 0; } | |
| 201 | +static inline int kdb_register_flags(char *cmd, kdb_func_t func, char *usage, | |
| 202 | + char *help, short minlen, | |
| 203 | + kdb_cmdflags_t flags) { return 0; } | |
| 160 | 204 | static inline int kdb_unregister(char *cmd) { return 0; } |
| 161 | 205 | #endif /* CONFIG_KGDB_KDB */ |
| 162 | 206 | enum { |