Date: Tue, 12 Jun 2007 09:25:30 GMT From: Zhouyi ZHOU <zhouzhouyi@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 121487 for review Message-ID: <200706120925.l5C9PUH5008080@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=121487 Change 121487 by zhouzhouyi@zhouzhouyi_mactest on 2007/06/12 09:24:46 support for special handling of /dev/mactestpipe. Set the label of it to MAGIC_MACTESTPIPE Affected files ... .. //depot/projects/soc2007/zhouzhouyi_mactest_soc/zhouzhouyi_mactest_soc/sys/security/mac/mac_policy.h#2 edit .. //depot/projects/soc2007/zhouzhouyi_mactest_soc/zhouzhouyi_mactest_soc/sys/security/mac/mac_vfs.c#2 edit Differences ... ==== //depot/projects/soc2007/zhouzhouyi_mactest_soc/zhouzhouyi_mactest_soc/sys/security/mac/mac_policy.h#2 (text+ko) ==== @@ -631,6 +631,7 @@ mpo_init_bpfdesc_label_t mpo_init_bpfdesc_label; mpo_init_cred_label_t mpo_init_cred_label; mpo_init_devfs_label_t mpo_init_devfs_label; + mpo_init_devfs_label_t mpo_init_mactestpipe_label; mpo_placeholder_t _mpo_placeholder0; mpo_init_ifnet_label_t mpo_init_ifnet_label; mpo_init_inpcb_label_t mpo_init_inpcb_label; ==== //depot/projects/soc2007/zhouzhouyi_mactest_soc/zhouzhouyi_mactest_soc/sys/security/mac/mac_vfs.c#2 (text+ko) ==== @@ -59,13 +59,13 @@ #include <sys/file.h> #include <sys/namei.h> #include <sys/sysctl.h> - #include <vm/vm.h> #include <vm/pmap.h> #include <vm/vm_map.h> #include <vm/vm_object.h> #include <fs/devfs/devfs.h> +#include <sys/dirent.h> #include <security/mac/mac_framework.h> #include <security/mac/mac_internal.h> @@ -90,11 +90,24 @@ return (label); } +static struct label * +mac_mactestpipe_label_alloc(void) +{ + struct label *label; + + label = mac_labelzone_alloc(M_WAITOK); + MAC_PERFORM(init_devfs_label, label); + MAC_PERFORM(init_mactestpipe_label, label); + return (label); +} + void mac_init_devfs(struct devfs_dirent *de) { - - de->de_label = mac_devfs_label_alloc(); + if (de&&de->de_dirent&&!strncmp(de->de_dirent->d_name,"mactestpipe",11)) + de->de_label = mac_mactestpipe_label_alloc(); + else + de->de_label = mac_devfs_label_alloc(); } static struct label *
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200706120925.l5C9PUH5008080>