svn commit: r324735 - head/sys/kern

Mateusz Guzik mjg at FreeBSD.org
Thu Oct 19 00:46:16 UTC 2017


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


More information about the svn-src-all mailing list