diff options
author | jhb <jhb@FreeBSD.org> | 2003-04-18 20:20:00 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2003-04-18 20:20:00 +0000 |
commit | 8b7a3b47d15df24c762596b1df532e54646f0af9 (patch) | |
tree | 4e218d8ce7a895c200dd2841ed79f026a6d9bb7e /sys/kern | |
parent | fa6200c9ec3dfd9b8ee4c63dbef523a4e4a3c482 (diff) | |
download | FreeBSD-src-8b7a3b47d15df24c762596b1df532e54646f0af9.zip FreeBSD-src-8b7a3b47d15df24c762596b1df532e54646f0af9.tar.gz |
Use the proc lock to protect p_singlethread and a P_WEXIT test. This
fixes a couple of potential KSE panics on non-i386 arch's that weren't
holding the proc lock when calling thread_exit().
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/kern_kse.c | 4 | ||||
-rw-r--r-- | sys/kern/kern_thread.c | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/sys/kern/kern_kse.c b/sys/kern/kern_kse.c index 5f03369..cb91577 100644 --- a/sys/kern/kern_kse.c +++ b/sys/kern/kern_kse.c @@ -1544,15 +1544,15 @@ thread_user_enter(struct proc *p, struct thread *td) /* * First check that we shouldn't just abort. * But check if we are the single thread first! - * XXX p_singlethread not locked, but should be safe. */ + PROC_LOCK(p); if ((p->p_flag & P_SINGLE_EXIT) && (p->p_singlethread != td)) { - PROC_LOCK(p); mtx_lock_spin(&sched_lock); thread_stopped(p); thread_exit(); /* NOTREACHED */ } + PROC_UNLOCK(p); /* * If we are doing a syscall in a KSE environment, diff --git a/sys/kern/kern_thread.c b/sys/kern/kern_thread.c index 5f03369..cb91577 100644 --- a/sys/kern/kern_thread.c +++ b/sys/kern/kern_thread.c @@ -1544,15 +1544,15 @@ thread_user_enter(struct proc *p, struct thread *td) /* * First check that we shouldn't just abort. * But check if we are the single thread first! - * XXX p_singlethread not locked, but should be safe. */ + PROC_LOCK(p); if ((p->p_flag & P_SINGLE_EXIT) && (p->p_singlethread != td)) { - PROC_LOCK(p); mtx_lock_spin(&sched_lock); thread_stopped(p); thread_exit(); /* NOTREACHED */ } + PROC_UNLOCK(p); /* * If we are doing a syscall in a KSE environment, |