The branch main has been updated by kib:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=9241ebc796c11cf133c550f188f324bd2c12d89a

commit 9241ebc796c11cf133c550f188f324bd2c12d89a
Author:     Konstantin Belousov <[email protected]>
AuthorDate: 2024-03-27 12:29:25 +0000
Commit:     Konstantin Belousov <[email protected]>
CommitDate: 2024-03-30 14:43:52 +0000

    thread_single(9): decline external requests for traced or debugger-stopped 
procs
    
    Debugger has the powers to cause unbound delay in single-threading,
    which then blocks the threaded taskqueue.  The reproducer is
    `truss -f timeout 2 sleep 10`.
    
    Reported by:    mjg
    Reviewed by:    markj
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 week
    Differential revision:  https://reviews.freebsd.org/D44523
---
 sys/kern/kern_thread.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/sys/kern/kern_thread.c b/sys/kern/kern_thread.c
index 5847d5ceab59..0bcd5c2f2add 100644
--- a/sys/kern/kern_thread.c
+++ b/sys/kern/kern_thread.c
@@ -1248,6 +1248,9 @@ thread_single(struct proc *p, int mode)
                                return (1);
                        msleep(&p->p_flag, &p->p_mtx, PCATCH, "thrsgl", 0);
                }
+               if ((p->p_flag & (P_STOPPED_SIG | P_TRACED)) != 0 ||
+                   (p->p_flag2 & P2_WEXIT) != 0)
+                       return (1);
        } else if ((p->p_flag & P_HADTHREADS) == 0)
                return (0);
        if (p->p_singlethread != NULL && p->p_singlethread != td)

Reply via email to