Skip to content

Commit 235436d

Browse files
committed
stop_all_proc(): skip traced or signal-stoped processes
Since thread_single(SINGLE_ALLPROC) ignores them since 9241ebc, 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
1 parent bb4e552 commit 235436d

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

sys/kern/kern_proc.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3477,7 +3477,8 @@ stop_all_proc(void)
34773477
LIST_REMOVE(cp, p_list);
34783478
LIST_INSERT_AFTER(p, cp, p_list);
34793479
PROC_LOCK(p);
3480-
if ((p->p_flag & (P_KPROC | P_SYSTEM | P_TOTAL_STOP)) != 0) {
3480+
if ((p->p_flag & (P_KPROC | P_SYSTEM | P_TOTAL_STOP |
3481+
P_STOPPED_SIG)) != 0) {
34813482
PROC_UNLOCK(p);
34823483
continue;
34833484
}
@@ -3498,6 +3499,16 @@ stop_all_proc(void)
34983499
PROC_UNLOCK(p);
34993500
continue;
35003501
}
3502+
if ((p->p_flag & P_TRACED) != 0) {
3503+
/*
3504+
* thread_single() below cannot stop traced p,
3505+
* so skip it. OTOH, we cannot require
3506+
* restart because debugger might be either
3507+
* already stopped or traced as well.
3508+
*/
3509+
PROC_UNLOCK(p);
3510+
continue;
3511+
}
35013512
sx_xunlock(&allproc_lock);
35023513
_PHOLD(p);
35033514
r = thread_single(p, SINGLE_ALLPROC);

0 commit comments

Comments
 (0)