Date: Wed, 14 Aug 2002 19:17:50 -0700 (PDT) From: Robert Watson <rwatson@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 15995 for review Message-ID: <200208150217.g7F2Hora002512@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://people.freebsd.org/~peter/p4db/chv.cgi?CH=15995 Change 15995 by rwatson@rwatson_tislabs on 2002/08/14 19:17:27 Improve merge of recent kern_exec.c locking changes by jeff@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@FreeBSD.org with "unsubscribe p4-projects" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200208150217.g7F2Hora002512>