aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/debug
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2017-08-17 16:45:38 -0400
committerEric W. Biederman <ebiederm@xmission.com>2018-01-03 19:01:08 -0500
commit0b44bf9a6f5cde099ae21b4aa94553484203769a (patch)
tree4563f1383ab50d592b8c09ec451121d5fccfdd09 /kernel/debug
parent30a7acd573899fd8b8ac39236eff6468b195ac7d (diff)
signal: Simplify and fix kdb_send_sig
- Rename from kdb_send_sig_info to kdb_send_sig As there is no meaningful siginfo sent - Use SEND_SIG_PRIV instead of generating a siginfo for a kdb signal. The generated siginfo had a bogus rationale and was not correct in the face of pid namespaces. SEND_SIG_PRIV is simpler and actually correct. - As the code grabs siglock just send the signal with siglock held instead of dropping siglock and attempting to grab it again. - Move the sig_valid test into kdb_kill where it can generate a good error message. Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Diffstat (limited to 'kernel/debug')
-rw-r--r--kernel/debug/kdb/kdb_main.c10
-rw-r--r--kernel/debug/kdb/kdb_private.h2
2 files changed, 3 insertions, 9 deletions
diff --git a/kernel/debug/kdb/kdb_main.c b/kernel/debug/kdb/kdb_main.c
index c8146d53ca67..dbb0781a0533 100644
--- a/kernel/debug/kdb/kdb_main.c
+++ b/kernel/debug/kdb/kdb_main.c
@@ -2441,7 +2441,6 @@ static int kdb_kill(int argc, const char **argv)
2441 long sig, pid; 2441 long sig, pid;
2442 char *endp; 2442 char *endp;
2443 struct task_struct *p; 2443 struct task_struct *p;
2444 struct siginfo info;
2445 2444
2446 if (argc != 2) 2445 if (argc != 2)
2447 return KDB_ARGCOUNT; 2446 return KDB_ARGCOUNT;
@@ -2449,7 +2448,7 @@ static int kdb_kill(int argc, const char **argv)
2449 sig = simple_strtol(argv[1], &endp, 0); 2448 sig = simple_strtol(argv[1], &endp, 0);
2450 if (*endp) 2449 if (*endp)
2451 return KDB_BADINT; 2450 return KDB_BADINT;
2452 if (sig >= 0) { 2451 if ((sig >= 0) || !valid_signal(-sig)) {
2453 kdb_printf("Invalid signal parameter.<-signal>\n"); 2452 kdb_printf("Invalid signal parameter.<-signal>\n");
2454 return 0; 2453 return 0;
2455 } 2454 }
@@ -2470,12 +2469,7 @@ static int kdb_kill(int argc, const char **argv)
2470 return 0; 2469 return 0;
2471 } 2470 }
2472 p = p->group_leader; 2471 p = p->group_leader;
2473 info.si_signo = sig; 2472 kdb_send_sig(p, sig);
2474 info.si_errno = 0;
2475 info.si_code = SI_USER;
2476 info.si_pid = pid; /* same capabilities as process being signalled */
2477 info.si_uid = 0; /* kdb has root authority */
2478 kdb_send_sig_info(p, &info);
2479 return 0; 2473 return 0;
2480} 2474}
2481 2475
diff --git a/kernel/debug/kdb/kdb_private.h b/kernel/debug/kdb/kdb_private.h
index fc224fbcf954..1e5a502ba4a7 100644
--- a/kernel/debug/kdb/kdb_private.h
+++ b/kernel/debug/kdb/kdb_private.h
@@ -208,7 +208,7 @@ extern unsigned long kdb_task_state(const struct task_struct *p,
208extern void kdb_ps_suppressed(void); 208extern void kdb_ps_suppressed(void);
209extern void kdb_ps1(const struct task_struct *p); 209extern void kdb_ps1(const struct task_struct *p);
210extern void kdb_print_nameval(const char *name, unsigned long val); 210extern void kdb_print_nameval(const char *name, unsigned long val);
211extern void kdb_send_sig_info(struct task_struct *p, struct siginfo *info); 211extern void kdb_send_sig(struct task_struct *p, int sig);
212extern void kdb_meminfo_proc_show(void); 212extern void kdb_meminfo_proc_show(void);
213extern char *kdb_getstr(char *, size_t, const char *); 213extern char *kdb_getstr(char *, size_t, const char *);
214extern void kdb_gdb_state_pass(char *buf); 214extern void kdb_gdb_state_pass(char *buf);