History

Merge tag 'kgdb-5.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/danielt/linux

Pull kgdb updates from Daniel Thompson: "Pretty quiet this cycle. Just a couple of small fixes from myself both of which were reviewed by Doug Anderson to keep me honest (thanks)" * tag 'kgdb-5.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/danielt/linux: kdb: Censor attempts to set PROMPT without ENABLE_MEM_READ kdb: Eliminate strncpy() warnings by replacing with strscpy()

Linus Torvalds committed 6 years ago

Commit f2c3bec2 parents a943353 ad99b511 file · +12 −8Browse files

Unified · Split

kernel/debug/kdb/kdb_main.c+12−8
@@ -398,6 +398,13 @@ int kdb_set(int argc, const char **argv) · 397 unmodified lines
398 if (argc != 2)398 if (argc != 2)
399 return KDB_ARGCOUNT;399 return KDB_ARGCOUNT;
400 400
401 /*
402 * Censor sensitive variables
403 */
404 if (strcmp(argv[1], "PROMPT") == 0 &&
405 !kdb_check_flags(KDB_ENABLE_MEM_READ, kdb_cmd_enabled, false))
406 return KDB_NOPERM;
407
401 /*408 /*
402 * Check for internal variables409 * Check for internal variables
403 */410 */
@@ -1102,12 +1109,12 @@ static int handle_ctrl_cmd(char *cmd) · 698 unmodified lines
1102 case CTRL_P:1109 case CTRL_P:
1103 if (cmdptr != cmd_tail)1110 if (cmdptr != cmd_tail)
1104 cmdptr = (cmdptr-1) % KDB_CMD_HISTORY_COUNT;1111 cmdptr = (cmdptr-1) % KDB_CMD_HISTORY_COUNT;
1105 strncpy(cmd_cur, cmd_hist[cmdptr], CMD_BUFLEN);1112 strscpy(cmd_cur, cmd_hist[cmdptr], CMD_BUFLEN);
1106 return 1;1113 return 1;
1107 case CTRL_N:1114 case CTRL_N:
1108 if (cmdptr != cmd_head)1115 if (cmdptr != cmd_head)
1109 cmdptr = (cmdptr+1) % KDB_CMD_HISTORY_COUNT;1116 cmdptr = (cmdptr+1) % KDB_CMD_HISTORY_COUNT;
1110 strncpy(cmd_cur, cmd_hist[cmdptr], CMD_BUFLEN);1117 strscpy(cmd_cur, cmd_hist[cmdptr], CMD_BUFLEN);
1111 return 1;1118 return 1;
1112 }1119 }
1113 return 0;1120 return 0;
@@ -1298,12 +1305,9 @@ static int kdb_local(kdb_reason_t reason, int error, struct pt_regs *regs, · 184 unmodified lines
1298 *(cmd_hist[cmd_head]) = '\0';1305 *(cmd_hist[cmd_head]) = '\0';
1299 1306
1300do_full_getstr:1307do_full_getstr:
1301#if defined(CONFIG_SMP)1308 /* PROMPT can only be set if we have MEM_READ permission. */
1302 snprintf(kdb_prompt_str, CMD_BUFLEN, kdbgetenv("PROMPT"),1309 snprintf(kdb_prompt_str, CMD_BUFLEN, kdbgetenv("PROMPT"),
1303 raw_smp_processor_id());1310 raw_smp_processor_id());
1304#else
1305 snprintf(kdb_prompt_str, CMD_BUFLEN, kdbgetenv("PROMPT"));
1306#endif
1307 if (defcmd_in_progress)1311 if (defcmd_in_progress)
1308 strncat(kdb_prompt_str, "[defcmd]", CMD_BUFLEN);1312 strncat(kdb_prompt_str, "[defcmd]", CMD_BUFLEN);
1309 1313
@@ -1314,7 +1318,7 @@ do_full_getstr: · 4 unmodified lines
1314 if (*cmdbuf != '\n') {1318 if (*cmdbuf != '\n') {
1315 if (*cmdbuf < 32) {1319 if (*cmdbuf < 32) {
1316 if (cmdptr == cmd_head) {1320 if (cmdptr == cmd_head) {
1317 strncpy(cmd_hist[cmd_head], cmd_cur,1321 strscpy(cmd_hist[cmd_head], cmd_cur,
1318 CMD_BUFLEN);1322 CMD_BUFLEN);
1319 *(cmd_hist[cmd_head] +1323 *(cmd_hist[cmd_head] +
1320 strlen(cmd_hist[cmd_head])-1) = '\0';1324 strlen(cmd_hist[cmd_head])-1) = '\0';
@@ -1324,7 +1328,7 @@ do_full_getstr: · 3 unmodified lines
1324 cmdbuf = cmd_cur;1328 cmdbuf = cmd_cur;
1325 goto do_full_getstr;1329 goto do_full_getstr;
1326 } else {1330 } else {
1327 strncpy(cmd_hist[cmd_head], cmd_cur,1331 strscpy(cmd_hist[cmd_head], cmd_cur,
1328 CMD_BUFLEN);1332 CMD_BUFLEN);
1329 }1333 }
1330 1334

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t