Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 20 Feb 2018 10:52:07 +0000 (UTC)
From:      Mateusz Guzik <mjg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r329639 - head/sys/kern
Message-ID:  <201802201052.w1KAq7jQ057924@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mjg
Date: Tue Feb 20 10:52:07 2018
New Revision: 329639
URL: https://svnweb.freebsd.org/changeset/base/329639

Log:
  Make killpg1 perform process validity checks without proc lock held.

Modified:
  head/sys/kern/kern_sig.c

Modified: head/sys/kern/kern_sig.c
==============================================================================
--- head/sys/kern/kern_sig.c	Tue Feb 20 10:35:13 2018	(r329638)
+++ head/sys/kern/kern_sig.c	Tue Feb 20 10:52:07 2018	(r329639)
@@ -1677,12 +1677,11 @@ killpg1(struct thread *td, int sig, int pgid, int all,
 		 */
 		sx_slock(&allproc_lock);
 		FOREACH_PROC_IN_SYSTEM(p) {
-			PROC_LOCK(p);
 			if (p->p_pid <= 1 || p->p_flag & P_SYSTEM ||
 			    p == td->td_proc || p->p_state == PRS_NEW) {
-				PROC_UNLOCK(p);
 				continue;
 			}
+			PROC_LOCK(p);
 			err = p_cansignal(td, p, sig);
 			if (err == 0) {
 				if (sig)



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