Date: Fri, 19 Jul 2002 08:13:46 -0700 (PDT) From: Robert Watson <rwatson@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 14467 for review Message-ID: <200207191513.g6JFDkbZ080221@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200207191513.g6JFDkbZ080221>