diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c --- a/sys/kern/kern_proc.c +++ b/sys/kern/kern_proc.c @@ -3477,7 +3477,8 @@ 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 @@ 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);