diff options
author | Jeff Roberson <jeff@FreeBSD.org> | 2008-03-13 00:46:12 +0000 |
---|---|---|
committer | Jeff Roberson <jeff@FreeBSD.org> | 2008-03-13 00:46:12 +0000 |
commit | f4d77e9e5437081d7c9cc56e46c28ea809bb835d (patch) | |
tree | 0bcc20e937e1f083e5f6af522fdf892ab2da969b | |
parent | cffe6e824bdcd549f0a7ca7cde170e85dd6587f3 (diff) | |
download | src-f4d77e9e5437081d7c9cc56e46c28ea809bb835d.tar.gz src-f4d77e9e5437081d7c9cc56e46c28ea809bb835d.zip |
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>
Notes
Notes:
svn path=/head/; revision=177132
-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 175cc6030bf9..86be815a2bdd 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); |