Date: Tue, 11 Nov 2025 08:54:27 GMT From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: e1c6f4cb9bd2 - main - kern_thread: thread_suspend_check(1) must never suspend Message-ID: <202511110854.5AB8sRog073436@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=e1c6f4cb9bd29358c2b2fe249af9a2f9626b0670 commit e1c6f4cb9bd29358c2b2fe249af9a2f9626b0670 Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2025-11-06 19:25:23 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2025-11-11 08:54:05 +0000 kern_thread: thread_suspend_check(1) must never suspend Reported by: bdrewery Reviewed by: bdrewery, markj Tested by: bdrewery, pho PR: 290843 Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D53624 --- sys/kern/kern_thread.c | 15 +++++++++++---- 1 file 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 @@ -1446,6 +1446,14 @@ thread_suspend_check(int return_instead) return (TD_SBDRY_INTR(td) ? TD_SBDRY_ERRNO(td) : 0); } + /* + * 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. @@ -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);home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202511110854.5AB8sRog073436>
