Author: mjg
Date: Thu Oct 19 00:46:15 2017
New Revision: 324735
URL: https://svnweb.freebsd.org/changeset/base/324735

Log:
  execve: avoid one proc lock/unlock trip unless PTRACE_EXEC is set
  
  MFC after:    1 week

Modified:
  head/sys/kern/kern_exec.c

Modified: head/sys/kern/kern_exec.c
==============================================================================
--- head/sys/kern/kern_exec.c   Thu Oct 19 00:38:14 2017        (r324734)
+++ head/sys/kern/kern_exec.c   Thu Oct 19 00:46:15 2017        (r324735)
@@ -900,10 +900,12 @@ exec_fail_dealloc:
        free(imgp->freepath, M_TEMP);
 
        if (error == 0) {
-               PROC_LOCK(p);
-               if (p->p_ptevents & PTRACE_EXEC)
-                       td->td_dbgflags |= TDB_EXEC;
-               PROC_UNLOCK(p);
+               if (p->p_ptevents & PTRACE_EXEC) {
+                       PROC_LOCK(p);
+                       if (p->p_ptevents & PTRACE_EXEC)
+                               td->td_dbgflags |= TDB_EXEC;
+                       PROC_UNLOCK(p);
+               }
 
                /*
                 * Stop the process here if its stop event mask has
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to