git: 59447a02f1a9 - stable/13 - kern_procctl: skip zombies for process group operations

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Tue, 26 Oct 2021 02:37:15 UTC
The branch stable/13 has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=59447a02f1a9083f37d8e1e0d75bbb76ccb669d6

commit 59447a02f1a9083f37d8e1e0d75bbb76ccb669d6
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2021-10-18 21:29:01 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2021-10-26 02:26:27 +0000

    kern_procctl: skip zombies for process group operations
    
    (cherry picked from commit 49db81aa053beb131ba9dbf5519a5f0eacf28265)
---
 sys/kern/kern_procctl.c | 6 ++++--
 1 file 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;
 			}