diff options
| author | Konstantin Belousov <kib@FreeBSD.org> | 2025-11-06 19:25:23 +0000 |
|---|---|---|
| committer | Konstantin Belousov <kib@FreeBSD.org> | 2025-11-18 03:37:05 +0000 |
| commit | 48c28844382229a7af24941541e89e663b38f75c (patch) | |
| tree | 82331e28f71c8a9fb4f962096b361c920741bdb1 | |
| parent | 96468730a2fad1eaaf65367bcec5106378cbf3d1 (diff) | |
kern_thread: thread_suspend_check(1) must never suspend
PR: 290843
(cherry picked from commit e1c6f4cb9bd29358c2b2fe249af9a2f9626b0670)
| -rw-r--r-- | sys/kern/kern_thread.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/sys/kern/kern_thread.c b/sys/kern/kern_thread.c index 3180c66cb42b..4f9053460455 100644 --- a/sys/kern/kern_thread.c +++ b/sys/kern/kern_thread.c @@ -1447,6 +1447,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. @@ -1481,10 +1489,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); |
