aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2021-10-18 21:29:01 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2021-10-19 20:04:34 +0000
commit49db81aa053beb131ba9dbf5519a5f0eacf28265 (patch)
tree530c63e7bfe05093d5d4af24ff594647c88c3536
parent3692877a6cf8fc374349f3d9b2cbb190fec484a0 (diff)
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
-rw-r--r--sys/kern/kern_procctl.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/kern/kern_procctl.c b/sys/kern/kern_procctl.c
index 890a2e05bb27..00c68359f375 100644
--- a/sys/kern/kern_procctl.c
+++ b/sys/kern/kern_procctl.c
@@ -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;
}