Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 15 Feb 2017 01:35:26 +0000 (UTC)
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r313755 - head/sys/cddl/contrib/opensolaris/uts/common/dtrace
Message-ID:  <201702150135.v1F1ZQjf059611@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: markj
Date: Wed Feb 15 01:35:26 2017
New Revision: 313755
URL: https://svnweb.freebsd.org/changeset/base/313755

Log:
  Check for an exiting process when enabling PID provider probes.
  
  MFC after:	1 week

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c
==============================================================================
--- head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c	Wed Feb 15 00:16:52 2017	(r313754)
+++ head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c	Wed Feb 15 01:35:26 2017	(r313755)
@@ -1248,6 +1248,13 @@ fasttrap_pid_enable(void *arg, dtrace_id
 #else
 	if ((p = pfind(probe->ftp_pid)) == NULL)
 		return;
+	if ((p->p_flag & P_WEXIT) != 0) {
+		PROC_UNLOCK(p);
+		return;
+	}
+
+	_PHOLD(p);
+	PROC_UNLOCK(p);
 #endif
 
 	/*
@@ -1255,13 +1262,6 @@ fasttrap_pid_enable(void *arg, dtrace_id
 	 * the chance to execute the trap instruction we're about to place
 	 * in their process's text.
 	 */
-#ifdef __FreeBSD__
-	/*
-	 * pfind() returns a locked process.
-	 */
-	_PHOLD(p);
-	PROC_UNLOCK(p);
-#endif
 	fasttrap_enable_callbacks();
 
 	/*



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