From owner-p4-projects Fri Jul 19 8:13:55 2002 Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id F0CF637B401; Fri, 19 Jul 2002 08:13:47 -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 863A437B400 for ; Fri, 19 Jul 2002 08:13:47 -0700 (PDT) Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2702543E5E for ; Fri, 19 Jul 2002 08:13:47 -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 g6JFDkJU080234 for ; Fri, 19 Jul 2002 08:13:47 -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 g6JFDkbZ080221 for perforce@freebsd.org; Fri, 19 Jul 2002 08:13:46 -0700 (PDT) Date: Fri, 19 Jul 2002 08:13:46 -0700 (PDT) Message-Id: <200207191513.g6JFDkbZ080221@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 14467 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=14467 Change 14467 by rwatson@rwatson_paprika on 2002/07/19 08:13:14 New entry point 'mpo_create_extattr_from_vnode' to support the association of extended attribute backed MAC labels with a vnode on creation if the vnode is created on a generic EA-supporting file system with MAC/MULTILABEL enabled. This call provides access to the vnode, and if the entry point fails, then the creation operation will be aborted by the file system. TODO: mac_update_extattr_from_vnode() in a way that doesn't have race conditions and consistency problems. That's actually quite hard. Affected files ... .. //depot/projects/trustedbsd/mac/sys/kern/kern_mac.c#171 edit Differences ... ==== //depot/projects/trustedbsd/mac/sys/kern/kern_mac.c#171 (text+ko) ==== @@ -142,6 +142,8 @@ static int mac_policy_register(struct mac_policy_conf *mpc); static int mac_policy_unregister(struct mac_policy_conf *mpc); +static int mac_create_extattr_from_vnode(struct vnode *vp); + /* * mac_policy_list_lock protects the consistency of 'mac_policy_list', * the linked list of attached policy modules. Read-only consumers of @@ -326,6 +328,10 @@ mpc->mpc_ops.mpo_create_devfs_vnode = mpe->mpe_function; break; + case MAC_CREATE_EXTATTR_FROM_VNODE: + mpc->mpc_ops.mpo_create_extattr_from_vnode = + mpe->mpe_function; + break; case MAC_CREATE_VNODE_FROM_VNODE: mpc->mpc_ops.mpo_create_vnode_from_vnode = mpe->mpe_function; @@ -1078,10 +1084,9 @@ */ mac_create_vnode_from_vnode(cred, dvp, tvp); - /* - * XXX: Eventually call out to EA creation entry point - * here. - */ + error = mac_create_extattr_from_vnode(tvp); + if (error) + return (error); error = mac_externalize(&tvp->v_label, &extmac); if (error) @@ -2248,6 +2253,16 @@ MAC_PERFORM(create_devfs_device, dev, de, &de->de_label); } +static int +mac_create_extattr_from_vnode(struct vnode *vp) +{ + int error; + + MAC_CHECK(create_extattr_from_vnode, vp, &vp->v_label); + + return (error); +} + void mac_create_devfs_directory(char *dirname, int dirnamelen, struct devfs_dirent *de) To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe p4-projects" in the body of the message