PERFORCE change 15142 for review

Robert Watson rwatson at freebsd.org
Mon Jul 29 20:54:25 GMT 2002


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

Change 15142 by rwatson at 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 at trustedbsd.org
with "unsubscribe trustedbsd-cvs" in the body of the message



More information about the trustedbsd-cvs mailing list