From owner-p4-projects Mon Jul 29 13:54:40 2002 Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 0D65437B401; Mon, 29 Jul 2002 13:54:27 -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 9EB1737B400 for ; Mon, 29 Jul 2002 13:54:26 -0700 (PDT) Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3D26B43E3B for ; Mon, 29 Jul 2002 13:54:26 -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 g6TKsQJU072943 for ; Mon, 29 Jul 2002 13:54:26 -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 g6TKsPce072940 for perforce@freebsd.org; Mon, 29 Jul 2002 13:54:25 -0700 (PDT) Date: Mon, 29 Jul 2002 13:54:25 -0700 (PDT) Message-Id: <200207292054.g6TKsPce072940@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 15142 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=15142 Change 15142 by rwatson@rwatson_tislabs on 2002/07/29 13:53:38 First pass at adding back in 'struct mount' labeling with nmount in the tree. Once the historical cruft associated with the old mount is gone, this whole chunk of VFS code should be very clean. Affected files ... .. //depot/projects/trustedbsd/mac/sys/kern/vfs_mount.c#2 edit Differences ... ==== //depot/projects/trustedbsd/mac/sys/kern/vfs_mount.c#2 (text+ko) ==== @@ -563,6 +563,9 @@ vput(vp); goto bad; } + /* + * XXXMAC: It could be this should be a VADMIN check. + */ if (va.va_uid != td->td_ucred->cr_uid) { error = suser(td); if (error) { @@ -643,8 +646,12 @@ mp->mnt_stat.f_owner = td->td_ucred->cr_uid; strncpy(mp->mnt_stat.f_mntonname, fspath, MNAMELEN); mp->mnt_iosize_max = DFLTPHYS; +#ifdef MAC + mac_init_mount(mp); + mac_create_mount(td->td_ucred, mp); +#endif VOP_UNLOCK(vp, 0, td); - mp->mnt_optnew = optlist; + mp->mnt_optnew = optlist; /* XXXMAC: should this be above? */ update: /* @@ -662,6 +669,9 @@ else { mp->mnt_vfc->vfc_refcount--; vfs_unbusy(mp, td); +#ifdef MAC + mac_destroy_mount(mp); +#endif free(mp, M_MOUNT); } vrele(vp); @@ -752,6 +762,9 @@ mtx_unlock(&vp->v_interlock); mp->mnt_vfc->vfc_refcount--; vfs_unbusy(mp, td); +#ifdef MAC + mac_destroy_mount(mp); +#endif free(mp, M_MOUNT); vput(vp); goto bad; @@ -999,6 +1012,10 @@ mp->mnt_stat.f_owner = td->td_ucred->cr_uid; strncpy(mp->mnt_stat.f_mntonname, fspath, MNAMELEN); mp->mnt_iosize_max = DFLTPHYS; +#ifdef MAC + mac_init_mount(mp); + mac_create_mount(td->td_ucred, mp); +#endif VOP_UNLOCK(vp, 0, td); update: /* @@ -1016,6 +1033,9 @@ else { mp->mnt_vfc->vfc_refcount--; vfs_unbusy(mp, td); +#ifdef MAC + mac_destroy_mount(mp); +#endif free(mp, M_MOUNT); } vrele(vp); @@ -1093,6 +1113,9 @@ mtx_unlock(&vp->v_interlock); mp->mnt_vfc->vfc_refcount--; vfs_unbusy(mp, td); +#ifdef MAC + mac_destroy_mount(mp); +#endif free(mp, M_MOUNT); vput(vp); } @@ -1304,6 +1327,9 @@ vrele(coveredvp); if (mp->mnt_kern_flag & MNTK_MWAIT) wakeup(mp); +#ifdef MAC + mac_destroy_mount(mp); +#endif if (mp->mnt_op->vfs_mount == NULL) vfs_freeopts(mp->mnt_opt); free(mp, M_MOUNT); @@ -1350,6 +1376,10 @@ mp->mnt_stat.f_mntonname[0] = '/'; mp->mnt_stat.f_mntonname[1] = 0; (void) copystr(devname, mp->mnt_stat.f_mntfromname, MNAMELEN - 1, 0); +#ifdef MAC + mac_init_mount(mp); + mac_create_mount(td->td_ucred, mp); +#endif *mpp = mp; return (0); } @@ -1502,6 +1532,9 @@ if (error != 0) { if (mp != NULL) { vfs_unbusy(mp, curthread); +#ifdef MAC + mac_destroy_mount(mp); +#endif free(mp, M_MOUNT); } printf("Root mount failed: %d\n", error); To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe p4-projects" in the body of the message