git: 235436d6311e - main - stop_all_proc(): skip traced or signal-stoped processes
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 05 Apr 2024 14:52:58 UTC
The branch main has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=235436d6311ea5ad00edcc1e553012f0736ea86d
commit 235436d6311ea5ad00edcc1e553012f0736ea86d
Author: Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2024-04-04 19:24:32 +0000
Commit: Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2024-04-05 14:52:39 +0000
stop_all_proc(): skip traced or signal-stoped processes
Since thread_single(SINGLE_ALLPROC) ignores them since 9241ebc796c,
and there is not much we can do for the debugger-controlled process.
Noted by: olce
Reviewed by: markj, olce
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D44638
---
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 8a396e208ff6..2ecc82026b3f 100644
--- a/sys/kern/kern_proc.c
+++ b/sys/kern/kern_proc.c
@@ -3477,7 +3477,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;
}
@@ -3498,6 +3499,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);