Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 28 Dec 2018 13:32:15 +0000 (UTC)
From:      Jilles Tjoelker <jilles@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r342572 - head/sys/kern
Message-ID:  <201812281332.wBSDWFmn058276@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jilles
Date: Fri Dec 28 13:32:14 2018
New Revision: 342572
URL: https://svnweb.freebsd.org/changeset/base/342572

Log:
  pfind, pfind_any: Correct zombie logic
  
  SVN r340744 erroneously changed pfind() to return any process including
  zombies and pfind_any() to return only non-zombie processes.
  
  In particular, this caused kill() on a zombie process to fail with [ESRCH].
  There is no direct test case for this but /usr/tests/bin/sh/builtins/kill1.0
  occasionally triggers it (as reported by lwhsu).
  
  Conversely, returning zombies from pfind() seems likely to violate
  invariants and cause panics, but I have not looked at this.
  
  PR:		233646
  Reviewed by:	mjg, kib, ngie
  Differential Revision:	https://reviews.freebsd.org/D18665

Modified:
  head/sys/kern/kern_proc.c

Modified: head/sys/kern/kern_proc.c
==============================================================================
--- head/sys/kern/kern_proc.c	Fri Dec 28 10:10:16 2018	(r342571)
+++ head/sys/kern/kern_proc.c	Fri Dec 28 13:32:14 2018	(r342572)
@@ -388,7 +388,7 @@ _pfind(pid_t pid, bool zombie)
 		if (p->p_pid == pid) {
 			PROC_LOCK(p);
 			if (p->p_state == PRS_NEW ||
-			    (zombie && p->p_state == PRS_ZOMBIE)) {
+			    (!zombie && p->p_state == PRS_ZOMBIE)) {
 				PROC_UNLOCK(p);
 				p = NULL;
 			}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201812281332.wBSDWFmn058276>