diff options
| author | 2020-06-15 13:18:33 +0000 | |
|---|---|---|
| committer | 2020-06-15 13:18:33 +0000 | |
| commit | 98a52fa9d4636ee9d7e5d0a09e38aef03246795f (patch) | |
| tree | 297c492ea75fe6924aa69de7b62fc4a0024d33e2 /sys/kern/kern_sig.c | |
| parent | print the name of the rings in systat mbuf output too. (diff) | |
| download | wireguard-openbsd-98a52fa9d4636ee9d7e5d0a09e38aef03246795f.tar.xz wireguard-openbsd-98a52fa9d4636ee9d7e5d0a09e38aef03246795f.zip | |
Raise SPL when modifying ps_klist to prevent a race with interrupts.
The list can be accessed from interrupt context if a signal is sent
from an interrupt handler.
OK anton@ cheloha@ mpi@
Diffstat (limited to 'sys/kern/kern_sig.c')
| -rw-r--r-- | sys/kern/kern_sig.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index 76ebe1cc68d..757507fedd3 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_sig.c,v 1.257 2020/06/14 07:22:55 visa Exp $ */ +/* $OpenBSD: kern_sig.c,v 1.258 2020/06/15 13:18:33 visa Exp $ */ /* $NetBSD: kern_sig.c,v 1.54 1996/04/22 01:38:32 christos Exp $ */ /* @@ -1803,6 +1803,7 @@ int filt_sigattach(struct knote *kn) { struct process *pr = curproc->p_p; + int s; if (kn->kn_id >= NSIG) return EINVAL; @@ -1810,7 +1811,9 @@ filt_sigattach(struct knote *kn) kn->kn_ptr.p_process = pr; kn->kn_flags |= EV_CLEAR; /* automatically set */ + s = splhigh(); klist_insert(&pr->ps_klist, kn); + splx(s); return (0); } @@ -1819,8 +1822,11 @@ void filt_sigdetach(struct knote *kn) { struct process *pr = kn->kn_ptr.p_process; + int s; + s = splhigh(); klist_remove(&pr->ps_klist, kn); + splx(s); } /* |
