PERFORCE change 33900 for review

Robert Watson rwatson at FreeBSD.org
Mon Jun 30 20:23:59 GMT 2003


http://perforce.freebsd.org/chv.cgi?CH=33900

Change 33900 by rwatson at rwatson_powerbook on 2003/06/30 13:23:24

	#define MA_OWNED and PROC_LOCK_ASSERT to allow our lock assertions
	to compile; this way we can keep them in the code minimizing diffs
	and documenting potential locking require when/if Darwin locking
	matures.
	
	Define M_MACPIPELABEL and M_MACTEMP in the centralized BSD malloc
	types.
	
	Use current_proc() in preference to curproc.
	
	Define VADMIN.

Affected files ...

.. //depot/projects/trustedbsd/sedarwin/apsl/xnu/bsd/kern/kern_mac.c#12 edit
.. //depot/projects/trustedbsd/sedarwin/apsl/xnu/bsd/sys/malloc.h#3 edit
.. //depot/projects/trustedbsd/sedarwin/apsl/xnu/bsd/sys/vnode.h#3 edit

Differences ...

==== //depot/projects/trustedbsd/sedarwin/apsl/xnu/bsd/kern/kern_mac.c#12 (text+ko) ====

@@ -87,6 +87,8 @@
 #define	TUNABLE_INT(x, y)
 #define	WITNESS_WARN(x, y, z, ...)
 #define	mtx_assert(x, y)
+#define	MA_OWNED
+#define	PROC_LOCK_ASSERT(x, y)
 
 SYSCTL_DECL(_security);
 
@@ -239,9 +241,6 @@
 static int	mac_setlabel_vnode_extattr(struct ucred *cred,
 		    struct vnode *vp, struct label *intlabel);
 
-MALLOC_DEFINE(M_MACPIPELABEL, "macpipelabel", "MAC labels for pipes");
-MALLOC_DEFINE(M_MACTEMP, "mactemp", "MAC temporary label storage");
-
 /*
  * mac_static_policy_list holds a list of policy modules that are not
  * loaded while the system is "live", and cannot be unloaded.  These
@@ -1459,7 +1458,7 @@
 	ASSERT_VOP_LOCKED(dvp, "mac_create_vnode_extattr");
 	ASSERT_VOP_LOCKED(vp, "mac_create_vnode_extattr");
 
-	error = VOP_OPENEXTATTR(vp, cred, curproc);
+	error = VOP_OPENEXTATTR(vp, cred, current_proc());
 	if (error == EOPNOTSUPP) {
 		/* XXX: Optionally abort if transactions not supported. */
 		if (ea_warn_once == 0) {
@@ -1474,11 +1473,11 @@
 	    dvp, &dvp->v_label, vp, &vp->v_label, cnp);
 
 	if (error) {
-		VOP_CLOSEEXTATTR(vp, 0, NOCRED, curproc);
+		VOP_CLOSEEXTATTR(vp, 0, NOCRED, current_proc());
 		return (error);
 	}
 
-	error = VOP_CLOSEEXTATTR(vp, 1, NOCRED, curproc);
+	error = VOP_CLOSEEXTATTR(vp, 1, NOCRED, current_proc());
 
 	if (error == EOPNOTSUPP)
 		error = 0;				/* XXX */
@@ -1494,7 +1493,7 @@
 
 	ASSERT_VOP_LOCKED(vp, "mac_setlabel_vnode_extattr");
 
-	error = VOP_OPENEXTATTR(vp, cred, curproc);
+	error = VOP_OPENEXTATTR(vp, cred, current_proc());
 	if (error == EOPNOTSUPP) {
 		/* XXX: Optionally abort if transactions not supported. */
 		if (ea_warn_once == 0) {
@@ -1508,11 +1507,11 @@
 	MAC_CHECK(setlabel_vnode_extattr, cred, vp, &vp->v_label, intlabel);
 
 	if (error) {
-		VOP_CLOSEEXTATTR(vp, 0, NOCRED, curproc);
+		VOP_CLOSEEXTATTR(vp, 0, NOCRED, current_proc());
 		return (error);
 	}
 
-	error = VOP_CLOSEEXTATTR(vp, 1, NOCRED, curproc);
+	error = VOP_CLOSEEXTATTR(vp, 1, NOCRED, current_proc());
 
 	if (error == EOPNOTSUPP)
 		error = 0;				/* XXX */
@@ -3365,11 +3364,11 @@
 	 * assume VOP_SETLABEL() will do it, because we might implement
 	 * that as part of vop_stdsetlabel_ea().
 	 */
-	error = VOP_ACCESS(vp, VADMIN, cred, curproc);
+	error = VOP_ACCESS(vp, VADMIN, cred, current_proc());
 	if (error)
 		return (error);
 
-	error = VOP_SETLABEL(vp, intlabel, cred, curproc);
+	error = VOP_SETLABEL(vp, intlabel, cred, current_proc());
 	if (error)
 		return (error);
 

==== //depot/projects/trustedbsd/sedarwin/apsl/xnu/bsd/sys/malloc.h#3 (text+ko) ====

@@ -167,8 +167,10 @@
 #define M_IGMP		90
 #define M_JNL_JNL   91  /* Journaling: "struct journal" */
 #define M_JNL_TR    92  /* Journaling: "struct transaction" */ 
+#define	M_MACPIPELABEL	93
+#define	M_MACTEMP	94
 
-#define	M_LAST		93	/* Must be last type + 1 */
+#define	M_LAST		95	/* Must be last type + 1 */
 
 /* Strings corresponding to types of memory */
 /* Must be in synch with the #defines above */
@@ -265,7 +267,9 @@
 	"TCP Segment Q",/* 89 M_TSEGQ */\
 	"IGMP state",	/* 90 M_IGMP */\
 	"Journal",    /* 91 M_JNL_JNL */\
-	"Transaction"    /* 92 M_JNL_TR */\
+	"Transaction",   /* 92 M_JNL_TR */\
+	"macpipelabel",	/* 93 M_MACPIPELABEL */\
+	"mactemp",	/* 94 M_MACTEMP */\
 }
 
 struct kmemstats {

==== //depot/projects/trustedbsd/sedarwin/apsl/xnu/bsd/sys/vnode.h#3 (text+ko) ====

@@ -248,6 +248,7 @@
 /*
  *  Modes.  Some values same as Ixxx entries from inode.h for now.
  */
+#define	VADMIN	10000		/* permission to administer */
 #define	VSUID	04000		/* set user id on execution */
 #define	VSGID	02000		/* set group id on execution */
 #define	VSVTX	01000		/* save swapped text even after use */
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