aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2025-11-06 19:25:23 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2025-11-18 03:38:29 +0000
commitf363f4a8fa8b7d7beb79d2f6f70479aad30e7d6f (patch)
treee7f8f5ef3d6db5c8577b03ebf198071b140db013
parent45197d29ced2f57941a771dc8ec37243a52b9a7e (diff)
kern_thread: thread_suspend_check(1) must never suspend
PR: 290843 (cherry picked from commit e1c6f4cb9bd29358c2b2fe249af9a2f9626b0670)
-rw-r--r--sys/kern/kern_thread.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/sys/kern/kern_thread.c b/sys/kern/kern_thread.c
index a41e74e1533e..bd81b7472579 100644
--- a/sys/kern/kern_thread.c
+++ b/sys/kern/kern_thread.c
@@ -1452,6 +1452,14 @@ thread_suspend_check(int return_instead)
}
/*
+ * We might get here with return_instead == 1 if
+ * other checks missed it. Then we must not suspend
+ * regardless of P_SHOULDSTOP() or debugger request.
+ */
+ if (return_instead)
+ return (EINTR);
+
+ /*
* If the process is waiting for us to exit,
* this thread should just suicide.
* Assumes that P_SINGLE_EXIT implies P_STOPPED_SINGLE.
@@ -1488,10 +1496,9 @@ thread_suspend_check(int return_instead)
* gets taken off all queues.
*/
thread_suspend_one(td);
- if (return_instead == 0) {
- p->p_boundary_count++;
- td->td_flags |= TDF_BOUNDARY;
- }
+ MPASS(!return_instead);
+ p->p_boundary_count++;
+ td->td_flags |= TDF_BOUNDARY;
PROC_SUNLOCK(p);
mi_switch(SW_INVOL | SWT_SUSPEND);
PROC_LOCK(p);