From owner-p4-projects Sun Jul 28 13:18:56 2002 Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 3A2CB37B401; Sun, 28 Jul 2002 13:18: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 CF1AD37B400 for ; Sun, 28 Jul 2002 13:18:50 -0700 (PDT) Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8ADFE43E3B for ; Sun, 28 Jul 2002 13:18: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 g6SKIoJU082561 for ; Sun, 28 Jul 2002 13:18: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 g6SKIofm082558 for perforce@freebsd.org; Sun, 28 Jul 2002 13:18:50 -0700 (PDT) Date: Sun, 28 Jul 2002 13:18:50 -0700 (PDT) Message-Id: <200207282018.g6SKIofm082558@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 15067 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=15067 Change 15067 by rwatson@rwatson_paprika on 2002/07/28 13:18:13 Avoid entering mac_execve_transition() if the MAC framework hasn't previously indicated a transition will take place. Affected files ... .. //depot/projects/trustedbsd/mac/sys/kern/kern_exec.c#25 edit Differences ... ==== //depot/projects/trustedbsd/mac/sys/kern/kern_exec.c#25 (text+ko) ==== @@ -144,6 +144,9 @@ #endif struct vnode *textvp = NULL, *textdvp = NULL; int credential_changing; +#ifdef MAC + int will_transition; +#endif imgp = &image_params; @@ -379,7 +382,8 @@ attr.va_gid); #ifdef MAC vn_lock(imgp->vp, LK_EXCLUSIVE | LK_RETRY, td); - credential_changing |= mac_execve_will_transition(oldcred, imgp->vp); + will_transition = mac_execve_will_transition(oldcred, imgp->vp); + credential_changing |= will_transition; VOP_UNLOCK(imgp->vp, 0, td); #endif @@ -420,9 +424,11 @@ if (attr.va_mode & VSGID) change_egid(newcred, attr.va_gid); #ifdef MAC - vn_lock(imgp->vp, LK_EXCLUSIVE | LK_RETRY, td); - mac_execve_transition(oldcred, newcred, imgp->vp); - VOP_UNLOCK(imgp->vp, 0, td); + if (will_transition) { + vn_lock(imgp->vp, LK_EXCLUSIVE | LK_RETRY, td); + mac_execve_transition(oldcred, newcred, imgp->vp); + VOP_UNLOCK(imgp->vp, 0, td); + } #endif setugidsafety(td); /* To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe p4-projects" in the body of the message