summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_exit.c
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2003-04-23 18:46:51 +0000
committerjhb <jhb@FreeBSD.org>2003-04-23 18:46:51 +0000
commita0bf3a3e6f75678fc18fe190becfec4c8b25eb98 (patch)
tree5c78b6b61269a52d4ec630fce94d68d022ec3511 /sys/kern/kern_exit.c
parent84db389df40a359de80dfdd74c35a81241433aea (diff)
downloadFreeBSD-src-a0bf3a3e6f75678fc18fe190becfec4c8b25eb98.zip
FreeBSD-src-a0bf3a3e6f75678fc18fe190becfec4c8b25eb98.tar.gz
- Protect p_numthreads with the sched_lock.
- Protect p_singlethread with both the sched_lock and the proc lock. - Protect p_suspcount with the proc lock.
Diffstat (limited to 'sys/kern/kern_exit.c')
-rw-r--r--sys/kern/kern_exit.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c
index 187364b..8e16d3e 100644
--- a/sys/kern/kern_exit.c
+++ b/sys/kern/kern_exit.c
@@ -698,9 +698,11 @@ loop:
mtx_unlock(&Giant);
return (0);
}
+ mtx_lock_spin(&sched_lock);
if (P_SHOULDSTOP(p) && (p->p_suspcount == p->p_numthreads) &&
((p->p_flag & P_WAITED) == 0) &&
(p->p_flag & P_TRACED || uap->options & WUNTRACED)) {
+ mtx_unlock_spin(&sched_lock);
p->p_flag |= P_WAITED;
sx_xunlock(&proctree_lock);
td->td_retval[0] = p->p_pid;
@@ -723,6 +725,7 @@ loop:
mtx_unlock(&Giant);
return (error);
}
+ mtx_unlock_spin(&sched_lock);
if (uap->options & WCONTINUED && (p->p_flag & P_CONTINUED)) {
sx_xunlock(&proctree_lock);
td->td_retval[0] = p->p_pid;
OpenPOWER on IntegriCloud