summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2022-06-29 10:48:23 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2022-06-29 10:48:23 +0000
commitb2effdc402f71ed77efd3badc92608fe51a54587 (patch)
treea072cc3451ac1c8c629e9849d99ddaae60beaa47
parentce3fadb3ad7de936da2141194945b18b8a1b0b3d (diff)
Move the deep check back into the loop. There are ways that even though
we're deep the code will SSTOP and sleep and then on wakeup we need to recheck the deep conditions. Issue analyzed and OK by mpi@ Reported-by: syzbot+f7634539e73108238c2a@syzkaller.appspotmail.com
-rw-r--r--sys/kern/kern_sig.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c
index 9516b02fb0e..e6eee8ff810 100644
--- a/sys/kern/kern_sig.c
+++ b/sys/kern/kern_sig.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_sig.c,v 1.297 2022/06/28 12:08:17 claudio Exp $ */
+/* $OpenBSD: kern_sig.c,v 1.298 2022/06/29 10:48:22 claudio Exp $ */
/* $NetBSD: kern_sig.c,v 1.54 1996/04/22 01:38:32 christos Exp $ */
/*
@@ -2020,15 +2020,15 @@ single_thread_check_locked(struct proc *p, int deep, int s)
SCHED_ASSERT_LOCKED();
if (pr->ps_single != NULL && pr->ps_single != p) {
- /* if we're in deep, we need to unwind to the edge */
- if (deep) {
- if (pr->ps_flags & PS_SINGLEUNWIND)
- return (ERESTART);
- if (pr->ps_flags & PS_SINGLEEXIT)
- return (EINTR);
- }
-
do {
+ /* if we're in deep, we need to unwind to the edge */
+ if (deep) {
+ if (pr->ps_flags & PS_SINGLEUNWIND)
+ return (ERESTART);
+ if (pr->ps_flags & PS_SINGLEEXIT)
+ return (EINTR);
+ }
+
if (atomic_dec_int_nv(&pr->ps_singlecount) == 0)
wakeup(&pr->ps_singlecount);