summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Guenthe <guenther@cvs.openbsd.org>2009-12-20 23:54:12 +0000
committerPhilip Guenthe <guenther@cvs.openbsd.org>2009-12-20 23:54:12 +0000
commit948ff7044a850b1d3deb5bedbecc67194e87aadd (patch)
tree58d4d7bbfce63847b25db4fee3d4366053370175
parentb639a14b54ccb828019bc19ae8dfc3256fad6c98 (diff)
When using ptrace(), death of the traced process should always send
SIGCHLD to the tracer, even if the real parent requested an alternate exit signal. So, delay clearing the P_TRACED flag from exit1() to sys_wait4() so that we don't send the wrong signal from reaper(). Originally discussed with kurt months ago "looks good" deraadt@
-rw-r--r--sys/kern/kern_exit.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c
index 8ec49a5f516..6ce6154908f 100644
--- a/sys/kern/kern_exit.c
+++ b/sys/kern/kern_exit.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_exit.c,v 1.88 2009/12/20 23:36:04 guenther Exp $ */
+/* $OpenBSD: kern_exit.c,v 1.89 2009/12/20 23:54:11 guenther Exp $ */
/* $NetBSD: kern_exit.c,v 1.39 1996/04/22 01:38:25 christos Exp $ */
/*
@@ -169,7 +169,6 @@ exit1(struct proc *p, int rv, int flags)
* wake up the parent early to avoid deadlock.
*/
atomic_setbits_int(&p->p_flag, P_WEXIT);
- atomic_clearbits_int(&p->p_flag, P_TRACED);
if (p->p_flag & P_PPWAIT) {
atomic_clearbits_int(&p->p_flag, P_PPWAIT);
wakeup(p->p_pptr);
@@ -521,6 +520,7 @@ proc_finish_wait(struct proc *waiter, struct proc *p)
* we need to give it back to the old parent.
*/
if (p->p_oppid && (t = pfind(p->p_oppid))) {
+ atomic_clearbits_int(&p->p_flag, P_TRACED);
p->p_oppid = 0;
proc_reparent(p, t);
if (p->p_exitsig != 0)