summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2001-04-02 17:26:51 +0000
committerjhb <jhb@FreeBSD.org>2001-04-02 17:26:51 +0000
commit2e3a4ffcee03a55b85ab104db861c78a3fe27cef (patch)
treeabe94a4bf35122e8fe5e99287ccd81886102fb5f
parent9d59e42849fe42a5ad0c38397977b75aff23d134 (diff)
downloadFreeBSD-src-2e3a4ffcee03a55b85ab104db861c78a3fe27cef.zip
FreeBSD-src-2e3a4ffcee03a55b85ab104db861c78a3fe27cef.tar.gz
- Move the second stop() of process 'p' in issignal() to be after we send
SIGCHLD to our parent process. Otherwise, we could block while obtaining the process lock for our parent process and switch out while we were in SSTOP. Even worse, when we try to resume from the mutex being blocked on our p_stat will be SRUN, not SSTOP. - Fix a comment above stop() to indicate that it requires that the proc lock be held, not a proctree lock. Reported by: markm Sleuthing by: jake
-rw-r--r--sys/kern/kern_sig.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c
index c529410..3429f39 100644
--- a/sys/kern/kern_sig.c
+++ b/sys/kern/kern_sig.c
@@ -1469,12 +1469,12 @@ issignal(p)
prop & SA_TTYSTOP))
break; /* == ignore */
p->p_xstat = sig;
- stop(p);
if ((p->p_pptr->p_procsig->ps_flag & PS_NOCLDSTOP) == 0) {
PROC_LOCK(p->p_pptr);
psignal(p->p_pptr, SIGCHLD);
PROC_UNLOCK(p->p_pptr);
}
+ stop(p);
mtx_lock_spin(&sched_lock);
PROC_UNLOCK_NOSWITCH(p);
DROP_GIANT_NOSWITCH();
@@ -1519,8 +1519,7 @@ issignal(p)
/*
* Put the argument process into the stopped state and notify the parent
* via wakeup. Signals are handled elsewhere. The process must not be
- * on the run queue. Must be called with at least a shared hold of the
- * proctree lock.
+ * on the run queue. Must be called with the proc p locked.
*/
void
stop(p)
OpenPOWER on IntegriCloud