summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordavidxu <davidxu@FreeBSD.org>2006-10-24 12:04:21 +0000
committerdavidxu <davidxu@FreeBSD.org>2006-10-24 12:04:21 +0000
commitc117e9447c4066c73b48a4ac1aa483480755a667 (patch)
tree26c604ab27a3adc80d941c80970fcdebb356e923
parent3334f92e7fb66b791442272638c461226810a58c (diff)
downloadFreeBSD-src-c117e9447c4066c73b48a4ac1aa483480755a667.zip
FreeBSD-src-c117e9447c4066c73b48a4ac1aa483480755a667.tar.gz
Protect sigqueue_take() call by child process's lock, it fixed a
potential race with ptrace 'attach' which changes parent of the child process.
-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 1e57aae..6ed8f4c 100644
--- a/sys/kern/kern_exit.c
+++ b/sys/kern/kern_exit.c
@@ -843,11 +843,11 @@ loop:
td->td_retval[0] = p->p_pid;
if (status)
*status = W_STOPCODE(p->p_xstat);
- PROC_UNLOCK(p);
PROC_LOCK(q);
sigqueue_take(p->p_ksi);
PROC_UNLOCK(q);
+ PROC_UNLOCK(p);
return (0);
}
@@ -856,11 +856,11 @@ loop:
sx_xunlock(&proctree_lock);
td->td_retval[0] = p->p_pid;
p->p_flag &= ~P_CONTINUED;
- PROC_UNLOCK(p);
PROC_LOCK(q);
sigqueue_take(p->p_ksi);
PROC_UNLOCK(q);
+ PROC_UNLOCK(p);
if (status)
*status = SIGCONT;
OpenPOWER on IntegriCloud