summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormpi <mpi@openbsd.org>2021-03-08 10:54:53 +0000
committermpi <mpi@openbsd.org>2021-03-08 10:54:53 +0000
commitca0f58b85f7bf7a632b8cf4d234ce2c42f42d216 (patch)
tree712ecfcaa974d963e7fb7bd639d3da731bc14b9f
parentKill SINGLE_PTRACE and use SINGLE_SUSPEND which has almost the same semantic. (diff)
downloadwireguard-openbsd-ca0f58b85f7bf7a632b8cf4d234ce2c42f42d216.tar.xz
wireguard-openbsd-ca0f58b85f7bf7a632b8cf4d234ce2c42f42d216.zip
Move a KERNEL_ASSERT_LOCKED() from single_thread_clear() to cursig().
Ze big lock is currently necessary to ensure that two sibling threads are not racing against each other when processing signals. However it is not strickly necessary to unpark sibling threads. ok claudio@
-rw-r--r--sys/kern/kern_sig.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c
index d4f87e7c68f..a0933d9e79e 100644
--- a/sys/kern/kern_sig.c
+++ b/sys/kern/kern_sig.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_sig.c,v 1.275 2021/03/08 10:12:05 mpi Exp $ */
+/* $OpenBSD: kern_sig.c,v 1.276 2021/03/08 10:54:53 mpi Exp $ */
/* $NetBSD: kern_sig.c,v 1.54 1996/04/22 01:38:32 christos Exp $ */
/*
@@ -1182,6 +1182,8 @@ cursig(struct proc *p)
int dolock = (p->p_flag & P_SINTR) == 0;
int s;
+ KERNEL_ASSERT_LOCKED();
+
sigpending = (p->p_siglist | pr->ps_siglist);
if (sigpending == 0)
return 0;
@@ -1225,11 +1227,7 @@ cursig(struct proc *p)
if (dolock)
SCHED_UNLOCK(s);
- if (dolock)
- KERNEL_LOCK();
single_thread_clear(p, 0);
- if (dolock)
- KERNEL_UNLOCK();
/*
* If we are no longer being traced, or the parent
@@ -2124,7 +2122,6 @@ single_thread_clear(struct proc *p, int flag)
KASSERT(pr->ps_single == p);
KASSERT(curproc == p);
- KERNEL_ASSERT_LOCKED();
SCHED_LOCK(s);
pr->ps_single = NULL;