diff options
-rw-r--r-- | sys/alpha/alpha/trap.c | 3 | ||||
-rw-r--r-- | sys/amd64/amd64/trap.c | 4 | ||||
-rw-r--r-- | sys/i386/i386/trap.c | 4 | ||||
-rw-r--r-- | sys/ia64/ia64/trap.c | 4 | ||||
-rw-r--r-- | sys/kern/kern_kse.c | 4 | ||||
-rw-r--r-- | sys/kern/kern_thread.c | 4 | ||||
-rw-r--r-- | sys/sparc64/sparc64/trap.c | 3 |
7 files changed, 15 insertions, 11 deletions
diff --git a/sys/alpha/alpha/trap.c b/sys/alpha/alpha/trap.c index f52152a..e5975e2 100644 --- a/sys/alpha/alpha/trap.c +++ b/sys/alpha/alpha/trap.c @@ -298,12 +298,13 @@ trap(a0, a1, a2, entry, framep) td->td_frame = framep; if (td->td_ucred != p->p_ucred) cred_update_thread(td); + PROC_LOCK(p); if ((p->p_flag & P_WEXIT) && (p->p_singlethread != td)) { - PROC_LOCK(p); mtx_lock_spin(&sched_lock); thread_exit(); /* NOTREACHED */ } + PROC_UNLOCK(p); } else { sticks = 0; /* XXX bogus -Wuninitialized warning */ KASSERT(cold || td->td_ucred != NULL, diff --git a/sys/amd64/amd64/trap.c b/sys/amd64/amd64/trap.c index 0eb46ee..c0784fa 100644 --- a/sys/amd64/amd64/trap.c +++ b/sys/amd64/amd64/trap.c @@ -271,14 +271,14 @@ trap(frame) /* * 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_WEXIT) && (p->p_singlethread != td)) { - PROC_LOCK(p); mtx_lock_spin(&sched_lock); thread_exit(); /* NOTREACHED */ } + PROC_UNLOCK(p); switch (type) { case T_PRIVINFLT: /* privileged instruction fault */ diff --git a/sys/i386/i386/trap.c b/sys/i386/i386/trap.c index 0eb46ee..c0784fa 100644 --- a/sys/i386/i386/trap.c +++ b/sys/i386/i386/trap.c @@ -271,14 +271,14 @@ trap(frame) /* * 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_WEXIT) && (p->p_singlethread != td)) { - PROC_LOCK(p); mtx_lock_spin(&sched_lock); thread_exit(); /* NOTREACHED */ } + PROC_UNLOCK(p); switch (type) { case T_PRIVINFLT: /* privileged instruction fault */ diff --git a/sys/ia64/ia64/trap.c b/sys/ia64/ia64/trap.c index 3fdf9a6..0e86100 100644 --- a/sys/ia64/ia64/trap.c +++ b/sys/ia64/ia64/trap.c @@ -334,11 +334,13 @@ trap(int vector, int imm, struct trapframe *framep) td->td_frame = framep; if (td->td_ucred != p->p_ucred) cred_update_thread(td); + PROC_LOCK(p); if ((p->p_flag & P_WEXIT) && (p->p_singlethread != td)) { mtx_lock_spin(&sched_lock); - thread_exit(); /* XXXKSE need proc lock? */ + thread_exit(); /* NOTREACHED */ } + PROC_UNLOCK(p); } else { sticks = 0; /* XXX bogus -Wuninitialized warning */ KASSERT(cold || td->td_ucred != NULL, 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, diff --git a/sys/sparc64/sparc64/trap.c b/sys/sparc64/sparc64/trap.c index c743162..2df2c58 100644 --- a/sys/sparc64/sparc64/trap.c +++ b/sys/sparc64/sparc64/trap.c @@ -245,12 +245,13 @@ trap(struct trapframe *tf) td->td_frame = tf; if (td->td_ucred != p->p_ucred) cred_update_thread(td); + PROC_LOCK(p); if ((p->p_flag & P_WEXIT) && (p->p_singlethread != td)) { - PROC_LOCK(p); mtx_lock_spin(&sched_lock); thread_exit(); /* NOTREACHED */ } + PROC_UNLOCK(p); switch (tf->tf_type) { case T_DATA_MISS: |