From owner-p4-projects Wed Aug 14 19:17:57 2002 Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 095D937B401; Wed, 14 Aug 2002 19:17:51 -0700 (PDT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B782E37B400 for ; Wed, 14 Aug 2002 19:17:50 -0700 (PDT) Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 716DC43E6A for ; Wed, 14 Aug 2002 19:17:50 -0700 (PDT) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: from freefall.freebsd.org (perforce@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.4/8.12.4) with ESMTP id g7F2HoJU002515 for ; Wed, 14 Aug 2002 19:17:50 -0700 (PDT) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: (from perforce@localhost) by freefall.freebsd.org (8.12.4/8.12.4/Submit) id g7F2Hora002512 for perforce@freebsd.org; Wed, 14 Aug 2002 19:17:50 -0700 (PDT) Date: Wed, 14 Aug 2002 19:17:50 -0700 (PDT) Message-Id: <200208150217.g7F2Hora002512@freefall.freebsd.org> X-Authentication-Warning: freefall.freebsd.org: perforce set sender to bb+lists.freebsd.perforce@cyrus.watson.org using -f From: Robert Watson Subject: PERFORCE change 15995 for review To: Perforce Change Reviews Sender: owner-p4-projects@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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