git: a648f68c9254 - stable/14 - stop_all_proc(): skip traced or signal-stoped processes
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 12 Apr 2024 01:18:39 UTC
The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=a648f68c9254158af772ee589884adbc85a9a504 commit a648f68c9254158af772ee589884adbc85a9a504 Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2024-04-04 19:24:32 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2024-04-12 01:18:32 +0000 stop_all_proc(): skip traced or signal-stoped processes (cherry picked from commit 235436d6311ea5ad00edcc1e553012f0736ea86d) --- sys/kern/kern_proc.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c index 936d410133eb..b52455f140b2 100644 --- a/sys/kern/kern_proc.c +++ b/sys/kern/kern_proc.c @@ -3479,7 +3479,8 @@ allproc_loop: LIST_REMOVE(cp, p_list); LIST_INSERT_AFTER(p, cp, p_list); PROC_LOCK(p); - if ((p->p_flag & (P_KPROC | P_SYSTEM | P_TOTAL_STOP)) != 0) { + if ((p->p_flag & (P_KPROC | P_SYSTEM | P_TOTAL_STOP | + P_STOPPED_SIG)) != 0) { PROC_UNLOCK(p); continue; } @@ -3500,6 +3501,16 @@ allproc_loop: PROC_UNLOCK(p); continue; } + if ((p->p_flag & P_TRACED) != 0) { + /* + * thread_single() below cannot stop traced p, + * so skip it. OTOH, we cannot require + * restart because debugger might be either + * already stopped or traced as well. + */ + PROC_UNLOCK(p); + continue; + } sx_xunlock(&allproc_lock); _PHOLD(p); r = thread_single(p, SINGLE_ALLPROC);