summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_sig.c
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2014-12-05 09:30:07 +0000
committerkib <kib@FreeBSD.org>2014-12-05 09:30:07 +0000
commitf88754a36c36675f66d041b57d0da1b2ea102c62 (patch)
tree0ca6c9a83e363ce3672694841a0ef2d108f6c66d /sys/kern/kern_sig.c
parentd21006ce12c439fc2f2bbb963c3a08906361c752 (diff)
downloadFreeBSD-src-f88754a36c36675f66d041b57d0da1b2ea102c62.zip
FreeBSD-src-f88754a36c36675f66d041b57d0da1b2ea102c62.tar.gz
MFC r275206:
Assert the state of the process lock and sigact mutex in kern_sigprocmask() and reschedule_signals().
Diffstat (limited to 'sys/kern/kern_sig.c')
-rw-r--r--sys/kern/kern_sig.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c
index db159f0..10406e0 100644
--- a/sys/kern/kern_sig.c
+++ b/sys/kern/kern_sig.c
@@ -1003,8 +1003,12 @@ kern_sigprocmask(struct thread *td, int how, sigset_t *set, sigset_t *oset,
int error;
p = td->td_proc;
- if (!(flags & SIGPROCMASK_PROC_LOCKED))
+ if ((flags & SIGPROCMASK_PROC_LOCKED) != 0)
+ PROC_LOCK_ASSERT(p, MA_OWNED);
+ else
PROC_LOCK(p);
+ mtx_assert(&p->p_sigacts->ps_mtx, (flags & SIGPROCMASK_PS_LOCKED) != 0
+ ? MA_OWNED : MA_NOTOWNED);
if (oset != NULL)
*oset = td->td_sigmask;
@@ -2519,9 +2523,11 @@ reschedule_signals(struct proc *p, sigset_t block, int flags)
int sig;
PROC_LOCK_ASSERT(p, MA_OWNED);
+ ps = p->p_sigacts;
+ mtx_assert(&ps->ps_mtx, (flags & SIGPROCMASK_PS_LOCKED) != 0 ?
+ MA_OWNED : MA_NOTOWNED);
if (SIGISEMPTY(p->p_siglist))
return;
- ps = p->p_sigacts;
SIGSETAND(block, p->p_siglist);
while ((sig = sig_ffs(&block)) != 0) {
SIGDELSET(block, sig);
OpenPOWER on IntegriCloud