Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 19 Oct 2017 00:46:15 +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: r324735 - head/sys/kern
Message-ID:  <201710190046.v9J0kFqd037738@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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



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