diff options
author | jeff <jeff@FreeBSD.org> | 2008-03-13 00:46:12 +0000 |
---|---|---|
committer | jeff <jeff@FreeBSD.org> | 2008-03-13 00:46:12 +0000 |
commit | a4690639873e4a0e21ef838ee1628d4decefae64 (patch) | |
tree | 0bcc20e937e1f083e5f6af522fdf892ab2da969b /sys/kern/subr_sleepqueue.c | |
parent | 90cc368fe8d8875af227ffe20907bc15e7c6d2af (diff) | |
download | FreeBSD-src-a4690639873e4a0e21ef838ee1628d4decefae64.zip FreeBSD-src-a4690639873e4a0e21ef838ee1628d4decefae64.tar.gz |
PR 117603
- Close a sleepqueue signal race by interlocking with the per-process
spinlock. This was mistakenly omitted from the thread_lock patch and
has been a race since.
MFC After: 1 week
PR: bin/117603
Reported by: Danny Braniss <danny@cs.huji.ac.il>
Diffstat (limited to 'sys/kern/subr_sleepqueue.c')
-rw-r--r-- | sys/kern/subr_sleepqueue.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/kern/subr_sleepqueue.c b/sys/kern/subr_sleepqueue.c index 175cc60..86be815 100644 --- a/sys/kern/subr_sleepqueue.c +++ b/sys/kern/subr_sleepqueue.c @@ -403,12 +403,15 @@ sleepq_catch_signals(void *wchan, int pri) mtx_unlock(&ps->ps_mtx); } /* - * Lock sleepq chain before unlocking proc - * without this, we could lose a race. + * Lock the per-process spinlock prior to dropping the PROC_LOCK + * to avoid a signal delivery race. PROC_LOCK, PROC_SLOCK, and + * thread_lock() are currently held in tdsignal(). */ + PROC_SLOCK(p); mtx_lock_spin(&sc->sc_lock); PROC_UNLOCK(p); thread_lock(td); + PROC_SUNLOCK(p); if (ret == 0) { sleepq_switch(wchan, pri); return (0); |