kern_procctl: skip zombies for process group operations

When iterating over the process group members, skip zombies same as it
is done by pfind() for single-process operation.

Reviewed by:	emaste, markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D32513
This commit is contained in:
Konstantin Belousov 2021-10-19 00:29:01 +03:00
parent 3692877a6c
commit 49db81aa05

View File

@ -960,8 +960,10 @@ kern_procctl(struct thread *td, idtype_t idtype, id_t id, int com, void *data)
first_error = 0;
LIST_FOREACH(p, &pg->pg_members, p_pglist) {
PROC_LOCK(p);
if (p->p_state == PRS_NEW || (cmd_info->need_candebug ?
p_candebug(td, p) : p_cansee(td, p)) != 0) {
if (p->p_state == PRS_NEW ||
p->p_state == PRS_ZOMBIE ||
(cmd_info->need_candebug ? p_candebug(td, p) :
p_cansee(td, p)) != 0) {
PROC_UNLOCK(p);
continue;
}