summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
authorJerry Jelinek <jerry.jelinek@joyent.com>2014-04-16 13:33:51 +0000
committerJerry Jelinek <jerry.jelinek@joyent.com>2014-04-16 13:33:51 +0000
commit7f68f16eb07191b1da6e54c9febb4ab6a730e5ed (patch)
tree43e356abcfbb36a42af5c9c57f915fad9157efb2 /usr/src
parentaafdecc436d9551cb6a139cb6c14de8677567399 (diff)
downloadillumos-joyent-7f68f16eb07191b1da6e54c9febb4ab6a730e5ed.tar.gz
OS-2917 lxbrand ptrace option stop never generates SIGCHLD
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/uts/common/brand/lx/os/lx_brand.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/usr/src/uts/common/brand/lx/os/lx_brand.c b/usr/src/uts/common/brand/lx/os/lx_brand.c
index b1a28abb1d..c7b4ccb208 100644
--- a/usr/src/uts/common/brand/lx/os/lx_brand.c
+++ b/usr/src/uts/common/brand/lx/os/lx_brand.c
@@ -391,12 +391,12 @@ static void
lx_ptrace_stop_for_option(int option)
{
proc_t *p = ttoproc(curthread);
+ proc_t *pp = p->p_parent;
+ sigqueue_t *sqp;
lx_proc_data_t *lpdp;
- psignal(p, SIGTRAP);
-
if ((lpdp = p->p_brand_data) == NULL) {
- /* this should never happen but just let the process stop */
+ /* this should never happen but just to be safe */
return;
}
@@ -425,6 +425,19 @@ lx_ptrace_stop_for_option(int option)
break;
}
+ /* Post the required signal to ourselves so that we stop. */
+ psignal(p, SIGTRAP);
+
+ /*
+ * Since we're stopping, we need to post the SIGCHLD to the parent.
+ * The code in sigcld expects the following two process values to be
+ * setup specifically before it can send the signal, so do that here.
+ */
+ sqp = kmem_zalloc(sizeof (sigqueue_t), KM_SLEEP);
+ p->p_wdata = SIGTRAP;
+ p->p_wcode = CLD_STOPPED;
+ sigcld(p, sqp);
+
/*
* If (p_proc_flag & P_PR_PTRACE) were set, then in stop() we would set:
* p->p_wcode = CLD_TRAPPED
@@ -438,7 +451,6 @@ lx_ptrace_stop_for_option(int option)
* do the right thing for this process. We still rely on stop() to do
* all of the other processing needed for our signal.
*/
- p->p_wdata = SIGTRAP;
p->p_wcode = CLD_TRAPPED;
}