diff options
author | Dillon Amburgey <dillona@dillona.com> | 2017-04-08 19:35:35 +0000 |
---|---|---|
committer | Trent Mick <trentm@gmail.com> | 2017-04-08 19:35:35 +0000 |
commit | cdf9fe6a5b774fb8401224e7ba6344fdc43e628f (patch) | |
tree | a2250cd696373241a2db84e008ce49b266da1501 | |
parent | 59d73dcf2d9b389641c1b420dc1dc2db59257220 (diff) | |
download | illumos-joyent-cr1772-OS-XXXX.tar.gz |
OS-XXXX tgkill incorrectly handles init threadscr1772-OS-XXXX
-rw-r--r-- | usr/src/uts/common/brand/lx/syscall/lx_kill.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/usr/src/uts/common/brand/lx/syscall/lx_kill.c b/usr/src/uts/common/brand/lx/syscall/lx_kill.c index 6fefbde705..cb1232cb81 100644 --- a/usr/src/uts/common/brand/lx/syscall/lx_kill.c +++ b/usr/src/uts/common/brand/lx/syscall/lx_kill.c @@ -77,6 +77,7 @@ lx_thrkill(pid_t tgid, pid_t pid, int lx_sig, boolean_t tgkill) proc_t *pp, *cp = curproc; sigqueue_t *sqp; int sig, rv; + pid_t initpid = cp->p_zone->zone_proc_initpid; /* * Unlike kill(2), Linux tkill(2) doesn't allow signals to @@ -94,10 +95,7 @@ lx_thrkill(pid_t tgid, pid_t pid, int lx_sig, boolean_t tgkill) * * Otherwise, extract the tid and real pid from the Linux pid. */ - if (pid == 1) { - pid_t initpid; - - initpid = cp->p_zone->zone_proc_initpid; + if ((pid == 1) || (tgkill && tgid == 1)) { if ((rv = lx_init_sig_check(sig, initpid)) != 0) { return (set_errno(rv)); } @@ -115,8 +113,10 @@ lx_thrkill(pid_t tgid, pid_t pid, int lx_sig, boolean_t tgkill) * Make sure the thread group matches the thread. */ if (tgkill) { + pid_t targetpid = (tgid == 1) ? initpid : tgid; + if ((pid == 1 && tgid != 1) || - (pid != 1 && tgid != pp->p_pid)) { + (pid != 1 && pp->p_pid != targetpid)) { mutex_exit(&pp->p_lock); rv = set_errno(ESRCH); goto free_and_exit; |