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();
 
        /*
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "[email protected]"

Reply via email to