PERFORCE change 15995 for review

Robert Watson rwatson at freebsd.org
Thu Aug 15 02:17:50 GMT 2002


http://people.freebsd.org/~peter/p4db/chv.cgi?CH=15995

Change 15995 by rwatson at rwatson_tislabs on 2002/08/14 19:17:27

	Improve merge of recent kern_exec.c locking changes by
	jeff at FreeBSD.org.  In particular, since the vnode lock and the
	proc lock are held throughout exec in the right lock order,
	we can now avoid racy dropping and grabbing of proc/vnode
	locks for MAC entry points.  Probably not quite right yet
	due to the addition of textdvp which is not in the main tree
	and causes conflicts.

Affected files ...

.. //depot/projects/trustedbsd/mac/sys/kern/kern_exec.c#32 edit

Differences ...

==== //depot/projects/trustedbsd/mac/sys/kern/kern_exec.c#32 (text+ko) ====

@@ -357,6 +357,7 @@
 
 	/* Get a reference to the vnode prior to locking the proc */
 	VREF(ndp->ni_vp);
+	VREF(ndp->ni_dvp);
 
 	/*
 	 * For security and other reasons, signal handlers cannot
@@ -420,12 +421,8 @@
 	    attr.va_gid;
 
 #ifdef MAC
-	PROC_UNLOCK(p);
-	vn_lock(imgp->vp, LK_EXCLUSIVE | LK_RETRY, td);
 	will_transition = mac_execve_will_transition(oldcred, imgp->vp);
 	credential_changing |= will_transition;
-	VOP_UNLOCK(imgp->vp, 0, td);
-	PROC_LOCK(p);
 #endif
 
 	if (credential_changing &&
@@ -462,13 +459,9 @@
 			change_egid(newcred, attr.va_gid);
 #ifdef MAC
 		if (will_transition) {
-			PROC_UNLOCK(p);
-			vn_lock(imgp->vp, LK_EXCLUSIVE | LK_RETRY, td);
 			mac_execve_transition(oldcred, newcred, imgp->vp);
-			VOP_UNLOCK(imgp->vp, 0, td);
-			PROC_LOCK(p);
 		}
-#endif /* MAC */
+#endif
 		/*
 		 * Implement correct POSIX saved-id behavior.
 		 */
@@ -597,7 +590,7 @@
 	if (imgp->vp) {
 		NDFREE(ndp, NDF_ONLY_PNBUF);
 		vput(imgp->vp);
-		vput(ndp->ni_dvp);
+		vrele(ndp->ni_dvp);
 	}
 
 	if (imgp->object)
To Unsubscribe: send mail to majordomo at trustedbsd.org
with "unsubscribe trustedbsd-cvs" in the body of the message



More information about the trustedbsd-cvs mailing list