From owner-p4-projects@FreeBSD.ORG Mon Jun 30 13:24:04 2003 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 99CF437B405; Mon, 30 Jun 2003 13:24:03 -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 8D87C37B40E for ; Mon, 30 Jun 2003 13:24:00 -0700 (PDT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 18D0543F93 for ; Mon, 30 Jun 2003 13:24:00 -0700 (PDT) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.6/8.12.6) with ESMTP id h5UKNx0U041935 for ; Mon, 30 Jun 2003 13:23:59 -0700 (PDT) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.6/8.12.6/Submit) id h5UKNxFC041929 for perforce@freebsd.org; Mon, 30 Jun 2003 13:23:59 -0700 (PDT) Date: Mon, 30 Jun 2003 13:23:59 -0700 (PDT) Message-Id: <200306302023.h5UKNxFC041929@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to bb+lists.freebsd.perforce@cyrus.watson.org using -f From: Robert Watson To: Perforce Change Reviews Subject: PERFORCE change 33900 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Jun 2003 20:24:05 -0000 http://perforce.freebsd.org/chv.cgi?CH=33900 Change 33900 by rwatson@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 */