stop_all_proc(): skip traced or signal-stoped processes

Since thread_single(SINGLE_ALLPROC) ignores them since 9241ebc796,
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
This commit is contained in:
Konstantin Belousov 2024-04-04 22:24:32 +03:00
parent bb4e55242e
commit 235436d631

View file

@ -3477,7 +3477,8 @@ stop_all_proc(void)
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 @@ stop_all_proc(void)
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);