1d8a7b7a3SRobert Watson /*- 2d8a7b7a3SRobert Watson * Copyright (c) 1999, 2000, 2001, 2002 Robert N. M. Watson 3d8a7b7a3SRobert Watson * Copyright (c) 2001, 2002 Networks Associates Technology, Inc. 4d8a7b7a3SRobert Watson * All rights reserved. 5d8a7b7a3SRobert Watson * 6d8a7b7a3SRobert Watson * This software was developed by Robert Watson for the TrustedBSD Project. 7d8a7b7a3SRobert Watson * 8dc858fcaSRobert Watson * This software was developed for the FreeBSD Project in part by Network 9dc858fcaSRobert Watson * Associates Laboratories, the Security Research Division of Network 10dc858fcaSRobert Watson * Associates, Inc. under DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), 11dc858fcaSRobert Watson * as part of the DARPA CHATS research program. 12d8a7b7a3SRobert Watson * 13d8a7b7a3SRobert Watson * Redistribution and use in source and binary forms, with or without 14d8a7b7a3SRobert Watson * modification, are permitted provided that the following conditions 15d8a7b7a3SRobert Watson * are met: 16d8a7b7a3SRobert Watson * 1. Redistributions of source code must retain the above copyright 17d8a7b7a3SRobert Watson * notice, this list of conditions and the following disclaimer. 18d8a7b7a3SRobert Watson * 2. Redistributions in binary form must reproduce the above copyright 19d8a7b7a3SRobert Watson * notice, this list of conditions and the following disclaimer in the 20d8a7b7a3SRobert Watson * documentation and/or other materials provided with the distribution. 21d8a7b7a3SRobert Watson * 22d8a7b7a3SRobert Watson * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 23d8a7b7a3SRobert Watson * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24d8a7b7a3SRobert Watson * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25d8a7b7a3SRobert Watson * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 26d8a7b7a3SRobert Watson * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27d8a7b7a3SRobert Watson * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28d8a7b7a3SRobert Watson * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29d8a7b7a3SRobert Watson * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30d8a7b7a3SRobert Watson * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31d8a7b7a3SRobert Watson * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32d8a7b7a3SRobert Watson * SUCH DAMAGE. 33d8a7b7a3SRobert Watson * 34d8a7b7a3SRobert Watson * $FreeBSD$ 35d8a7b7a3SRobert Watson */ 36d8a7b7a3SRobert Watson 37d8a7b7a3SRobert Watson /* 38d8a7b7a3SRobert Watson * Developed by the TrustedBSD Project. 39d8a7b7a3SRobert Watson * Generic mandatory access module that does nothing. 40d8a7b7a3SRobert Watson */ 41d8a7b7a3SRobert Watson 42d8a7b7a3SRobert Watson #include <sys/types.h> 43d8a7b7a3SRobert Watson #include <sys/param.h> 44d8a7b7a3SRobert Watson #include <sys/acl.h> 45d8a7b7a3SRobert Watson #include <sys/conf.h> 46763bbd2fSRobert Watson #include <sys/extattr.h> 47d8a7b7a3SRobert Watson #include <sys/kernel.h> 48d8a7b7a3SRobert Watson #include <sys/mac.h> 490712b254SRobert Watson #include <sys/malloc.h> 50d8a7b7a3SRobert Watson #include <sys/mount.h> 51d8a7b7a3SRobert Watson #include <sys/proc.h> 52d8a7b7a3SRobert Watson #include <sys/systm.h> 53d8a7b7a3SRobert Watson #include <sys/sysproto.h> 54d8a7b7a3SRobert Watson #include <sys/sysent.h> 55d8a7b7a3SRobert Watson #include <sys/vnode.h> 56d8a7b7a3SRobert Watson #include <sys/file.h> 57d8a7b7a3SRobert Watson #include <sys/socket.h> 58d8a7b7a3SRobert Watson #include <sys/socketvar.h> 59d8a7b7a3SRobert Watson #include <sys/sysctl.h> 60d8a7b7a3SRobert Watson 61d8a7b7a3SRobert Watson #include <fs/devfs/devfs.h> 62d8a7b7a3SRobert Watson 63d8a7b7a3SRobert Watson #include <net/bpfdesc.h> 64d8a7b7a3SRobert Watson #include <net/if.h> 65d8a7b7a3SRobert Watson #include <net/if_types.h> 66d8a7b7a3SRobert Watson #include <net/if_var.h> 67d8a7b7a3SRobert Watson 68d8a7b7a3SRobert Watson #include <vm/vm.h> 69d8a7b7a3SRobert Watson 70d8a7b7a3SRobert Watson #include <sys/mac_policy.h> 71d8a7b7a3SRobert Watson 72d8a7b7a3SRobert Watson SYSCTL_DECL(_security_mac); 73d8a7b7a3SRobert Watson 74d8a7b7a3SRobert Watson SYSCTL_NODE(_security_mac, OID_AUTO, test, CTLFLAG_RW, 0, 75d8a7b7a3SRobert Watson "TrustedBSD mac_test policy controls"); 76d8a7b7a3SRobert Watson 77eba0370dSRobert Watson static int mac_test_enabled = 1; 78d8a7b7a3SRobert Watson SYSCTL_INT(_security_mac_test, OID_AUTO, enabled, CTLFLAG_RW, 79d8a7b7a3SRobert Watson &mac_test_enabled, 0, "Enforce test policy"); 80d8a7b7a3SRobert Watson 81d8a7b7a3SRobert Watson #define BPFMAGIC 0xfe1ad1b6 82d8a7b7a3SRobert Watson #define DEVFSMAGIC 0x9ee79c32 83d8a7b7a3SRobert Watson #define IFNETMAGIC 0xc218b120 84d8a7b7a3SRobert Watson #define IPQMAGIC 0x206188ef 85d8a7b7a3SRobert Watson #define MBUFMAGIC 0xbbefa5bb 86d8a7b7a3SRobert Watson #define MOUNTMAGIC 0xc7c46e47 87d8a7b7a3SRobert Watson #define SOCKETMAGIC 0x9199c6cd 88d8a7b7a3SRobert Watson #define PIPEMAGIC 0xdc6c9919 89ca26e8baSRobert Watson #define PROCMAGIC 0x3b4be98f 90d8a7b7a3SRobert Watson #define CREDMAGIC 0x9a5a4987 91d8a7b7a3SRobert Watson #define VNODEMAGIC 0x1a67a45c 92d8a7b7a3SRobert Watson #define EXMAGIC 0x849ba1fd 93d8a7b7a3SRobert Watson 94d8a7b7a3SRobert Watson #define SLOT(x) LABEL_TO_SLOT((x), test_slot).l_long 95d8a7b7a3SRobert Watson static int test_slot; 96d8a7b7a3SRobert Watson SYSCTL_INT(_security_mac_test, OID_AUTO, slot, CTLFLAG_RD, 97d8a7b7a3SRobert Watson &test_slot, 0, "Slot allocated by framework"); 98d8a7b7a3SRobert Watson 99d8a7b7a3SRobert Watson static int init_count_bpfdesc; 100d8a7b7a3SRobert Watson SYSCTL_INT(_security_mac_test, OID_AUTO, init_count_bpfdesc, CTLFLAG_RD, 101d8a7b7a3SRobert Watson &init_count_bpfdesc, 0, "bpfdesc init calls"); 102d8a7b7a3SRobert Watson static int init_count_cred; 103d8a7b7a3SRobert Watson SYSCTL_INT(_security_mac_test, OID_AUTO, init_count_cred, CTLFLAG_RD, 104d8a7b7a3SRobert Watson &init_count_cred, 0, "cred init calls"); 105d8a7b7a3SRobert Watson static int init_count_devfsdirent; 106d8a7b7a3SRobert Watson SYSCTL_INT(_security_mac_test, OID_AUTO, init_count_devfsdirent, CTLFLAG_RD, 107d8a7b7a3SRobert Watson &init_count_devfsdirent, 0, "devfsdirent init calls"); 108d8a7b7a3SRobert Watson static int init_count_ifnet; 109d8a7b7a3SRobert Watson SYSCTL_INT(_security_mac_test, OID_AUTO, init_count_ifnet, CTLFLAG_RD, 110d8a7b7a3SRobert Watson &init_count_ifnet, 0, "ifnet init calls"); 111d8a7b7a3SRobert Watson static int init_count_ipq; 112d8a7b7a3SRobert Watson SYSCTL_INT(_security_mac_test, OID_AUTO, init_count_ipq, CTLFLAG_RD, 113d8a7b7a3SRobert Watson &init_count_ipq, 0, "ipq init calls"); 114d8a7b7a3SRobert Watson static int init_count_mbuf; 115d8a7b7a3SRobert Watson SYSCTL_INT(_security_mac_test, OID_AUTO, init_count_mbuf, CTLFLAG_RD, 116d8a7b7a3SRobert Watson &init_count_mbuf, 0, "mbuf init calls"); 117d8a7b7a3SRobert Watson static int init_count_mount; 118d8a7b7a3SRobert Watson SYSCTL_INT(_security_mac_test, OID_AUTO, init_count_mount, CTLFLAG_RD, 119d8a7b7a3SRobert Watson &init_count_mount, 0, "mount init calls"); 12096adb909SRobert Watson static int init_count_mount_fslabel; 12196adb909SRobert Watson SYSCTL_INT(_security_mac_test, OID_AUTO, init_count_mount_fslabel, CTLFLAG_RD, 12296adb909SRobert Watson &init_count_mount_fslabel, 0, "mount_fslabel init calls"); 123d8a7b7a3SRobert Watson static int init_count_socket; 124d8a7b7a3SRobert Watson SYSCTL_INT(_security_mac_test, OID_AUTO, init_count_socket, CTLFLAG_RD, 125d8a7b7a3SRobert Watson &init_count_socket, 0, "socket init calls"); 12696adb909SRobert Watson static int init_count_socket_peerlabel; 12796adb909SRobert Watson SYSCTL_INT(_security_mac_test, OID_AUTO, init_count_socket_peerlabel, 12896adb909SRobert Watson CTLFLAG_RD, &init_count_socket_peerlabel, 0, 12996adb909SRobert Watson "socket_peerlabel init calls"); 130d8a7b7a3SRobert Watson static int init_count_pipe; 131d8a7b7a3SRobert Watson SYSCTL_INT(_security_mac_test, OID_AUTO, init_count_pipe, CTLFLAG_RD, 132d8a7b7a3SRobert Watson &init_count_pipe, 0, "pipe init calls"); 133ca26e8baSRobert Watson static int init_count_proc; 134ca26e8baSRobert Watson SYSCTL_INT(_security_mac_test, OID_AUTO, init_count_proc, CTLFLAG_RD, 135ca26e8baSRobert Watson &init_count_proc, 0, "proc init calls"); 136d8a7b7a3SRobert Watson static int init_count_vnode; 137d8a7b7a3SRobert Watson SYSCTL_INT(_security_mac_test, OID_AUTO, init_count_vnode, CTLFLAG_RD, 138d8a7b7a3SRobert Watson &init_count_vnode, 0, "vnode init calls"); 139d8a7b7a3SRobert Watson 140d8a7b7a3SRobert Watson static int destroy_count_bpfdesc; 141d8a7b7a3SRobert Watson SYSCTL_INT(_security_mac_test, OID_AUTO, destroy_count_bpfdesc, CTLFLAG_RD, 142d8a7b7a3SRobert Watson &destroy_count_bpfdesc, 0, "bpfdesc destroy calls"); 143d8a7b7a3SRobert Watson static int destroy_count_cred; 144d8a7b7a3SRobert Watson SYSCTL_INT(_security_mac_test, OID_AUTO, destroy_count_cred, CTLFLAG_RD, 145d8a7b7a3SRobert Watson &destroy_count_cred, 0, "cred destroy calls"); 146d8a7b7a3SRobert Watson static int destroy_count_devfsdirent; 147d8a7b7a3SRobert Watson SYSCTL_INT(_security_mac_test, OID_AUTO, destroy_count_devfsdirent, CTLFLAG_RD, 148d8a7b7a3SRobert Watson &destroy_count_devfsdirent, 0, "devfsdirent destroy calls"); 149d8a7b7a3SRobert Watson static int destroy_count_ifnet; 150d8a7b7a3SRobert Watson SYSCTL_INT(_security_mac_test, OID_AUTO, destroy_count_ifnet, CTLFLAG_RD, 151d8a7b7a3SRobert Watson &destroy_count_ifnet, 0, "ifnet destroy calls"); 152d8a7b7a3SRobert Watson static int destroy_count_ipq; 153d8a7b7a3SRobert Watson SYSCTL_INT(_security_mac_test, OID_AUTO, destroy_count_ipq, CTLFLAG_RD, 154d8a7b7a3SRobert Watson &destroy_count_ipq, 0, "ipq destroy calls"); 155d8a7b7a3SRobert Watson static int destroy_count_mbuf; 156d8a7b7a3SRobert Watson SYSCTL_INT(_security_mac_test, OID_AUTO, destroy_count_mbuf, CTLFLAG_RD, 157d8a7b7a3SRobert Watson &destroy_count_mbuf, 0, "mbuf destroy calls"); 158d8a7b7a3SRobert Watson static int destroy_count_mount; 159d8a7b7a3SRobert Watson SYSCTL_INT(_security_mac_test, OID_AUTO, destroy_count_mount, CTLFLAG_RD, 160d8a7b7a3SRobert Watson &destroy_count_mount, 0, "mount destroy calls"); 16196adb909SRobert Watson static int destroy_count_mount_fslabel; 16296adb909SRobert Watson SYSCTL_INT(_security_mac_test, OID_AUTO, destroy_count_mount_fslabel, 16396adb909SRobert Watson CTLFLAG_RD, &destroy_count_mount_fslabel, 0, 16496adb909SRobert Watson "mount_fslabel destroy calls"); 165d8a7b7a3SRobert Watson static int destroy_count_socket; 166d8a7b7a3SRobert Watson SYSCTL_INT(_security_mac_test, OID_AUTO, destroy_count_socket, CTLFLAG_RD, 167d8a7b7a3SRobert Watson &destroy_count_socket, 0, "socket destroy calls"); 16896adb909SRobert Watson static int destroy_count_socket_peerlabel; 16996adb909SRobert Watson SYSCTL_INT(_security_mac_test, OID_AUTO, destroy_count_socket_peerlabel, 17096adb909SRobert Watson CTLFLAG_RD, &destroy_count_socket_peerlabel, 0, 17196adb909SRobert Watson "socket_peerlabel destroy calls"); 172d8a7b7a3SRobert Watson static int destroy_count_pipe; 173d8a7b7a3SRobert Watson SYSCTL_INT(_security_mac_test, OID_AUTO, destroy_count_pipe, CTLFLAG_RD, 174d8a7b7a3SRobert Watson &destroy_count_pipe, 0, "pipe destroy calls"); 175ca26e8baSRobert Watson static int destroy_count_proc; 176ca26e8baSRobert Watson SYSCTL_INT(_security_mac_test, OID_AUTO, destroy_count_proc, CTLFLAG_RD, 177ca26e8baSRobert Watson &destroy_count_proc, 0, "proc destroy calls"); 178d8a7b7a3SRobert Watson static int destroy_count_vnode; 179d8a7b7a3SRobert Watson SYSCTL_INT(_security_mac_test, OID_AUTO, destroy_count_vnode, CTLFLAG_RD, 180d8a7b7a3SRobert Watson &destroy_count_vnode, 0, "vnode destroy calls"); 181d8a7b7a3SRobert Watson 182d8a7b7a3SRobert Watson static int externalize_count; 183d8a7b7a3SRobert Watson SYSCTL_INT(_security_mac_test, OID_AUTO, externalize_count, CTLFLAG_RD, 184d8a7b7a3SRobert Watson &externalize_count, 0, "Subject/object externalize calls"); 185d8a7b7a3SRobert Watson static int internalize_count; 186d8a7b7a3SRobert Watson SYSCTL_INT(_security_mac_test, OID_AUTO, internalize_count, CTLFLAG_RD, 187d8a7b7a3SRobert Watson &internalize_count, 0, "Subject/object internalize calls"); 188d8a7b7a3SRobert Watson 189d8a7b7a3SRobert Watson /* 190d8a7b7a3SRobert Watson * Policy module operations. 191d8a7b7a3SRobert Watson */ 192d8a7b7a3SRobert Watson static void 193d8a7b7a3SRobert Watson mac_test_destroy(struct mac_policy_conf *conf) 194d8a7b7a3SRobert Watson { 195d8a7b7a3SRobert Watson 196d8a7b7a3SRobert Watson } 197d8a7b7a3SRobert Watson 198d8a7b7a3SRobert Watson static void 199d8a7b7a3SRobert Watson mac_test_init(struct mac_policy_conf *conf) 200d8a7b7a3SRobert Watson { 201d8a7b7a3SRobert Watson 202d8a7b7a3SRobert Watson } 203d8a7b7a3SRobert Watson 2048a97ecf6SRobert Watson static int 2058a97ecf6SRobert Watson mac_test_syscall(struct thread *td, int call, void *arg) 2068a97ecf6SRobert Watson { 2078a97ecf6SRobert Watson 2088a97ecf6SRobert Watson return (0); 2098a97ecf6SRobert Watson } 2108a97ecf6SRobert Watson 211d8a7b7a3SRobert Watson /* 212d8a7b7a3SRobert Watson * Label operations. 213d8a7b7a3SRobert Watson */ 214d8a7b7a3SRobert Watson static void 21596adb909SRobert Watson mac_test_init_bpfdesc_label(struct label *label) 216d8a7b7a3SRobert Watson { 217d8a7b7a3SRobert Watson 218d8a7b7a3SRobert Watson SLOT(label) = BPFMAGIC; 219d8a7b7a3SRobert Watson atomic_add_int(&init_count_bpfdesc, 1); 220d8a7b7a3SRobert Watson } 221d8a7b7a3SRobert Watson 222d8a7b7a3SRobert Watson static void 22396adb909SRobert Watson mac_test_init_cred_label(struct label *label) 224d8a7b7a3SRobert Watson { 225d8a7b7a3SRobert Watson 226d8a7b7a3SRobert Watson SLOT(label) = CREDMAGIC; 227d8a7b7a3SRobert Watson atomic_add_int(&init_count_cred, 1); 228d8a7b7a3SRobert Watson } 229d8a7b7a3SRobert Watson 230d8a7b7a3SRobert Watson static void 23196adb909SRobert Watson mac_test_init_devfsdirent_label(struct label *label) 232d8a7b7a3SRobert Watson { 233d8a7b7a3SRobert Watson 234d8a7b7a3SRobert Watson SLOT(label) = DEVFSMAGIC; 235d8a7b7a3SRobert Watson atomic_add_int(&init_count_devfsdirent, 1); 236d8a7b7a3SRobert Watson } 237d8a7b7a3SRobert Watson 238d8a7b7a3SRobert Watson static void 23996adb909SRobert Watson mac_test_init_ifnet_label(struct label *label) 240d8a7b7a3SRobert Watson { 241d8a7b7a3SRobert Watson 242d8a7b7a3SRobert Watson SLOT(label) = IFNETMAGIC; 243d8a7b7a3SRobert Watson atomic_add_int(&init_count_ifnet, 1); 244d8a7b7a3SRobert Watson } 245d8a7b7a3SRobert Watson 2465e7ce478SRobert Watson static int 2475e7ce478SRobert Watson mac_test_init_ipq_label(struct label *label, int flag) 248d8a7b7a3SRobert Watson { 249d8a7b7a3SRobert Watson 2500712b254SRobert Watson if (flag & M_WAITOK) 2510712b254SRobert Watson WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, 2520712b254SRobert Watson "mac_test_init_ipq_label() at %s:%d", __FILE__, 2530712b254SRobert Watson __LINE__); 2540712b254SRobert Watson 255d8a7b7a3SRobert Watson SLOT(label) = IPQMAGIC; 256d8a7b7a3SRobert Watson atomic_add_int(&init_count_ipq, 1); 2575e7ce478SRobert Watson return (0); 258d8a7b7a3SRobert Watson } 259d8a7b7a3SRobert Watson 260d8a7b7a3SRobert Watson static int 26196adb909SRobert Watson mac_test_init_mbuf_label(struct label *label, int flag) 262d8a7b7a3SRobert Watson { 263d8a7b7a3SRobert Watson 2640712b254SRobert Watson if (flag & M_WAITOK) 2650712b254SRobert Watson WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, 2660712b254SRobert Watson "mac_test_init_mbuf_label() at %s:%d", __FILE__, 2670712b254SRobert Watson __LINE__); 2680712b254SRobert Watson 269d8a7b7a3SRobert Watson SLOT(label) = MBUFMAGIC; 270d8a7b7a3SRobert Watson atomic_add_int(&init_count_mbuf, 1); 271d8a7b7a3SRobert Watson return (0); 272d8a7b7a3SRobert Watson } 273d8a7b7a3SRobert Watson 274d8a7b7a3SRobert Watson static void 27596adb909SRobert Watson mac_test_init_mount_label(struct label *label) 276d8a7b7a3SRobert Watson { 277d8a7b7a3SRobert Watson 27896adb909SRobert Watson SLOT(label) = MOUNTMAGIC; 279d8a7b7a3SRobert Watson atomic_add_int(&init_count_mount, 1); 280d8a7b7a3SRobert Watson } 281d8a7b7a3SRobert Watson 282d8a7b7a3SRobert Watson static void 28396adb909SRobert Watson mac_test_init_mount_fs_label(struct label *label) 28496adb909SRobert Watson { 28596adb909SRobert Watson 28696adb909SRobert Watson SLOT(label) = MOUNTMAGIC; 28796adb909SRobert Watson atomic_add_int(&init_count_mount_fslabel, 1); 28896adb909SRobert Watson } 28996adb909SRobert Watson 29083985c26SRobert Watson static int 29183985c26SRobert Watson mac_test_init_socket_label(struct label *label, int flag) 292d8a7b7a3SRobert Watson { 293d8a7b7a3SRobert Watson 2940712b254SRobert Watson if (flag & M_WAITOK) 2950712b254SRobert Watson WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, 2960712b254SRobert Watson "mac_test_init_socket_label() at %s:%d", __FILE__, 2970712b254SRobert Watson __LINE__); 2980712b254SRobert Watson 299d8a7b7a3SRobert Watson SLOT(label) = SOCKETMAGIC; 300d8a7b7a3SRobert Watson atomic_add_int(&init_count_socket, 1); 30183985c26SRobert Watson return (0); 302d8a7b7a3SRobert Watson } 303d8a7b7a3SRobert Watson 30483985c26SRobert Watson static int 30583985c26SRobert Watson mac_test_init_socket_peer_label(struct label *label, int flag) 30696adb909SRobert Watson { 30796adb909SRobert Watson 3080712b254SRobert Watson if (flag & M_WAITOK) 3090712b254SRobert Watson WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, 3100712b254SRobert Watson "mac_test_init_socket_peer_label() at %s:%d", __FILE__, 3110712b254SRobert Watson __LINE__); 3120712b254SRobert Watson 31396adb909SRobert Watson SLOT(label) = SOCKETMAGIC; 31496adb909SRobert Watson atomic_add_int(&init_count_socket_peerlabel, 1); 31583985c26SRobert Watson return (0); 31696adb909SRobert Watson } 31796adb909SRobert Watson 31896adb909SRobert Watson static void 31996adb909SRobert Watson mac_test_init_pipe_label(struct label *label) 320d8a7b7a3SRobert Watson { 321d8a7b7a3SRobert Watson 322d8a7b7a3SRobert Watson SLOT(label) = PIPEMAGIC; 323d8a7b7a3SRobert Watson atomic_add_int(&init_count_pipe, 1); 324d8a7b7a3SRobert Watson } 325d8a7b7a3SRobert Watson 326d8a7b7a3SRobert Watson static void 327ca26e8baSRobert Watson mac_test_init_proc_label(struct label *label) 328ca26e8baSRobert Watson { 329ca26e8baSRobert Watson 330ca26e8baSRobert Watson SLOT(label) = PROCMAGIC; 331ca26e8baSRobert Watson atomic_add_int(&init_count_proc, 1); 332ca26e8baSRobert Watson } 333ca26e8baSRobert Watson 334ca26e8baSRobert Watson static void 33596adb909SRobert Watson mac_test_init_vnode_label(struct label *label) 336d8a7b7a3SRobert Watson { 337d8a7b7a3SRobert Watson 338d8a7b7a3SRobert Watson SLOT(label) = VNODEMAGIC; 339d8a7b7a3SRobert Watson atomic_add_int(&init_count_vnode, 1); 340d8a7b7a3SRobert Watson } 341d8a7b7a3SRobert Watson 342d8a7b7a3SRobert Watson static void 34396adb909SRobert Watson mac_test_destroy_bpfdesc_label(struct label *label) 344d8a7b7a3SRobert Watson { 345d8a7b7a3SRobert Watson 346d8a7b7a3SRobert Watson if (SLOT(label) == BPFMAGIC || SLOT(label) == 0) { 347d8a7b7a3SRobert Watson atomic_add_int(&destroy_count_bpfdesc, 1); 348d8a7b7a3SRobert Watson SLOT(label) = EXMAGIC; 349d8a7b7a3SRobert Watson } else if (SLOT(label) == EXMAGIC) { 350d8a7b7a3SRobert Watson Debugger("mac_test_destroy_bpfdesc: dup destroy"); 351d8a7b7a3SRobert Watson } else { 352d8a7b7a3SRobert Watson Debugger("mac_test_destroy_bpfdesc: corrupted label"); 353d8a7b7a3SRobert Watson } 354d8a7b7a3SRobert Watson } 355d8a7b7a3SRobert Watson 356d8a7b7a3SRobert Watson static void 35796adb909SRobert Watson mac_test_destroy_cred_label(struct label *label) 358d8a7b7a3SRobert Watson { 359d8a7b7a3SRobert Watson 360d8a7b7a3SRobert Watson if (SLOT(label) == CREDMAGIC || SLOT(label) == 0) { 361d8a7b7a3SRobert Watson atomic_add_int(&destroy_count_cred, 1); 362d8a7b7a3SRobert Watson SLOT(label) = EXMAGIC; 363d8a7b7a3SRobert Watson } else if (SLOT(label) == EXMAGIC) { 364d8a7b7a3SRobert Watson Debugger("mac_test_destroy_cred: dup destroy"); 365d8a7b7a3SRobert Watson } else { 366d8a7b7a3SRobert Watson Debugger("mac_test_destroy_cred: corrupted label"); 367d8a7b7a3SRobert Watson } 368d8a7b7a3SRobert Watson } 369d8a7b7a3SRobert Watson 370d8a7b7a3SRobert Watson static void 37196adb909SRobert Watson mac_test_destroy_devfsdirent_label(struct label *label) 372d8a7b7a3SRobert Watson { 373d8a7b7a3SRobert Watson 374d8a7b7a3SRobert Watson if (SLOT(label) == DEVFSMAGIC || SLOT(label) == 0) { 375d8a7b7a3SRobert Watson atomic_add_int(&destroy_count_devfsdirent, 1); 376d8a7b7a3SRobert Watson SLOT(label) = EXMAGIC; 377d8a7b7a3SRobert Watson } else if (SLOT(label) == EXMAGIC) { 378d8a7b7a3SRobert Watson Debugger("mac_test_destroy_devfsdirent: dup destroy"); 379d8a7b7a3SRobert Watson } else { 380d8a7b7a3SRobert Watson Debugger("mac_test_destroy_devfsdirent: corrupted label"); 381d8a7b7a3SRobert Watson } 382d8a7b7a3SRobert Watson } 383d8a7b7a3SRobert Watson 384d8a7b7a3SRobert Watson static void 38596adb909SRobert Watson mac_test_destroy_ifnet_label(struct label *label) 386d8a7b7a3SRobert Watson { 387d8a7b7a3SRobert Watson 388d8a7b7a3SRobert Watson if (SLOT(label) == IFNETMAGIC || SLOT(label) == 0) { 389d8a7b7a3SRobert Watson atomic_add_int(&destroy_count_ifnet, 1); 390d8a7b7a3SRobert Watson SLOT(label) = EXMAGIC; 391d8a7b7a3SRobert Watson } else if (SLOT(label) == EXMAGIC) { 392d8a7b7a3SRobert Watson Debugger("mac_test_destroy_ifnet: dup destroy"); 393d8a7b7a3SRobert Watson } else { 394d8a7b7a3SRobert Watson Debugger("mac_test_destroy_ifnet: corrupted label"); 395d8a7b7a3SRobert Watson } 396d8a7b7a3SRobert Watson } 397d8a7b7a3SRobert Watson 398d8a7b7a3SRobert Watson static void 39996adb909SRobert Watson mac_test_destroy_ipq_label(struct label *label) 400d8a7b7a3SRobert Watson { 401d8a7b7a3SRobert Watson 402d8a7b7a3SRobert Watson if (SLOT(label) == IPQMAGIC || SLOT(label) == 0) { 403d8a7b7a3SRobert Watson atomic_add_int(&destroy_count_ipq, 1); 404d8a7b7a3SRobert Watson SLOT(label) = EXMAGIC; 405d8a7b7a3SRobert Watson } else if (SLOT(label) == EXMAGIC) { 406d8a7b7a3SRobert Watson Debugger("mac_test_destroy_ipq: dup destroy"); 407d8a7b7a3SRobert Watson } else { 408d8a7b7a3SRobert Watson Debugger("mac_test_destroy_ipq: corrupted label"); 409d8a7b7a3SRobert Watson } 410d8a7b7a3SRobert Watson } 411d8a7b7a3SRobert Watson 412d8a7b7a3SRobert Watson static void 41396adb909SRobert Watson mac_test_destroy_mbuf_label(struct label *label) 414d8a7b7a3SRobert Watson { 415d8a7b7a3SRobert Watson 4160712b254SRobert Watson /* 4170712b254SRobert Watson * If we're loaded dynamically, there may be mbufs in flight that 4180712b254SRobert Watson * didn't have label storage allocated for them. Handle this 4190712b254SRobert Watson * gracefully. 4200712b254SRobert Watson */ 4210712b254SRobert Watson if (label == NULL) 4220712b254SRobert Watson return; 4230712b254SRobert Watson 424d8a7b7a3SRobert Watson if (SLOT(label) == MBUFMAGIC || SLOT(label) == 0) { 425d8a7b7a3SRobert Watson atomic_add_int(&destroy_count_mbuf, 1); 426d8a7b7a3SRobert Watson SLOT(label) = EXMAGIC; 427d8a7b7a3SRobert Watson } else if (SLOT(label) == EXMAGIC) { 428d8a7b7a3SRobert Watson Debugger("mac_test_destroy_mbuf: dup destroy"); 429d8a7b7a3SRobert Watson } else { 430d8a7b7a3SRobert Watson Debugger("mac_test_destroy_mbuf: corrupted label"); 431d8a7b7a3SRobert Watson } 432d8a7b7a3SRobert Watson } 433d8a7b7a3SRobert Watson 434d8a7b7a3SRobert Watson static void 43596adb909SRobert Watson mac_test_destroy_mount_label(struct label *label) 436d8a7b7a3SRobert Watson { 437d8a7b7a3SRobert Watson 43896adb909SRobert Watson if ((SLOT(label) == MOUNTMAGIC || SLOT(label) == 0)) { 439d8a7b7a3SRobert Watson atomic_add_int(&destroy_count_mount, 1); 44096adb909SRobert Watson SLOT(label) = EXMAGIC; 44196adb909SRobert Watson } else if (SLOT(label) == EXMAGIC) { 442d8a7b7a3SRobert Watson Debugger("mac_test_destroy_mount: dup destroy"); 443d8a7b7a3SRobert Watson } else { 444d8a7b7a3SRobert Watson Debugger("mac_test_destroy_mount: corrupted label"); 445d8a7b7a3SRobert Watson } 446d8a7b7a3SRobert Watson } 447d8a7b7a3SRobert Watson 448d8a7b7a3SRobert Watson static void 44996adb909SRobert Watson mac_test_destroy_mount_fs_label(struct label *label) 450d8a7b7a3SRobert Watson { 451d8a7b7a3SRobert Watson 45296adb909SRobert Watson if ((SLOT(label) == MOUNTMAGIC || SLOT(label) == 0)) { 45396adb909SRobert Watson atomic_add_int(&destroy_count_mount_fslabel, 1); 45496adb909SRobert Watson SLOT(label) = EXMAGIC; 45596adb909SRobert Watson } else if (SLOT(label) == EXMAGIC) { 45696adb909SRobert Watson Debugger("mac_test_destroy_mount_fslabel: dup destroy"); 45796adb909SRobert Watson } else { 45896adb909SRobert Watson Debugger("mac_test_destroy_mount_fslabel: corrupted label"); 45996adb909SRobert Watson } 46096adb909SRobert Watson } 46196adb909SRobert Watson 46296adb909SRobert Watson static void 46396adb909SRobert Watson mac_test_destroy_socket_label(struct label *label) 46496adb909SRobert Watson { 46596adb909SRobert Watson 46696adb909SRobert Watson if ((SLOT(label) == SOCKETMAGIC || SLOT(label) == 0)) { 467d8a7b7a3SRobert Watson atomic_add_int(&destroy_count_socket, 1); 468d8a7b7a3SRobert Watson SLOT(label) = EXMAGIC; 46996adb909SRobert Watson } else if (SLOT(label) == EXMAGIC) { 470d8a7b7a3SRobert Watson Debugger("mac_test_destroy_socket: dup destroy"); 471d8a7b7a3SRobert Watson } else { 472d8a7b7a3SRobert Watson Debugger("mac_test_destroy_socket: corrupted label"); 473d8a7b7a3SRobert Watson } 474d8a7b7a3SRobert Watson } 47596adb909SRobert Watson 476d8a7b7a3SRobert Watson static void 47796adb909SRobert Watson mac_test_destroy_socket_peer_label(struct label *label) 47896adb909SRobert Watson { 47996adb909SRobert Watson 48096adb909SRobert Watson if ((SLOT(label) == SOCKETMAGIC || SLOT(label) == 0)) { 48196adb909SRobert Watson atomic_add_int(&destroy_count_socket_peerlabel, 1); 48296adb909SRobert Watson SLOT(label) = EXMAGIC; 48396adb909SRobert Watson } else if (SLOT(label) == EXMAGIC) { 48496adb909SRobert Watson Debugger("mac_test_destroy_socket_peerlabel: dup destroy"); 48596adb909SRobert Watson } else { 48696adb909SRobert Watson Debugger("mac_test_destroy_socket_peerlabel: corrupted label"); 48796adb909SRobert Watson } 48896adb909SRobert Watson } 48996adb909SRobert Watson 49096adb909SRobert Watson static void 49196adb909SRobert Watson mac_test_destroy_pipe_label(struct label *label) 492d8a7b7a3SRobert Watson { 493d8a7b7a3SRobert Watson 494d8a7b7a3SRobert Watson if ((SLOT(label) == PIPEMAGIC || SLOT(label) == 0)) { 495d8a7b7a3SRobert Watson atomic_add_int(&destroy_count_pipe, 1); 496d8a7b7a3SRobert Watson SLOT(label) = EXMAGIC; 497d8a7b7a3SRobert Watson } else if (SLOT(label) == EXMAGIC) { 498d8a7b7a3SRobert Watson Debugger("mac_test_destroy_pipe: dup destroy"); 499d8a7b7a3SRobert Watson } else { 500d8a7b7a3SRobert Watson Debugger("mac_test_destroy_pipe: corrupted label"); 501d8a7b7a3SRobert Watson } 502d8a7b7a3SRobert Watson } 503d8a7b7a3SRobert Watson 504d8a7b7a3SRobert Watson static void 505ca26e8baSRobert Watson mac_test_destroy_proc_label(struct label *label) 506ca26e8baSRobert Watson { 507ca26e8baSRobert Watson 508ca26e8baSRobert Watson if ((SLOT(label) == PROCMAGIC || SLOT(label) == 0)) { 509ca26e8baSRobert Watson atomic_add_int(&destroy_count_proc, 1); 510ca26e8baSRobert Watson SLOT(label) = EXMAGIC; 511ca26e8baSRobert Watson } else if (SLOT(label) == EXMAGIC) { 512ca26e8baSRobert Watson Debugger("mac_test_destroy_proc: dup destroy"); 513ca26e8baSRobert Watson } else { 514ca26e8baSRobert Watson Debugger("mac_test_destroy_proc: corrupted label"); 515ca26e8baSRobert Watson } 516ca26e8baSRobert Watson } 517ca26e8baSRobert Watson 518ca26e8baSRobert Watson static void 51996adb909SRobert Watson mac_test_destroy_vnode_label(struct label *label) 520d8a7b7a3SRobert Watson { 521d8a7b7a3SRobert Watson 522d8a7b7a3SRobert Watson if (SLOT(label) == VNODEMAGIC || SLOT(label) == 0) { 523d8a7b7a3SRobert Watson atomic_add_int(&destroy_count_vnode, 1); 524d8a7b7a3SRobert Watson SLOT(label) = EXMAGIC; 525d8a7b7a3SRobert Watson } else if (SLOT(label) == EXMAGIC) { 526d8a7b7a3SRobert Watson Debugger("mac_test_destroy_vnode: dup destroy"); 527d8a7b7a3SRobert Watson } else { 528d8a7b7a3SRobert Watson Debugger("mac_test_destroy_vnode: corrupted label"); 529d8a7b7a3SRobert Watson } 530d8a7b7a3SRobert Watson } 531d8a7b7a3SRobert Watson 532d8a7b7a3SRobert Watson static int 53324e8d0d0SRobert Watson mac_test_externalize_label(struct label *label, char *element_name, 53424e8d0d0SRobert Watson char *element_data, size_t size, size_t *len, int *claimed) 535d8a7b7a3SRobert Watson { 536d8a7b7a3SRobert Watson 537d8a7b7a3SRobert Watson atomic_add_int(&externalize_count, 1); 538d8a7b7a3SRobert Watson 539d8a7b7a3SRobert Watson return (0); 540d8a7b7a3SRobert Watson } 541d8a7b7a3SRobert Watson 542d8a7b7a3SRobert Watson static int 5431979061bSRobert Watson mac_test_internalize_label(struct label *label, char *element_name, 5441979061bSRobert Watson char *element_data, int *claimed) 545d8a7b7a3SRobert Watson { 546d8a7b7a3SRobert Watson 547d8a7b7a3SRobert Watson atomic_add_int(&internalize_count, 1); 548d8a7b7a3SRobert Watson 549d8a7b7a3SRobert Watson return (0); 550d8a7b7a3SRobert Watson } 551d8a7b7a3SRobert Watson 552d8a7b7a3SRobert Watson /* 553d8a7b7a3SRobert Watson * Labeling event operations: file system objects, and things that look 554d8a7b7a3SRobert Watson * a lot like file system objects. 555d8a7b7a3SRobert Watson */ 556d8a7b7a3SRobert Watson static void 557763bbd2fSRobert Watson mac_test_associate_vnode_devfs(struct mount *mp, struct label *fslabel, 558763bbd2fSRobert Watson struct devfs_dirent *de, struct label *delabel, struct vnode *vp, 559763bbd2fSRobert Watson struct label *vlabel) 560763bbd2fSRobert Watson { 561763bbd2fSRobert Watson 562763bbd2fSRobert Watson } 563763bbd2fSRobert Watson 564763bbd2fSRobert Watson static int 565763bbd2fSRobert Watson mac_test_associate_vnode_extattr(struct mount *mp, struct label *fslabel, 566763bbd2fSRobert Watson struct vnode *vp, struct label *vlabel) 567763bbd2fSRobert Watson { 568763bbd2fSRobert Watson 569763bbd2fSRobert Watson return (0); 570763bbd2fSRobert Watson } 571763bbd2fSRobert Watson 572763bbd2fSRobert Watson static void 573763bbd2fSRobert Watson mac_test_associate_vnode_singlelabel(struct mount *mp, 574763bbd2fSRobert Watson struct label *fslabel, struct vnode *vp, struct label *vlabel) 575763bbd2fSRobert Watson { 576763bbd2fSRobert Watson 577763bbd2fSRobert Watson } 578763bbd2fSRobert Watson 579763bbd2fSRobert Watson static void 580990b4b2dSRobert Watson mac_test_create_devfs_device(struct mount *mp, dev_t dev, 581d8a7b7a3SRobert Watson struct devfs_dirent *devfs_dirent, struct label *label) 582d8a7b7a3SRobert Watson { 583d8a7b7a3SRobert Watson 584d8a7b7a3SRobert Watson } 585d8a7b7a3SRobert Watson 586d8a7b7a3SRobert Watson static void 587990b4b2dSRobert Watson mac_test_create_devfs_directory(struct mount *mp, char *dirname, 588990b4b2dSRobert Watson int dirnamelen, struct devfs_dirent *devfs_dirent, struct label *label) 589990b4b2dSRobert Watson { 590990b4b2dSRobert Watson 591990b4b2dSRobert Watson } 592990b4b2dSRobert Watson 593990b4b2dSRobert Watson static void 594990b4b2dSRobert Watson mac_test_create_devfs_symlink(struct ucred *cred, struct mount *mp, 595990b4b2dSRobert Watson struct devfs_dirent *dd, struct label *ddlabel, struct devfs_dirent *de, 596990b4b2dSRobert Watson struct label *delabel) 597eea8ea31SRobert Watson { 598eea8ea31SRobert Watson 599eea8ea31SRobert Watson } 600eea8ea31SRobert Watson 601763bbd2fSRobert Watson static int 602763bbd2fSRobert Watson mac_test_create_vnode_extattr(struct ucred *cred, struct mount *mp, 603763bbd2fSRobert Watson struct label *fslabel, struct vnode *dvp, struct label *dlabel, 604763bbd2fSRobert Watson struct vnode *vp, struct label *vlabel, struct componentname *cnp) 605d8a7b7a3SRobert Watson { 606d8a7b7a3SRobert Watson 607763bbd2fSRobert Watson return (0); 608d8a7b7a3SRobert Watson } 609d8a7b7a3SRobert Watson 610d8a7b7a3SRobert Watson static void 611d8a7b7a3SRobert Watson mac_test_create_mount(struct ucred *cred, struct mount *mp, 612d8a7b7a3SRobert Watson struct label *mntlabel, struct label *fslabel) 613d8a7b7a3SRobert Watson { 614d8a7b7a3SRobert Watson 615d8a7b7a3SRobert Watson } 616d8a7b7a3SRobert Watson 617d8a7b7a3SRobert Watson static void 618d8a7b7a3SRobert Watson mac_test_create_root_mount(struct ucred *cred, struct mount *mp, 619d8a7b7a3SRobert Watson struct label *mntlabel, struct label *fslabel) 620d8a7b7a3SRobert Watson { 621d8a7b7a3SRobert Watson 622d8a7b7a3SRobert Watson } 623d8a7b7a3SRobert Watson 624d8a7b7a3SRobert Watson static void 625d8a7b7a3SRobert Watson mac_test_relabel_vnode(struct ucred *cred, struct vnode *vp, 626d8a7b7a3SRobert Watson struct label *vnodelabel, struct label *label) 627d8a7b7a3SRobert Watson { 628d8a7b7a3SRobert Watson 629d8a7b7a3SRobert Watson } 630d8a7b7a3SRobert Watson 631d8a7b7a3SRobert Watson static int 632763bbd2fSRobert Watson mac_test_setlabel_vnode_extattr(struct ucred *cred, struct vnode *vp, 633763bbd2fSRobert Watson struct label *vlabel, struct label *intlabel) 634d8a7b7a3SRobert Watson { 635d8a7b7a3SRobert Watson 636d8a7b7a3SRobert Watson return (0); 637d8a7b7a3SRobert Watson } 638d8a7b7a3SRobert Watson 639d8a7b7a3SRobert Watson static void 640990b4b2dSRobert Watson mac_test_update_devfsdirent(struct mount *mp, 641990b4b2dSRobert Watson struct devfs_dirent *devfs_dirent, struct label *direntlabel, 642990b4b2dSRobert Watson struct vnode *vp, struct label *vnodelabel) 643d8a7b7a3SRobert Watson { 644d8a7b7a3SRobert Watson 645d8a7b7a3SRobert Watson } 646d8a7b7a3SRobert Watson 647d8a7b7a3SRobert Watson /* 648d8a7b7a3SRobert Watson * Labeling event operations: IPC object. 649d8a7b7a3SRobert Watson */ 650d8a7b7a3SRobert Watson static void 651d8a7b7a3SRobert Watson mac_test_create_mbuf_from_socket(struct socket *so, struct label *socketlabel, 652d8a7b7a3SRobert Watson struct mbuf *m, struct label *mbuflabel) 653d8a7b7a3SRobert Watson { 654d8a7b7a3SRobert Watson 655d8a7b7a3SRobert Watson } 656d8a7b7a3SRobert Watson 657d8a7b7a3SRobert Watson static void 658d8a7b7a3SRobert Watson mac_test_create_socket(struct ucred *cred, struct socket *socket, 659d8a7b7a3SRobert Watson struct label *socketlabel) 660d8a7b7a3SRobert Watson { 661d8a7b7a3SRobert Watson 662d8a7b7a3SRobert Watson } 663d8a7b7a3SRobert Watson 664d8a7b7a3SRobert Watson static void 665d8a7b7a3SRobert Watson mac_test_create_pipe(struct ucred *cred, struct pipe *pipe, 666d8a7b7a3SRobert Watson struct label *pipelabel) 667d8a7b7a3SRobert Watson { 668d8a7b7a3SRobert Watson 669d8a7b7a3SRobert Watson } 670d8a7b7a3SRobert Watson 671d8a7b7a3SRobert Watson static void 672d8a7b7a3SRobert Watson mac_test_create_socket_from_socket(struct socket *oldsocket, 673d8a7b7a3SRobert Watson struct label *oldsocketlabel, struct socket *newsocket, 674d8a7b7a3SRobert Watson struct label *newsocketlabel) 675d8a7b7a3SRobert Watson { 676d8a7b7a3SRobert Watson 677d8a7b7a3SRobert Watson } 678d8a7b7a3SRobert Watson 679d8a7b7a3SRobert Watson static void 680d8a7b7a3SRobert Watson mac_test_relabel_socket(struct ucred *cred, struct socket *socket, 681d8a7b7a3SRobert Watson struct label *socketlabel, struct label *newlabel) 682d8a7b7a3SRobert Watson { 683d8a7b7a3SRobert Watson 684d8a7b7a3SRobert Watson } 685d8a7b7a3SRobert Watson 686d8a7b7a3SRobert Watson static void 687d8a7b7a3SRobert Watson mac_test_relabel_pipe(struct ucred *cred, struct pipe *pipe, 688d8a7b7a3SRobert Watson struct label *pipelabel, struct label *newlabel) 689d8a7b7a3SRobert Watson { 690d8a7b7a3SRobert Watson 691d8a7b7a3SRobert Watson } 692d8a7b7a3SRobert Watson 693d8a7b7a3SRobert Watson static void 694d8a7b7a3SRobert Watson mac_test_set_socket_peer_from_mbuf(struct mbuf *mbuf, struct label *mbuflabel, 695d8a7b7a3SRobert Watson struct socket *socket, struct label *socketpeerlabel) 696d8a7b7a3SRobert Watson { 697d8a7b7a3SRobert Watson 698d8a7b7a3SRobert Watson } 699d8a7b7a3SRobert Watson 700d8a7b7a3SRobert Watson /* 701d8a7b7a3SRobert Watson * Labeling event operations: network objects. 702d8a7b7a3SRobert Watson */ 703d8a7b7a3SRobert Watson static void 704d8a7b7a3SRobert Watson mac_test_set_socket_peer_from_socket(struct socket *oldsocket, 705d8a7b7a3SRobert Watson struct label *oldsocketlabel, struct socket *newsocket, 706d8a7b7a3SRobert Watson struct label *newsocketpeerlabel) 707d8a7b7a3SRobert Watson { 708d8a7b7a3SRobert Watson 709d8a7b7a3SRobert Watson } 710d8a7b7a3SRobert Watson 711d8a7b7a3SRobert Watson static void 712d8a7b7a3SRobert Watson mac_test_create_bpfdesc(struct ucred *cred, struct bpf_d *bpf_d, 713d8a7b7a3SRobert Watson struct label *bpflabel) 714d8a7b7a3SRobert Watson { 715d8a7b7a3SRobert Watson 716d8a7b7a3SRobert Watson } 717d8a7b7a3SRobert Watson 718d8a7b7a3SRobert Watson static void 719d8a7b7a3SRobert Watson mac_test_create_datagram_from_ipq(struct ipq *ipq, struct label *ipqlabel, 720d8a7b7a3SRobert Watson struct mbuf *datagram, struct label *datagramlabel) 721d8a7b7a3SRobert Watson { 722d8a7b7a3SRobert Watson 723d8a7b7a3SRobert Watson } 724d8a7b7a3SRobert Watson 725d8a7b7a3SRobert Watson static void 726d8a7b7a3SRobert Watson mac_test_create_fragment(struct mbuf *datagram, struct label *datagramlabel, 727d8a7b7a3SRobert Watson struct mbuf *fragment, struct label *fragmentlabel) 728d8a7b7a3SRobert Watson { 729d8a7b7a3SRobert Watson 730d8a7b7a3SRobert Watson } 731d8a7b7a3SRobert Watson 732d8a7b7a3SRobert Watson static void 733d8a7b7a3SRobert Watson mac_test_create_ifnet(struct ifnet *ifnet, struct label *ifnetlabel) 734d8a7b7a3SRobert Watson { 735d8a7b7a3SRobert Watson 736d8a7b7a3SRobert Watson } 737d8a7b7a3SRobert Watson 738d8a7b7a3SRobert Watson static void 739d8a7b7a3SRobert Watson mac_test_create_ipq(struct mbuf *fragment, struct label *fragmentlabel, 740d8a7b7a3SRobert Watson struct ipq *ipq, struct label *ipqlabel) 741d8a7b7a3SRobert Watson { 742d8a7b7a3SRobert Watson 743d8a7b7a3SRobert Watson } 744d8a7b7a3SRobert Watson 745d8a7b7a3SRobert Watson static void 746d8a7b7a3SRobert Watson mac_test_create_mbuf_from_mbuf(struct mbuf *oldmbuf, 747d8a7b7a3SRobert Watson struct label *oldmbuflabel, struct mbuf *newmbuf, 748d8a7b7a3SRobert Watson struct label *newmbuflabel) 749d8a7b7a3SRobert Watson { 750d8a7b7a3SRobert Watson 751d8a7b7a3SRobert Watson } 752d8a7b7a3SRobert Watson 753d8a7b7a3SRobert Watson static void 754d8a7b7a3SRobert Watson mac_test_create_mbuf_linklayer(struct ifnet *ifnet, struct label *ifnetlabel, 755d8a7b7a3SRobert Watson struct mbuf *mbuf, struct label *mbuflabel) 756d8a7b7a3SRobert Watson { 757d8a7b7a3SRobert Watson 758d8a7b7a3SRobert Watson } 759d8a7b7a3SRobert Watson 760d8a7b7a3SRobert Watson static void 761d8a7b7a3SRobert Watson mac_test_create_mbuf_from_bpfdesc(struct bpf_d *bpf_d, struct label *bpflabel, 762d8a7b7a3SRobert Watson struct mbuf *mbuf, struct label *mbuflabel) 763d8a7b7a3SRobert Watson { 764d8a7b7a3SRobert Watson 765d8a7b7a3SRobert Watson } 766d8a7b7a3SRobert Watson 767d8a7b7a3SRobert Watson static void 768d8a7b7a3SRobert Watson mac_test_create_mbuf_from_ifnet(struct ifnet *ifnet, struct label *ifnetlabel, 769d8a7b7a3SRobert Watson struct mbuf *m, struct label *mbuflabel) 770d8a7b7a3SRobert Watson { 771d8a7b7a3SRobert Watson 772d8a7b7a3SRobert Watson } 773d8a7b7a3SRobert Watson 774d8a7b7a3SRobert Watson static void 775d8a7b7a3SRobert Watson mac_test_create_mbuf_multicast_encap(struct mbuf *oldmbuf, 776d8a7b7a3SRobert Watson struct label *oldmbuflabel, struct ifnet *ifnet, struct label *ifnetlabel, 777d8a7b7a3SRobert Watson struct mbuf *newmbuf, struct label *newmbuflabel) 778d8a7b7a3SRobert Watson { 779d8a7b7a3SRobert Watson 780d8a7b7a3SRobert Watson } 781d8a7b7a3SRobert Watson 782d8a7b7a3SRobert Watson static void 783d8a7b7a3SRobert Watson mac_test_create_mbuf_netlayer(struct mbuf *oldmbuf, 784d8a7b7a3SRobert Watson struct label *oldmbuflabel, struct mbuf *newmbuf, 785d8a7b7a3SRobert Watson struct label *newmbuflabel) 786d8a7b7a3SRobert Watson { 787d8a7b7a3SRobert Watson 788d8a7b7a3SRobert Watson } 789d8a7b7a3SRobert Watson 790d8a7b7a3SRobert Watson static int 791d8a7b7a3SRobert Watson mac_test_fragment_match(struct mbuf *fragment, struct label *fragmentlabel, 792d8a7b7a3SRobert Watson struct ipq *ipq, struct label *ipqlabel) 793d8a7b7a3SRobert Watson { 794d8a7b7a3SRobert Watson 795d8a7b7a3SRobert Watson return (1); 796d8a7b7a3SRobert Watson } 797d8a7b7a3SRobert Watson 798d8a7b7a3SRobert Watson static void 799d8a7b7a3SRobert Watson mac_test_relabel_ifnet(struct ucred *cred, struct ifnet *ifnet, 800d8a7b7a3SRobert Watson struct label *ifnetlabel, struct label *newlabel) 801d8a7b7a3SRobert Watson { 802d8a7b7a3SRobert Watson 803d8a7b7a3SRobert Watson } 804d8a7b7a3SRobert Watson 805d8a7b7a3SRobert Watson static void 806d8a7b7a3SRobert Watson mac_test_update_ipq(struct mbuf *fragment, struct label *fragmentlabel, 807d8a7b7a3SRobert Watson struct ipq *ipq, struct label *ipqlabel) 808d8a7b7a3SRobert Watson { 809d8a7b7a3SRobert Watson 810d8a7b7a3SRobert Watson } 811d8a7b7a3SRobert Watson 812d8a7b7a3SRobert Watson /* 813d8a7b7a3SRobert Watson * Labeling event operations: processes. 814d8a7b7a3SRobert Watson */ 815d8a7b7a3SRobert Watson static void 816d8a7b7a3SRobert Watson mac_test_create_cred(struct ucred *cred_parent, struct ucred *cred_child) 817d8a7b7a3SRobert Watson { 818d8a7b7a3SRobert Watson 819d8a7b7a3SRobert Watson } 820d8a7b7a3SRobert Watson 821d8a7b7a3SRobert Watson static void 822d8a7b7a3SRobert Watson mac_test_execve_transition(struct ucred *old, struct ucred *new, 823939b97cbSRobert Watson struct vnode *vp, struct label *filelabel, 824ef5def59SRobert Watson struct label *interpvnodelabel, struct image_params *imgp, 825ef5def59SRobert Watson struct label *execlabel) 826d8a7b7a3SRobert Watson { 827d8a7b7a3SRobert Watson 828d8a7b7a3SRobert Watson } 829d8a7b7a3SRobert Watson 830d8a7b7a3SRobert Watson static int 831d8a7b7a3SRobert Watson mac_test_execve_will_transition(struct ucred *old, struct vnode *vp, 832939b97cbSRobert Watson struct label *filelabel, struct label *interpvnodelabel, 833ef5def59SRobert Watson struct image_params *imgp, struct label *execlabel) 834d8a7b7a3SRobert Watson { 835d8a7b7a3SRobert Watson 836d8a7b7a3SRobert Watson return (0); 837d8a7b7a3SRobert Watson } 838d8a7b7a3SRobert Watson 839d8a7b7a3SRobert Watson static void 840d8a7b7a3SRobert Watson mac_test_create_proc0(struct ucred *cred) 841d8a7b7a3SRobert Watson { 842d8a7b7a3SRobert Watson 843d8a7b7a3SRobert Watson } 844d8a7b7a3SRobert Watson 845d8a7b7a3SRobert Watson static void 846d8a7b7a3SRobert Watson mac_test_create_proc1(struct ucred *cred) 847d8a7b7a3SRobert Watson { 848d8a7b7a3SRobert Watson 849d8a7b7a3SRobert Watson } 850d8a7b7a3SRobert Watson 851d8a7b7a3SRobert Watson static void 852d8a7b7a3SRobert Watson mac_test_relabel_cred(struct ucred *cred, struct label *newlabel) 853d8a7b7a3SRobert Watson { 854d8a7b7a3SRobert Watson 855d8a7b7a3SRobert Watson } 856d8a7b7a3SRobert Watson 857ca26e8baSRobert Watson static void 858ca26e8baSRobert Watson mac_test_thread_userret(struct thread *td) 859ca26e8baSRobert Watson { 860ca26e8baSRobert Watson 861ca26e8baSRobert Watson } 862ca26e8baSRobert Watson 863d8a7b7a3SRobert Watson /* 864d8a7b7a3SRobert Watson * Access control checks. 865d8a7b7a3SRobert Watson */ 866d8a7b7a3SRobert Watson static int 867d8a7b7a3SRobert Watson mac_test_check_bpfdesc_receive(struct bpf_d *bpf_d, struct label *bpflabel, 868d8a7b7a3SRobert Watson struct ifnet *ifnet, struct label *ifnetlabel) 869d8a7b7a3SRobert Watson { 870d8a7b7a3SRobert Watson 871d8a7b7a3SRobert Watson return (0); 872d8a7b7a3SRobert Watson } 873d8a7b7a3SRobert Watson 874d8a7b7a3SRobert Watson static int 875d8a7b7a3SRobert Watson mac_test_check_cred_relabel(struct ucred *cred, struct label *newlabel) 876d8a7b7a3SRobert Watson { 877d8a7b7a3SRobert Watson 878d8a7b7a3SRobert Watson return (0); 879d8a7b7a3SRobert Watson } 880d8a7b7a3SRobert Watson 881d8a7b7a3SRobert Watson static int 882d8a7b7a3SRobert Watson mac_test_check_cred_visible(struct ucred *u1, struct ucred *u2) 883d8a7b7a3SRobert Watson { 884d8a7b7a3SRobert Watson 885d8a7b7a3SRobert Watson return (0); 886d8a7b7a3SRobert Watson } 887d8a7b7a3SRobert Watson 888d8a7b7a3SRobert Watson static int 889d8a7b7a3SRobert Watson mac_test_check_ifnet_relabel(struct ucred *cred, struct ifnet *ifnet, 890d8a7b7a3SRobert Watson struct label *ifnetlabel, struct label *newlabel) 891d8a7b7a3SRobert Watson { 892d8a7b7a3SRobert Watson 893d8a7b7a3SRobert Watson return (0); 894d8a7b7a3SRobert Watson } 895d8a7b7a3SRobert Watson 896d8a7b7a3SRobert Watson static int 897d8a7b7a3SRobert Watson mac_test_check_ifnet_transmit(struct ifnet *ifnet, struct label *ifnetlabel, 898d8a7b7a3SRobert Watson struct mbuf *m, struct label *mbuflabel) 899d8a7b7a3SRobert Watson { 900d8a7b7a3SRobert Watson 901d8a7b7a3SRobert Watson return (0); 902d8a7b7a3SRobert Watson } 903d8a7b7a3SRobert Watson 904d8a7b7a3SRobert Watson static int 905ca26e8baSRobert Watson mac_test_check_kenv_dump(struct ucred *cred) 906ca26e8baSRobert Watson { 907ca26e8baSRobert Watson 908ca26e8baSRobert Watson return (0); 909ca26e8baSRobert Watson } 910ca26e8baSRobert Watson 911ca26e8baSRobert Watson static int 912ca26e8baSRobert Watson mac_test_check_kenv_get(struct ucred *cred, char *name) 913ca26e8baSRobert Watson { 914ca26e8baSRobert Watson 915ca26e8baSRobert Watson return (0); 916ca26e8baSRobert Watson } 917ca26e8baSRobert Watson 918ca26e8baSRobert Watson static int 919ca26e8baSRobert Watson mac_test_check_kenv_set(struct ucred *cred, char *name, char *value) 920ca26e8baSRobert Watson { 921ca26e8baSRobert Watson 922ca26e8baSRobert Watson return (0); 923ca26e8baSRobert Watson } 924ca26e8baSRobert Watson 925ca26e8baSRobert Watson static int 926ca26e8baSRobert Watson mac_test_check_kenv_unset(struct ucred *cred, char *name) 927ca26e8baSRobert Watson { 928ca26e8baSRobert Watson 929ca26e8baSRobert Watson return (0); 930ca26e8baSRobert Watson } 931ca26e8baSRobert Watson 932ca26e8baSRobert Watson static int 933ca26e8baSRobert Watson mac_test_check_kld_load(struct ucred *cred, struct vnode *vp, 934ca26e8baSRobert Watson struct label *label) 935ca26e8baSRobert Watson { 936ca26e8baSRobert Watson 937ca26e8baSRobert Watson return (0); 938ca26e8baSRobert Watson } 939ca26e8baSRobert Watson 940ca26e8baSRobert Watson static int 941ca26e8baSRobert Watson mac_test_check_kld_stat(struct ucred *cred) 942ca26e8baSRobert Watson { 943ca26e8baSRobert Watson 944ca26e8baSRobert Watson return (0); 945ca26e8baSRobert Watson } 946ca26e8baSRobert Watson 947ca26e8baSRobert Watson static int 948ca26e8baSRobert Watson mac_test_check_kld_unload(struct ucred *cred) 949ca26e8baSRobert Watson { 950ca26e8baSRobert Watson 951ca26e8baSRobert Watson return (0); 952ca26e8baSRobert Watson } 953ca26e8baSRobert Watson 954ca26e8baSRobert Watson static int 955d8a7b7a3SRobert Watson mac_test_check_mount_stat(struct ucred *cred, struct mount *mp, 956d8a7b7a3SRobert Watson struct label *mntlabel) 957d8a7b7a3SRobert Watson { 958d8a7b7a3SRobert Watson 959d8a7b7a3SRobert Watson return (0); 960d8a7b7a3SRobert Watson } 961d8a7b7a3SRobert Watson 962d8a7b7a3SRobert Watson static int 963d8a7b7a3SRobert Watson mac_test_check_pipe_ioctl(struct ucred *cred, struct pipe *pipe, 964d8a7b7a3SRobert Watson struct label *pipelabel, unsigned long cmd, void /* caddr_t */ *data) 965d8a7b7a3SRobert Watson { 966d8a7b7a3SRobert Watson 967d8a7b7a3SRobert Watson return (0); 968d8a7b7a3SRobert Watson } 969d8a7b7a3SRobert Watson 970d8a7b7a3SRobert Watson static int 971c024c3eeSRobert Watson mac_test_check_pipe_poll(struct ucred *cred, struct pipe *pipe, 972c024c3eeSRobert Watson struct label *pipelabel) 973c024c3eeSRobert Watson { 974c024c3eeSRobert Watson 975c024c3eeSRobert Watson return (0); 976c024c3eeSRobert Watson } 977c024c3eeSRobert Watson 978c024c3eeSRobert Watson static int 979c024c3eeSRobert Watson mac_test_check_pipe_read(struct ucred *cred, struct pipe *pipe, 980c024c3eeSRobert Watson struct label *pipelabel) 981d8a7b7a3SRobert Watson { 982d8a7b7a3SRobert Watson 983d8a7b7a3SRobert Watson return (0); 984d8a7b7a3SRobert Watson } 985d8a7b7a3SRobert Watson 986d8a7b7a3SRobert Watson static int 987d8a7b7a3SRobert Watson mac_test_check_pipe_relabel(struct ucred *cred, struct pipe *pipe, 988d8a7b7a3SRobert Watson struct label *pipelabel, struct label *newlabel) 989d8a7b7a3SRobert Watson { 990d8a7b7a3SRobert Watson 991d8a7b7a3SRobert Watson return (0); 992d8a7b7a3SRobert Watson } 993d8a7b7a3SRobert Watson 994d8a7b7a3SRobert Watson static int 995c024c3eeSRobert Watson mac_test_check_pipe_stat(struct ucred *cred, struct pipe *pipe, 996c024c3eeSRobert Watson struct label *pipelabel) 997c024c3eeSRobert Watson { 998c024c3eeSRobert Watson 999c024c3eeSRobert Watson return (0); 1000c024c3eeSRobert Watson } 1001c024c3eeSRobert Watson 1002c024c3eeSRobert Watson static int 1003c024c3eeSRobert Watson mac_test_check_pipe_write(struct ucred *cred, struct pipe *pipe, 1004c024c3eeSRobert Watson struct label *pipelabel) 1005c024c3eeSRobert Watson { 1006c024c3eeSRobert Watson 1007c024c3eeSRobert Watson return (0); 1008c024c3eeSRobert Watson } 1009c024c3eeSRobert Watson 1010c024c3eeSRobert Watson static int 1011d8a7b7a3SRobert Watson mac_test_check_proc_debug(struct ucred *cred, struct proc *proc) 1012d8a7b7a3SRobert Watson { 1013d8a7b7a3SRobert Watson 1014d8a7b7a3SRobert Watson return (0); 1015d8a7b7a3SRobert Watson } 1016d8a7b7a3SRobert Watson 1017d8a7b7a3SRobert Watson static int 1018d8a7b7a3SRobert Watson mac_test_check_proc_sched(struct ucred *cred, struct proc *proc) 1019d8a7b7a3SRobert Watson { 1020d8a7b7a3SRobert Watson 1021d8a7b7a3SRobert Watson return (0); 1022d8a7b7a3SRobert Watson } 1023d8a7b7a3SRobert Watson 1024d8a7b7a3SRobert Watson static int 10255c8dd342SRobert Watson mac_test_check_proc_signal(struct ucred *cred, struct proc *proc, int signum) 1026d8a7b7a3SRobert Watson { 1027d8a7b7a3SRobert Watson 1028d8a7b7a3SRobert Watson return (0); 1029d8a7b7a3SRobert Watson } 1030d8a7b7a3SRobert Watson 1031d8a7b7a3SRobert Watson static int 1032d8a7b7a3SRobert Watson mac_test_check_socket_bind(struct ucred *cred, struct socket *socket, 1033d8a7b7a3SRobert Watson struct label *socketlabel, struct sockaddr *sockaddr) 1034d8a7b7a3SRobert Watson { 1035d8a7b7a3SRobert Watson 1036d8a7b7a3SRobert Watson return (0); 1037d8a7b7a3SRobert Watson } 1038d8a7b7a3SRobert Watson 1039d8a7b7a3SRobert Watson static int 1040d8a7b7a3SRobert Watson mac_test_check_socket_connect(struct ucred *cred, struct socket *socket, 1041d8a7b7a3SRobert Watson struct label *socketlabel, struct sockaddr *sockaddr) 1042d8a7b7a3SRobert Watson { 1043d8a7b7a3SRobert Watson 1044d8a7b7a3SRobert Watson return (0); 1045d8a7b7a3SRobert Watson } 1046d8a7b7a3SRobert Watson 1047d8a7b7a3SRobert Watson static int 1048fb95b5d3SRobert Watson mac_test_check_socket_deliver(struct socket *socket, struct label *socketlabel, 1049fb95b5d3SRobert Watson struct mbuf *m, struct label *mbuflabel) 1050d8a7b7a3SRobert Watson { 1051d8a7b7a3SRobert Watson 1052d8a7b7a3SRobert Watson return (0); 1053d8a7b7a3SRobert Watson } 1054d8a7b7a3SRobert Watson 1055d8a7b7a3SRobert Watson static int 1056fb95b5d3SRobert Watson mac_test_check_socket_listen(struct ucred *cred, struct socket *socket, 10575c8dd342SRobert Watson struct label *socketlabel) 1058d8a7b7a3SRobert Watson { 1059d8a7b7a3SRobert Watson 1060d8a7b7a3SRobert Watson return (0); 1061d8a7b7a3SRobert Watson } 1062d8a7b7a3SRobert Watson 1063d8a7b7a3SRobert Watson static int 1064d8a7b7a3SRobert Watson mac_test_check_socket_visible(struct ucred *cred, struct socket *socket, 1065d8a7b7a3SRobert Watson struct label *socketlabel) 1066d8a7b7a3SRobert Watson { 1067d8a7b7a3SRobert Watson 1068d8a7b7a3SRobert Watson return (0); 1069d8a7b7a3SRobert Watson } 1070d8a7b7a3SRobert Watson 1071d8a7b7a3SRobert Watson static int 1072d8a7b7a3SRobert Watson mac_test_check_socket_relabel(struct ucred *cred, struct socket *socket, 1073d8a7b7a3SRobert Watson struct label *socketlabel, struct label *newlabel) 1074d8a7b7a3SRobert Watson { 1075d8a7b7a3SRobert Watson 1076d8a7b7a3SRobert Watson return (0); 1077d8a7b7a3SRobert Watson } 1078d8a7b7a3SRobert Watson 1079d8a7b7a3SRobert Watson static int 1080ca26e8baSRobert Watson mac_test_check_sysarch_ioperm(struct ucred *cred) 1081ca26e8baSRobert Watson { 1082ca26e8baSRobert Watson 1083ca26e8baSRobert Watson return (0); 1084ca26e8baSRobert Watson } 1085ca26e8baSRobert Watson 1086ca26e8baSRobert Watson static int 1087ca26e8baSRobert Watson mac_test_check_system_acct(struct ucred *cred, struct vnode *vp, 1088ca26e8baSRobert Watson struct label *label) 1089ca26e8baSRobert Watson { 1090ca26e8baSRobert Watson 1091ca26e8baSRobert Watson return (0); 1092ca26e8baSRobert Watson } 1093ca26e8baSRobert Watson 1094ca26e8baSRobert Watson static int 1095ca26e8baSRobert Watson mac_test_check_system_reboot(struct ucred *cred, int how) 1096ca26e8baSRobert Watson { 1097ca26e8baSRobert Watson 1098ca26e8baSRobert Watson return (0); 1099ca26e8baSRobert Watson } 1100ca26e8baSRobert Watson 1101ca26e8baSRobert Watson static int 1102ca26e8baSRobert Watson mac_test_check_system_settime(struct ucred *cred) 1103ca26e8baSRobert Watson { 1104ca26e8baSRobert Watson 1105ca26e8baSRobert Watson return (0); 1106ca26e8baSRobert Watson } 1107ca26e8baSRobert Watson 1108ca26e8baSRobert Watson static int 1109ca26e8baSRobert Watson mac_test_check_system_swapon(struct ucred *cred, struct vnode *vp, 1110ca26e8baSRobert Watson struct label *label) 1111ca26e8baSRobert Watson { 1112ca26e8baSRobert Watson 1113ca26e8baSRobert Watson return (0); 1114ca26e8baSRobert Watson } 1115ca26e8baSRobert Watson 1116ca26e8baSRobert Watson static int 1117ca26e8baSRobert Watson mac_test_check_system_swapoff(struct ucred *cred, struct vnode *vp, 1118ca26e8baSRobert Watson struct label *label) 1119ca26e8baSRobert Watson { 1120ca26e8baSRobert Watson 1121ca26e8baSRobert Watson return (0); 1122ca26e8baSRobert Watson } 1123ca26e8baSRobert Watson 1124ca26e8baSRobert Watson static int 1125ca26e8baSRobert Watson mac_test_check_system_sysctl(struct ucred *cred, int *name, u_int namelen, 1126ca26e8baSRobert Watson void *old, size_t *oldlenp, int inkernel, void *new, size_t newlen) 1127ca26e8baSRobert Watson { 1128ca26e8baSRobert Watson 1129ca26e8baSRobert Watson return (0); 1130ca26e8baSRobert Watson } 1131ca26e8baSRobert Watson 1132ca26e8baSRobert Watson static int 1133d8a7b7a3SRobert Watson mac_test_check_vnode_access(struct ucred *cred, struct vnode *vp, 1134b914de36SRobert Watson struct label *label, int acc_mode) 1135d8a7b7a3SRobert Watson { 1136d8a7b7a3SRobert Watson 1137d8a7b7a3SRobert Watson return (0); 1138d8a7b7a3SRobert Watson } 1139d8a7b7a3SRobert Watson 1140d8a7b7a3SRobert Watson static int 1141d8a7b7a3SRobert Watson mac_test_check_vnode_chdir(struct ucred *cred, struct vnode *dvp, 1142d8a7b7a3SRobert Watson struct label *dlabel) 1143d8a7b7a3SRobert Watson { 1144d8a7b7a3SRobert Watson 1145d8a7b7a3SRobert Watson return (0); 1146d8a7b7a3SRobert Watson } 1147d8a7b7a3SRobert Watson 1148d8a7b7a3SRobert Watson static int 1149d8a7b7a3SRobert Watson mac_test_check_vnode_chroot(struct ucred *cred, struct vnode *dvp, 1150d8a7b7a3SRobert Watson struct label *dlabel) 1151d8a7b7a3SRobert Watson { 1152d8a7b7a3SRobert Watson 1153d8a7b7a3SRobert Watson return (0); 1154d8a7b7a3SRobert Watson } 1155d8a7b7a3SRobert Watson 1156d8a7b7a3SRobert Watson static int 1157d8a7b7a3SRobert Watson mac_test_check_vnode_create(struct ucred *cred, struct vnode *dvp, 1158d8a7b7a3SRobert Watson struct label *dlabel, struct componentname *cnp, struct vattr *vap) 1159d8a7b7a3SRobert Watson { 1160d8a7b7a3SRobert Watson 1161d8a7b7a3SRobert Watson return (0); 1162d8a7b7a3SRobert Watson } 1163d8a7b7a3SRobert Watson 1164d8a7b7a3SRobert Watson static int 1165d8a7b7a3SRobert Watson mac_test_check_vnode_delete(struct ucred *cred, struct vnode *dvp, 1166d8a7b7a3SRobert Watson struct label *dlabel, struct vnode *vp, struct label *label, 1167d8a7b7a3SRobert Watson struct componentname *cnp) 1168d8a7b7a3SRobert Watson { 1169d8a7b7a3SRobert Watson 1170d8a7b7a3SRobert Watson return (0); 1171d8a7b7a3SRobert Watson } 1172d8a7b7a3SRobert Watson 1173d8a7b7a3SRobert Watson static int 1174d8a7b7a3SRobert Watson mac_test_check_vnode_deleteacl(struct ucred *cred, struct vnode *vp, 1175d8a7b7a3SRobert Watson struct label *label, acl_type_t type) 1176d8a7b7a3SRobert Watson { 1177d8a7b7a3SRobert Watson 1178d8a7b7a3SRobert Watson return (0); 1179d8a7b7a3SRobert Watson } 1180d8a7b7a3SRobert Watson 1181d8a7b7a3SRobert Watson static int 1182d8a7b7a3SRobert Watson mac_test_check_vnode_exec(struct ucred *cred, struct vnode *vp, 1183ef5def59SRobert Watson struct label *label, struct image_params *imgp, 1184ef5def59SRobert Watson struct label *execlabel) 1185d8a7b7a3SRobert Watson { 1186d8a7b7a3SRobert Watson 1187d8a7b7a3SRobert Watson return (0); 1188d8a7b7a3SRobert Watson } 1189d8a7b7a3SRobert Watson 1190d8a7b7a3SRobert Watson static int 1191d8a7b7a3SRobert Watson mac_test_check_vnode_getacl(struct ucred *cred, struct vnode *vp, 1192d8a7b7a3SRobert Watson struct label *label, acl_type_t type) 1193d8a7b7a3SRobert Watson { 1194d8a7b7a3SRobert Watson 1195d8a7b7a3SRobert Watson return (0); 1196d8a7b7a3SRobert Watson } 1197d8a7b7a3SRobert Watson 1198d8a7b7a3SRobert Watson static int 1199d8a7b7a3SRobert Watson mac_test_check_vnode_getextattr(struct ucred *cred, struct vnode *vp, 1200d8a7b7a3SRobert Watson struct label *label, int attrnamespace, const char *name, struct uio *uio) 1201d8a7b7a3SRobert Watson { 1202d8a7b7a3SRobert Watson 1203d8a7b7a3SRobert Watson return (0); 1204d8a7b7a3SRobert Watson } 1205d8a7b7a3SRobert Watson 1206d8a7b7a3SRobert Watson static int 1207c27b50f5SRobert Watson mac_test_check_vnode_link(struct ucred *cred, struct vnode *dvp, 1208c27b50f5SRobert Watson struct label *dlabel, struct vnode *vp, struct label *label, 1209c27b50f5SRobert Watson struct componentname *cnp) 1210c27b50f5SRobert Watson { 1211c27b50f5SRobert Watson 1212c27b50f5SRobert Watson return (0); 1213c27b50f5SRobert Watson } 1214c27b50f5SRobert Watson 1215c27b50f5SRobert Watson static int 1216d8a7b7a3SRobert Watson mac_test_check_vnode_lookup(struct ucred *cred, struct vnode *dvp, 1217d8a7b7a3SRobert Watson struct label *dlabel, struct componentname *cnp) 1218d8a7b7a3SRobert Watson { 1219d8a7b7a3SRobert Watson 1220d8a7b7a3SRobert Watson return (0); 1221d8a7b7a3SRobert Watson } 1222d8a7b7a3SRobert Watson 1223d8a7b7a3SRobert Watson static int 1224e183f80eSRobert Watson mac_test_check_vnode_mmap(struct ucred *cred, struct vnode *vp, 1225e183f80eSRobert Watson struct label *label, int prot) 1226e183f80eSRobert Watson { 1227e183f80eSRobert Watson 1228e183f80eSRobert Watson return (0); 1229e183f80eSRobert Watson } 1230e183f80eSRobert Watson 1231e183f80eSRobert Watson static int 1232e183f80eSRobert Watson mac_test_check_vnode_mprotect(struct ucred *cred, struct vnode *vp, 1233e183f80eSRobert Watson struct label *label, int prot) 1234e183f80eSRobert Watson { 1235e183f80eSRobert Watson 1236e183f80eSRobert Watson return (0); 1237e183f80eSRobert Watson } 1238e183f80eSRobert Watson 1239e183f80eSRobert Watson static int 1240d8a7b7a3SRobert Watson mac_test_check_vnode_open(struct ucred *cred, struct vnode *vp, 1241b914de36SRobert Watson struct label *filelabel, int acc_mode) 1242d8a7b7a3SRobert Watson { 1243d8a7b7a3SRobert Watson 1244d8a7b7a3SRobert Watson return (0); 1245d8a7b7a3SRobert Watson } 1246d8a7b7a3SRobert Watson 1247d8a7b7a3SRobert Watson static int 1248177142e4SRobert Watson mac_test_check_vnode_poll(struct ucred *active_cred, struct ucred *file_cred, 1249177142e4SRobert Watson struct vnode *vp, struct label *label) 12507f724f8bSRobert Watson { 12517f724f8bSRobert Watson 12527f724f8bSRobert Watson return (0); 12537f724f8bSRobert Watson } 12547f724f8bSRobert Watson 12557f724f8bSRobert Watson static int 1256177142e4SRobert Watson mac_test_check_vnode_read(struct ucred *active_cred, struct ucred *file_cred, 1257177142e4SRobert Watson struct vnode *vp, struct label *label) 12587f724f8bSRobert Watson { 12597f724f8bSRobert Watson 12607f724f8bSRobert Watson return (0); 12617f724f8bSRobert Watson } 12627f724f8bSRobert Watson 12637f724f8bSRobert Watson static int 1264d8a7b7a3SRobert Watson mac_test_check_vnode_readdir(struct ucred *cred, struct vnode *dvp, 1265d8a7b7a3SRobert Watson struct label *dlabel) 1266d8a7b7a3SRobert Watson { 1267d8a7b7a3SRobert Watson 1268d8a7b7a3SRobert Watson return (0); 1269d8a7b7a3SRobert Watson } 1270d8a7b7a3SRobert Watson 1271d8a7b7a3SRobert Watson static int 1272d8a7b7a3SRobert Watson mac_test_check_vnode_readlink(struct ucred *cred, struct vnode *vp, 1273d8a7b7a3SRobert Watson struct label *vnodelabel) 1274d8a7b7a3SRobert Watson { 1275d8a7b7a3SRobert Watson 1276d8a7b7a3SRobert Watson return (0); 1277d8a7b7a3SRobert Watson } 1278d8a7b7a3SRobert Watson 1279d8a7b7a3SRobert Watson static int 1280d8a7b7a3SRobert Watson mac_test_check_vnode_relabel(struct ucred *cred, struct vnode *vp, 1281d8a7b7a3SRobert Watson struct label *vnodelabel, struct label *newlabel) 1282d8a7b7a3SRobert Watson { 1283d8a7b7a3SRobert Watson 1284d8a7b7a3SRobert Watson return (0); 1285d8a7b7a3SRobert Watson } 1286d8a7b7a3SRobert Watson 1287d8a7b7a3SRobert Watson static int 1288d8a7b7a3SRobert Watson mac_test_check_vnode_rename_from(struct ucred *cred, struct vnode *dvp, 1289d8a7b7a3SRobert Watson struct label *dlabel, struct vnode *vp, struct label *label, 1290d8a7b7a3SRobert Watson struct componentname *cnp) 1291d8a7b7a3SRobert Watson { 1292d8a7b7a3SRobert Watson 1293d8a7b7a3SRobert Watson return (0); 1294d8a7b7a3SRobert Watson } 1295d8a7b7a3SRobert Watson 1296d8a7b7a3SRobert Watson static int 1297d8a7b7a3SRobert Watson mac_test_check_vnode_rename_to(struct ucred *cred, struct vnode *dvp, 1298d8a7b7a3SRobert Watson struct label *dlabel, struct vnode *vp, struct label *label, int samedir, 1299d8a7b7a3SRobert Watson struct componentname *cnp) 1300d8a7b7a3SRobert Watson { 1301d8a7b7a3SRobert Watson 1302d8a7b7a3SRobert Watson return (0); 1303d8a7b7a3SRobert Watson } 1304d8a7b7a3SRobert Watson 1305d8a7b7a3SRobert Watson static int 1306d8a7b7a3SRobert Watson mac_test_check_vnode_revoke(struct ucred *cred, struct vnode *vp, 1307d8a7b7a3SRobert Watson struct label *label) 1308d8a7b7a3SRobert Watson { 1309d8a7b7a3SRobert Watson 1310d8a7b7a3SRobert Watson return (0); 1311d8a7b7a3SRobert Watson } 1312d8a7b7a3SRobert Watson 1313d8a7b7a3SRobert Watson static int 1314d8a7b7a3SRobert Watson mac_test_check_vnode_setacl(struct ucred *cred, struct vnode *vp, 1315d8a7b7a3SRobert Watson struct label *label, acl_type_t type, struct acl *acl) 1316d8a7b7a3SRobert Watson { 1317d8a7b7a3SRobert Watson 1318d8a7b7a3SRobert Watson return (0); 1319d8a7b7a3SRobert Watson } 1320d8a7b7a3SRobert Watson 1321d8a7b7a3SRobert Watson static int 1322d8a7b7a3SRobert Watson mac_test_check_vnode_setextattr(struct ucred *cred, struct vnode *vp, 1323d8a7b7a3SRobert Watson struct label *label, int attrnamespace, const char *name, struct uio *uio) 1324d8a7b7a3SRobert Watson { 1325d8a7b7a3SRobert Watson 1326d8a7b7a3SRobert Watson return (0); 1327d8a7b7a3SRobert Watson } 1328d8a7b7a3SRobert Watson 1329d8a7b7a3SRobert Watson static int 1330d8a7b7a3SRobert Watson mac_test_check_vnode_setflags(struct ucred *cred, struct vnode *vp, 1331d8a7b7a3SRobert Watson struct label *label, u_long flags) 1332d8a7b7a3SRobert Watson { 1333d8a7b7a3SRobert Watson 1334d8a7b7a3SRobert Watson return (0); 1335d8a7b7a3SRobert Watson } 1336d8a7b7a3SRobert Watson 1337d8a7b7a3SRobert Watson static int 1338d8a7b7a3SRobert Watson mac_test_check_vnode_setmode(struct ucred *cred, struct vnode *vp, 1339d8a7b7a3SRobert Watson struct label *label, mode_t mode) 1340d8a7b7a3SRobert Watson { 1341d8a7b7a3SRobert Watson 1342d8a7b7a3SRobert Watson return (0); 1343d8a7b7a3SRobert Watson } 1344d8a7b7a3SRobert Watson 1345d8a7b7a3SRobert Watson static int 1346d8a7b7a3SRobert Watson mac_test_check_vnode_setowner(struct ucred *cred, struct vnode *vp, 1347d8a7b7a3SRobert Watson struct label *label, uid_t uid, gid_t gid) 1348d8a7b7a3SRobert Watson { 1349d8a7b7a3SRobert Watson 1350d8a7b7a3SRobert Watson return (0); 1351d8a7b7a3SRobert Watson } 1352d8a7b7a3SRobert Watson 1353d8a7b7a3SRobert Watson static int 1354d8a7b7a3SRobert Watson mac_test_check_vnode_setutimes(struct ucred *cred, struct vnode *vp, 1355d8a7b7a3SRobert Watson struct label *label, struct timespec atime, struct timespec mtime) 1356d8a7b7a3SRobert Watson { 1357d8a7b7a3SRobert Watson 1358d8a7b7a3SRobert Watson return (0); 1359d8a7b7a3SRobert Watson } 1360d8a7b7a3SRobert Watson 1361d8a7b7a3SRobert Watson static int 1362177142e4SRobert Watson mac_test_check_vnode_stat(struct ucred *active_cred, struct ucred *file_cred, 1363177142e4SRobert Watson struct vnode *vp, struct label *label) 1364d8a7b7a3SRobert Watson { 1365d8a7b7a3SRobert Watson 1366d8a7b7a3SRobert Watson return (0); 1367d8a7b7a3SRobert Watson } 1368d8a7b7a3SRobert Watson 13697f724f8bSRobert Watson static int 1370177142e4SRobert Watson mac_test_check_vnode_write(struct ucred *active_cred, 1371177142e4SRobert Watson struct ucred *file_cred, struct vnode *vp, struct label *label) 13727f724f8bSRobert Watson { 13737f724f8bSRobert Watson 13747f724f8bSRobert Watson return (0); 13757f724f8bSRobert Watson } 13767f724f8bSRobert Watson 13775c8dd342SRobert Watson static struct mac_policy_ops mac_test_ops = 1378d8a7b7a3SRobert Watson { 13795c8dd342SRobert Watson .mpo_destroy = mac_test_destroy, 13805c8dd342SRobert Watson .mpo_init = mac_test_init, 13815c8dd342SRobert Watson .mpo_syscall = mac_test_syscall, 13825c8dd342SRobert Watson .mpo_init_bpfdesc_label = mac_test_init_bpfdesc_label, 13835c8dd342SRobert Watson .mpo_init_cred_label = mac_test_init_cred_label, 13845c8dd342SRobert Watson .mpo_init_devfsdirent_label = mac_test_init_devfsdirent_label, 13855c8dd342SRobert Watson .mpo_init_ifnet_label = mac_test_init_ifnet_label, 13865c8dd342SRobert Watson .mpo_init_ipq_label = mac_test_init_ipq_label, 13875c8dd342SRobert Watson .mpo_init_mbuf_label = mac_test_init_mbuf_label, 13885c8dd342SRobert Watson .mpo_init_mount_label = mac_test_init_mount_label, 13895c8dd342SRobert Watson .mpo_init_mount_fs_label = mac_test_init_mount_fs_label, 13905c8dd342SRobert Watson .mpo_init_pipe_label = mac_test_init_pipe_label, 1391ca26e8baSRobert Watson .mpo_init_proc_label = mac_test_init_proc_label, 13925c8dd342SRobert Watson .mpo_init_socket_label = mac_test_init_socket_label, 13935c8dd342SRobert Watson .mpo_init_socket_peer_label = mac_test_init_socket_peer_label, 13945c8dd342SRobert Watson .mpo_init_vnode_label = mac_test_init_vnode_label, 13955c8dd342SRobert Watson .mpo_destroy_bpfdesc_label = mac_test_destroy_bpfdesc_label, 13965c8dd342SRobert Watson .mpo_destroy_cred_label = mac_test_destroy_cred_label, 13975c8dd342SRobert Watson .mpo_destroy_devfsdirent_label = mac_test_destroy_devfsdirent_label, 13985c8dd342SRobert Watson .mpo_destroy_ifnet_label = mac_test_destroy_ifnet_label, 13995c8dd342SRobert Watson .mpo_destroy_ipq_label = mac_test_destroy_ipq_label, 14005c8dd342SRobert Watson .mpo_destroy_mbuf_label = mac_test_destroy_mbuf_label, 14015c8dd342SRobert Watson .mpo_destroy_mount_label = mac_test_destroy_mount_label, 14025c8dd342SRobert Watson .mpo_destroy_mount_fs_label = mac_test_destroy_mount_fs_label, 14035c8dd342SRobert Watson .mpo_destroy_pipe_label = mac_test_destroy_pipe_label, 1404ca26e8baSRobert Watson .mpo_destroy_proc_label = mac_test_destroy_proc_label, 14055c8dd342SRobert Watson .mpo_destroy_socket_label = mac_test_destroy_socket_label, 14065c8dd342SRobert Watson .mpo_destroy_socket_peer_label = mac_test_destroy_socket_peer_label, 14075c8dd342SRobert Watson .mpo_destroy_vnode_label = mac_test_destroy_vnode_label, 14085c8dd342SRobert Watson .mpo_externalize_cred_label = mac_test_externalize_label, 14095c8dd342SRobert Watson .mpo_externalize_ifnet_label = mac_test_externalize_label, 14105c8dd342SRobert Watson .mpo_externalize_pipe_label = mac_test_externalize_label, 14115c8dd342SRobert Watson .mpo_externalize_socket_label = mac_test_externalize_label, 14125c8dd342SRobert Watson .mpo_externalize_socket_peer_label = mac_test_externalize_label, 14135c8dd342SRobert Watson .mpo_externalize_vnode_label = mac_test_externalize_label, 14145c8dd342SRobert Watson .mpo_internalize_cred_label = mac_test_internalize_label, 14155c8dd342SRobert Watson .mpo_internalize_ifnet_label = mac_test_internalize_label, 14165c8dd342SRobert Watson .mpo_internalize_pipe_label = mac_test_internalize_label, 14175c8dd342SRobert Watson .mpo_internalize_socket_label = mac_test_internalize_label, 14185c8dd342SRobert Watson .mpo_internalize_vnode_label = mac_test_internalize_label, 14195c8dd342SRobert Watson .mpo_associate_vnode_devfs = mac_test_associate_vnode_devfs, 14205c8dd342SRobert Watson .mpo_associate_vnode_extattr = mac_test_associate_vnode_extattr, 14215c8dd342SRobert Watson .mpo_associate_vnode_singlelabel = mac_test_associate_vnode_singlelabel, 14225c8dd342SRobert Watson .mpo_create_devfs_device = mac_test_create_devfs_device, 14235c8dd342SRobert Watson .mpo_create_devfs_directory = mac_test_create_devfs_directory, 14245c8dd342SRobert Watson .mpo_create_devfs_symlink = mac_test_create_devfs_symlink, 14255c8dd342SRobert Watson .mpo_create_vnode_extattr = mac_test_create_vnode_extattr, 14265c8dd342SRobert Watson .mpo_create_mount = mac_test_create_mount, 14275c8dd342SRobert Watson .mpo_create_root_mount = mac_test_create_root_mount, 14285c8dd342SRobert Watson .mpo_relabel_vnode = mac_test_relabel_vnode, 14295c8dd342SRobert Watson .mpo_setlabel_vnode_extattr = mac_test_setlabel_vnode_extattr, 14305c8dd342SRobert Watson .mpo_update_devfsdirent = mac_test_update_devfsdirent, 14315c8dd342SRobert Watson .mpo_create_mbuf_from_socket = mac_test_create_mbuf_from_socket, 14325c8dd342SRobert Watson .mpo_create_pipe = mac_test_create_pipe, 14335c8dd342SRobert Watson .mpo_create_socket = mac_test_create_socket, 14345c8dd342SRobert Watson .mpo_create_socket_from_socket = mac_test_create_socket_from_socket, 14355c8dd342SRobert Watson .mpo_relabel_pipe = mac_test_relabel_pipe, 14365c8dd342SRobert Watson .mpo_relabel_socket = mac_test_relabel_socket, 14375c8dd342SRobert Watson .mpo_set_socket_peer_from_mbuf = mac_test_set_socket_peer_from_mbuf, 14385c8dd342SRobert Watson .mpo_set_socket_peer_from_socket = mac_test_set_socket_peer_from_socket, 14395c8dd342SRobert Watson .mpo_create_bpfdesc = mac_test_create_bpfdesc, 14405c8dd342SRobert Watson .mpo_create_ifnet = mac_test_create_ifnet, 14415c8dd342SRobert Watson .mpo_create_datagram_from_ipq = mac_test_create_datagram_from_ipq, 14425c8dd342SRobert Watson .mpo_create_fragment = mac_test_create_fragment, 14435c8dd342SRobert Watson .mpo_create_ipq = mac_test_create_ipq, 14445c8dd342SRobert Watson .mpo_create_mbuf_from_mbuf = mac_test_create_mbuf_from_mbuf, 14455c8dd342SRobert Watson .mpo_create_mbuf_linklayer = mac_test_create_mbuf_linklayer, 14465c8dd342SRobert Watson .mpo_create_mbuf_from_bpfdesc = mac_test_create_mbuf_from_bpfdesc, 14475c8dd342SRobert Watson .mpo_create_mbuf_from_ifnet = mac_test_create_mbuf_from_ifnet, 14485c8dd342SRobert Watson .mpo_create_mbuf_multicast_encap = mac_test_create_mbuf_multicast_encap, 14495c8dd342SRobert Watson .mpo_create_mbuf_netlayer = mac_test_create_mbuf_netlayer, 14505c8dd342SRobert Watson .mpo_fragment_match = mac_test_fragment_match, 14515c8dd342SRobert Watson .mpo_relabel_ifnet = mac_test_relabel_ifnet, 14525c8dd342SRobert Watson .mpo_update_ipq = mac_test_update_ipq, 14535c8dd342SRobert Watson .mpo_create_cred = mac_test_create_cred, 14545c8dd342SRobert Watson .mpo_execve_transition = mac_test_execve_transition, 14555c8dd342SRobert Watson .mpo_execve_will_transition = mac_test_execve_will_transition, 14565c8dd342SRobert Watson .mpo_create_proc0 = mac_test_create_proc0, 14575c8dd342SRobert Watson .mpo_create_proc1 = mac_test_create_proc1, 14585c8dd342SRobert Watson .mpo_relabel_cred = mac_test_relabel_cred, 1459ca26e8baSRobert Watson .mpo_thread_userret = mac_test_thread_userret, 14605c8dd342SRobert Watson .mpo_check_bpfdesc_receive = mac_test_check_bpfdesc_receive, 14615c8dd342SRobert Watson .mpo_check_cred_relabel = mac_test_check_cred_relabel, 14625c8dd342SRobert Watson .mpo_check_cred_visible = mac_test_check_cred_visible, 14635c8dd342SRobert Watson .mpo_check_ifnet_relabel = mac_test_check_ifnet_relabel, 14645c8dd342SRobert Watson .mpo_check_ifnet_transmit = mac_test_check_ifnet_transmit, 1465ca26e8baSRobert Watson .mpo_check_kenv_dump = mac_test_check_kenv_dump, 1466ca26e8baSRobert Watson .mpo_check_kenv_get = mac_test_check_kenv_get, 1467ca26e8baSRobert Watson .mpo_check_kenv_set = mac_test_check_kenv_set, 1468ca26e8baSRobert Watson .mpo_check_kenv_unset = mac_test_check_kenv_unset, 1469ca26e8baSRobert Watson .mpo_check_kld_load = mac_test_check_kld_load, 1470ca26e8baSRobert Watson .mpo_check_kld_stat = mac_test_check_kld_stat, 1471ca26e8baSRobert Watson .mpo_check_kld_unload = mac_test_check_kld_unload, 14725c8dd342SRobert Watson .mpo_check_mount_stat = mac_test_check_mount_stat, 14735c8dd342SRobert Watson .mpo_check_pipe_ioctl = mac_test_check_pipe_ioctl, 14745c8dd342SRobert Watson .mpo_check_pipe_poll = mac_test_check_pipe_poll, 14755c8dd342SRobert Watson .mpo_check_pipe_read = mac_test_check_pipe_read, 14765c8dd342SRobert Watson .mpo_check_pipe_relabel = mac_test_check_pipe_relabel, 14775c8dd342SRobert Watson .mpo_check_pipe_stat = mac_test_check_pipe_stat, 14785c8dd342SRobert Watson .mpo_check_pipe_write = mac_test_check_pipe_write, 14795c8dd342SRobert Watson .mpo_check_proc_debug = mac_test_check_proc_debug, 14805c8dd342SRobert Watson .mpo_check_proc_sched = mac_test_check_proc_sched, 14815c8dd342SRobert Watson .mpo_check_proc_signal = mac_test_check_proc_signal, 14825c8dd342SRobert Watson .mpo_check_socket_bind = mac_test_check_socket_bind, 14835c8dd342SRobert Watson .mpo_check_socket_connect = mac_test_check_socket_connect, 14845c8dd342SRobert Watson .mpo_check_socket_deliver = mac_test_check_socket_deliver, 14855c8dd342SRobert Watson .mpo_check_socket_listen = mac_test_check_socket_listen, 14865c8dd342SRobert Watson .mpo_check_socket_relabel = mac_test_check_socket_relabel, 14875c8dd342SRobert Watson .mpo_check_socket_visible = mac_test_check_socket_visible, 1488ca26e8baSRobert Watson .mpo_check_sysarch_ioperm = mac_test_check_sysarch_ioperm, 1489ca26e8baSRobert Watson .mpo_check_system_acct = mac_test_check_system_acct, 1490ca26e8baSRobert Watson .mpo_check_system_reboot = mac_test_check_system_reboot, 1491ca26e8baSRobert Watson .mpo_check_system_settime = mac_test_check_system_settime, 1492ca26e8baSRobert Watson .mpo_check_system_swapon = mac_test_check_system_swapon, 1493ca26e8baSRobert Watson .mpo_check_system_swapoff = mac_test_check_system_swapoff, 1494ca26e8baSRobert Watson .mpo_check_system_sysctl = mac_test_check_system_sysctl, 14955c8dd342SRobert Watson .mpo_check_vnode_access = mac_test_check_vnode_access, 14965c8dd342SRobert Watson .mpo_check_vnode_chdir = mac_test_check_vnode_chdir, 14975c8dd342SRobert Watson .mpo_check_vnode_chroot = mac_test_check_vnode_chroot, 14985c8dd342SRobert Watson .mpo_check_vnode_create = mac_test_check_vnode_create, 14995c8dd342SRobert Watson .mpo_check_vnode_delete = mac_test_check_vnode_delete, 15005c8dd342SRobert Watson .mpo_check_vnode_deleteacl = mac_test_check_vnode_deleteacl, 15015c8dd342SRobert Watson .mpo_check_vnode_exec = mac_test_check_vnode_exec, 15025c8dd342SRobert Watson .mpo_check_vnode_getacl = mac_test_check_vnode_getacl, 15035c8dd342SRobert Watson .mpo_check_vnode_getextattr = mac_test_check_vnode_getextattr, 15045c8dd342SRobert Watson .mpo_check_vnode_link = mac_test_check_vnode_link, 15055c8dd342SRobert Watson .mpo_check_vnode_lookup = mac_test_check_vnode_lookup, 15065c8dd342SRobert Watson .mpo_check_vnode_mmap = mac_test_check_vnode_mmap, 15075c8dd342SRobert Watson .mpo_check_vnode_mprotect = mac_test_check_vnode_mprotect, 15085c8dd342SRobert Watson .mpo_check_vnode_open = mac_test_check_vnode_open, 15095c8dd342SRobert Watson .mpo_check_vnode_poll = mac_test_check_vnode_poll, 15105c8dd342SRobert Watson .mpo_check_vnode_read = mac_test_check_vnode_read, 15115c8dd342SRobert Watson .mpo_check_vnode_readdir = mac_test_check_vnode_readdir, 15125c8dd342SRobert Watson .mpo_check_vnode_readlink = mac_test_check_vnode_readlink, 15135c8dd342SRobert Watson .mpo_check_vnode_relabel = mac_test_check_vnode_relabel, 15145c8dd342SRobert Watson .mpo_check_vnode_rename_from = mac_test_check_vnode_rename_from, 15155c8dd342SRobert Watson .mpo_check_vnode_rename_to = mac_test_check_vnode_rename_to, 15165c8dd342SRobert Watson .mpo_check_vnode_revoke = mac_test_check_vnode_revoke, 15175c8dd342SRobert Watson .mpo_check_vnode_setacl = mac_test_check_vnode_setacl, 15185c8dd342SRobert Watson .mpo_check_vnode_setextattr = mac_test_check_vnode_setextattr, 15195c8dd342SRobert Watson .mpo_check_vnode_setflags = mac_test_check_vnode_setflags, 15205c8dd342SRobert Watson .mpo_check_vnode_setmode = mac_test_check_vnode_setmode, 15215c8dd342SRobert Watson .mpo_check_vnode_setowner = mac_test_check_vnode_setowner, 15225c8dd342SRobert Watson .mpo_check_vnode_setutimes = mac_test_check_vnode_setutimes, 15235c8dd342SRobert Watson .mpo_check_vnode_stat = mac_test_check_vnode_stat, 15245c8dd342SRobert Watson .mpo_check_vnode_write = mac_test_check_vnode_write, 1525d8a7b7a3SRobert Watson }; 1526d8a7b7a3SRobert Watson 152778183ac2SRobert Watson MAC_POLICY_SET(&mac_test_ops, mac_test, "TrustedBSD MAC/Test", 15289a1b0237SRobert Watson MPC_LOADTIME_FLAG_UNLOADOK | MPC_LOADTIME_FLAG_LABELMBUFS, &test_slot); 1529