1*fdd8201dSApple OSS Distributions #include <sys/param.h>
2*fdd8201dSApple OSS Distributions #include <sys/systm.h> /* XXX printf() */
3*fdd8201dSApple OSS Distributions
4*fdd8201dSApple OSS Distributions #include <sys/types.h>
5*fdd8201dSApple OSS Distributions #include <sys/fcntl.h>
6*fdd8201dSApple OSS Distributions #include <sys/file.h>
7*fdd8201dSApple OSS Distributions #include <sys/kauth.h>
8*fdd8201dSApple OSS Distributions #include <sys/mount.h>
9*fdd8201dSApple OSS Distributions #include <sys/msg.h>
10*fdd8201dSApple OSS Distributions #include <sys/proc.h>
11*fdd8201dSApple OSS Distributions #include <sys/socketvar.h>
12*fdd8201dSApple OSS Distributions #include <sys/vnode.h>
13*fdd8201dSApple OSS Distributions #include <security/mac.h>
14*fdd8201dSApple OSS Distributions #include <security/mac_policy.h>
15*fdd8201dSApple OSS Distributions
16*fdd8201dSApple OSS Distributions #include <libkern/section_keywords.h>
17*fdd8201dSApple OSS Distributions #include <libkern/OSDebug.h> /* OSBPrintBacktrace */
18*fdd8201dSApple OSS Distributions
19*fdd8201dSApple OSS Distributions
20*fdd8201dSApple OSS Distributions /* forward declaration; see bsd_init.c */
21*fdd8201dSApple OSS Distributions errno_t check_policy_init(int);
22*fdd8201dSApple OSS Distributions int get_thread_lock_count(thread_t th); /* forced forward */
23*fdd8201dSApple OSS Distributions
24*fdd8201dSApple OSS Distributions /*
25*fdd8201dSApple OSS Distributions * Policy flags used when the policy is enabled
26*fdd8201dSApple OSS Distributions *
27*fdd8201dSApple OSS Distributions * Note: CHECK_POLICY_CHECK is probably not very useful unless you
28*fdd8201dSApple OSS Distributions * are kernel debugging and set a breakpoint.
29*fdd8201dSApple OSS Distributions */
30*fdd8201dSApple OSS Distributions #define CHECK_POLICY_CHECK 0x00000001 /* Check on calls */
31*fdd8201dSApple OSS Distributions #define CHECK_POLICY_FAIL 0x00000002 /* EPERM on fails */
32*fdd8201dSApple OSS Distributions #define CHECK_POLICY_BACKTRACE 0x00000004 /* Show call stack on fails */
33*fdd8201dSApple OSS Distributions #define CHECK_POLICY_PANIC 0x00000008 /* Panic on fails */
34*fdd8201dSApple OSS Distributions #define CHECK_POLICY_PERIODIC 0x00000010 /* Show fails periodically */
35*fdd8201dSApple OSS Distributions
36*fdd8201dSApple OSS Distributions static int policy_flags = 0;
37*fdd8201dSApple OSS Distributions
38*fdd8201dSApple OSS Distributions
39*fdd8201dSApple OSS Distributions #define CHECK_SET_HOOK(x) .mpo_##x = (mpo_##x##_t *)common_hook,
40*fdd8201dSApple OSS Distributions
41*fdd8201dSApple OSS Distributions /*
42*fdd8201dSApple OSS Distributions * Init; currently, we only print our arrival notice.
43*fdd8201dSApple OSS Distributions */
44*fdd8201dSApple OSS Distributions static void
hook_policy_init(struct mac_policy_conf * mpc)45*fdd8201dSApple OSS Distributions hook_policy_init(struct mac_policy_conf *mpc)
46*fdd8201dSApple OSS Distributions {
47*fdd8201dSApple OSS Distributions printf("Policy '%s' = '%s' ready\n", mpc->mpc_name, mpc->mpc_fullname);
48*fdd8201dSApple OSS Distributions }
49*fdd8201dSApple OSS Distributions
50*fdd8201dSApple OSS Distributions static void
hook_policy_initbsd(struct mac_policy_conf * mpc)51*fdd8201dSApple OSS Distributions hook_policy_initbsd(struct mac_policy_conf *mpc)
52*fdd8201dSApple OSS Distributions {
53*fdd8201dSApple OSS Distributions /* called with policy_grab_exclusive mutex held; exempt */
54*fdd8201dSApple OSS Distributions printf("hook_policy_initbsd: %s\n", mpc->mpc_name);
55*fdd8201dSApple OSS Distributions }
56*fdd8201dSApple OSS Distributions
57*fdd8201dSApple OSS Distributions
58*fdd8201dSApple OSS Distributions /* Implementation */
59*fdd8201dSApple OSS Distributions #define CLASS_PERIOD_LIMIT 10000
60*fdd8201dSApple OSS Distributions #define CLASS_PERIOD_MULT 20
61*fdd8201dSApple OSS Distributions
62*fdd8201dSApple OSS Distributions static int policy_check_event = 1;
63*fdd8201dSApple OSS Distributions static int policy_check_period = 1;
64*fdd8201dSApple OSS Distributions static int policy_check_next = CLASS_PERIOD_MULT;
65*fdd8201dSApple OSS Distributions
66*fdd8201dSApple OSS Distributions
67*fdd8201dSApple OSS Distributions static int
common_hook(void)68*fdd8201dSApple OSS Distributions common_hook(void)
69*fdd8201dSApple OSS Distributions {
70*fdd8201dSApple OSS Distributions int i;
71*fdd8201dSApple OSS Distributions int rv = 0;
72*fdd8201dSApple OSS Distributions
73*fdd8201dSApple OSS Distributions if ((i = get_thread_lock_count(current_thread())) != 0) {
74*fdd8201dSApple OSS Distributions /*
75*fdd8201dSApple OSS Distributions * fail the MACF check if we hold a lock; this assumes a
76*fdd8201dSApple OSS Distributions * a non-void (authorization) MACF hook.
77*fdd8201dSApple OSS Distributions */
78*fdd8201dSApple OSS Distributions if (policy_flags & CHECK_POLICY_FAIL) {
79*fdd8201dSApple OSS Distributions rv = EPERM;
80*fdd8201dSApple OSS Distributions }
81*fdd8201dSApple OSS Distributions
82*fdd8201dSApple OSS Distributions /*
83*fdd8201dSApple OSS Distributions * display a backtrace if we hold a lock and we are not
84*fdd8201dSApple OSS Distributions * going to panic
85*fdd8201dSApple OSS Distributions */
86*fdd8201dSApple OSS Distributions if ((policy_flags & (CHECK_POLICY_BACKTRACE | CHECK_POLICY_PANIC)) == CHECK_POLICY_BACKTRACE) {
87*fdd8201dSApple OSS Distributions if (policy_flags & CHECK_POLICY_PERIODIC) {
88*fdd8201dSApple OSS Distributions /* at exponentially increasing intervals */
89*fdd8201dSApple OSS Distributions if (!(policy_check_event % policy_check_period)) {
90*fdd8201dSApple OSS Distributions if (policy_check_event <= policy_check_next || policy_check_period == CLASS_PERIOD_LIMIT) {
91*fdd8201dSApple OSS Distributions /*
92*fdd8201dSApple OSS Distributions * According to Derek, we could
93*fdd8201dSApple OSS Distributions * technically get a symbolicated name
94*fdd8201dSApple OSS Distributions * here, if we refactered some code
95*fdd8201dSApple OSS Distributions * and set the "keepsyms=1" boot
96*fdd8201dSApple OSS Distributions * argument...
97*fdd8201dSApple OSS Distributions */
98*fdd8201dSApple OSS Distributions OSReportWithBacktrace("calling MACF hook with mutex count %d (event %d) ", i, policy_check_event);
99*fdd8201dSApple OSS Distributions }
100*fdd8201dSApple OSS Distributions } else {
101*fdd8201dSApple OSS Distributions if (policy_check_period < CLASS_PERIOD_LIMIT) {
102*fdd8201dSApple OSS Distributions policy_check_next *= CLASS_PERIOD_MULT;
103*fdd8201dSApple OSS Distributions policy_check_period *= CLASS_PERIOD_MULT;
104*fdd8201dSApple OSS Distributions }
105*fdd8201dSApple OSS Distributions }
106*fdd8201dSApple OSS Distributions } else {
107*fdd8201dSApple OSS Distributions /* always */
108*fdd8201dSApple OSS Distributions OSReportWithBacktrace("calling MACF hook with mutex count %d (event %d) ", i, policy_check_event);
109*fdd8201dSApple OSS Distributions }
110*fdd8201dSApple OSS Distributions }
111*fdd8201dSApple OSS Distributions
112*fdd8201dSApple OSS Distributions /* Panic */
113*fdd8201dSApple OSS Distributions if (policy_flags & CHECK_POLICY_PANIC) {
114*fdd8201dSApple OSS Distributions panic("calling MACF hook with mutex count %d", i);
115*fdd8201dSApple OSS Distributions }
116*fdd8201dSApple OSS Distributions
117*fdd8201dSApple OSS Distributions /* count for non-fatal tracing */
118*fdd8201dSApple OSS Distributions policy_check_event++;
119*fdd8201dSApple OSS Distributions }
120*fdd8201dSApple OSS Distributions
121*fdd8201dSApple OSS Distributions return rv;
122*fdd8201dSApple OSS Distributions }
123*fdd8201dSApple OSS Distributions
124*fdd8201dSApple OSS Distributions #if (MAC_POLICY_OPS_VERSION != 80)
125*fdd8201dSApple OSS Distributions # error "struct mac_policy_ops doesn't match definition in mac_policy.h"
126*fdd8201dSApple OSS Distributions #endif
127*fdd8201dSApple OSS Distributions /*
128*fdd8201dSApple OSS Distributions * Policy hooks; one per possible hook
129*fdd8201dSApple OSS Distributions *
130*fdd8201dSApple OSS Distributions * Please note that this struct initialization should be kept in sync with
131*fdd8201dSApple OSS Distributions * security/mac_policy.h (mac_policy_ops struct definition).
132*fdd8201dSApple OSS Distributions */
133*fdd8201dSApple OSS Distributions const static struct mac_policy_ops policy_ops = {
134*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(audit_check_postselect)
135*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(audit_check_preselect)
136*fdd8201dSApple OSS Distributions
137*fdd8201dSApple OSS Distributions .mpo_reserved01 = (mpo_reserved_hook_t *)common_hook,
138*fdd8201dSApple OSS Distributions .mpo_reserved02 = (mpo_reserved_hook_t *)common_hook,
139*fdd8201dSApple OSS Distributions .mpo_reserved03 = (mpo_reserved_hook_t *)common_hook,
140*fdd8201dSApple OSS Distributions .mpo_reserved04 = (mpo_reserved_hook_t *)common_hook,
141*fdd8201dSApple OSS Distributions
142*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(cred_check_label_update_execve)
143*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(cred_check_label_update)
144*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(cred_check_visible)
145*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(cred_label_associate_fork)
146*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(cred_label_associate_kernel)
147*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(cred_label_associate)
148*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(cred_label_associate_user)
149*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(cred_label_destroy)
150*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(cred_label_externalize_audit)
151*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(cred_label_externalize)
152*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(cred_label_init)
153*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(cred_label_internalize)
154*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(cred_label_update_execve)
155*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(cred_label_update)
156*fdd8201dSApple OSS Distributions
157*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(devfs_label_associate_device)
158*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(devfs_label_associate_directory)
159*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(devfs_label_copy)
160*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(devfs_label_destroy)
161*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(devfs_label_init)
162*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(devfs_label_update)
163*fdd8201dSApple OSS Distributions
164*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(file_check_change_offset)
165*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(file_check_create)
166*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(file_check_dup)
167*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(file_check_fcntl)
168*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(file_check_get_offset)
169*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(file_check_get)
170*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(file_check_inherit)
171*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(file_check_ioctl)
172*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(file_check_lock)
173*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(file_check_mmap_downgrade)
174*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(file_check_mmap)
175*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(file_check_receive)
176*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(file_check_set)
177*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(file_label_init)
178*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(file_label_destroy)
179*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(file_label_associate)
180*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(file_notify_close)
181*fdd8201dSApple OSS Distributions
182*fdd8201dSApple OSS Distributions .mpo_reserved06 = (mpo_reserved_hook_t *)common_hook,
183*fdd8201dSApple OSS Distributions .mpo_reserved07 = (mpo_reserved_hook_t *)common_hook,
184*fdd8201dSApple OSS Distributions .mpo_reserved08 = (mpo_reserved_hook_t *)common_hook,
185*fdd8201dSApple OSS Distributions .mpo_reserved09 = (mpo_reserved_hook_t *)common_hook,
186*fdd8201dSApple OSS Distributions .mpo_reserved10 = (mpo_reserved_hook_t *)common_hook,
187*fdd8201dSApple OSS Distributions .mpo_reserved11 = (mpo_reserved_hook_t *)common_hook,
188*fdd8201dSApple OSS Distributions .mpo_reserved12 = (mpo_reserved_hook_t *)common_hook,
189*fdd8201dSApple OSS Distributions .mpo_reserved13 = (mpo_reserved_hook_t *)common_hook,
190*fdd8201dSApple OSS Distributions .mpo_reserved14 = (mpo_reserved_hook_t *)common_hook,
191*fdd8201dSApple OSS Distributions .mpo_reserved15 = (mpo_reserved_hook_t *)common_hook,
192*fdd8201dSApple OSS Distributions .mpo_reserved16 = (mpo_reserved_hook_t *)common_hook,
193*fdd8201dSApple OSS Distributions .mpo_reserved17 = (mpo_reserved_hook_t *)common_hook,
194*fdd8201dSApple OSS Distributions .mpo_reserved18 = (mpo_reserved_hook_t *)common_hook,
195*fdd8201dSApple OSS Distributions .mpo_reserved19 = (mpo_reserved_hook_t *)common_hook,
196*fdd8201dSApple OSS Distributions .mpo_reserved20 = (mpo_reserved_hook_t *)common_hook,
197*fdd8201dSApple OSS Distributions .mpo_reserved21 = (mpo_reserved_hook_t *)common_hook,
198*fdd8201dSApple OSS Distributions .mpo_reserved22 = (mpo_reserved_hook_t *)common_hook,
199*fdd8201dSApple OSS Distributions .mpo_reserved23 = (mpo_reserved_hook_t *)common_hook,
200*fdd8201dSApple OSS Distributions .mpo_reserved24 = (mpo_reserved_hook_t *)common_hook,
201*fdd8201dSApple OSS Distributions
202*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(necp_check_open)
203*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(necp_check_client_action)
204*fdd8201dSApple OSS Distributions
205*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(file_check_library_validation)
206*fdd8201dSApple OSS Distributions
207*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(vnode_notify_setacl)
208*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(vnode_notify_setattrlist)
209*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(vnode_notify_setextattr)
210*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(vnode_notify_setflags)
211*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(vnode_notify_setmode)
212*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(vnode_notify_setowner)
213*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(vnode_notify_setutimes)
214*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(vnode_notify_truncate)
215*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(vnode_check_getattrlistbulk)
216*fdd8201dSApple OSS Distributions
217*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(proc_check_get_task_special_port)
218*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(proc_check_set_task_special_port)
219*fdd8201dSApple OSS Distributions
220*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(vnode_notify_swap)
221*fdd8201dSApple OSS Distributions
222*fdd8201dSApple OSS Distributions .mpo_reserved31 = (mpo_reserved_hook_t *)common_hook,
223*fdd8201dSApple OSS Distributions .mpo_reserved32 = (mpo_reserved_hook_t *)common_hook,
224*fdd8201dSApple OSS Distributions .mpo_reserved33 = (mpo_reserved_hook_t *)common_hook,
225*fdd8201dSApple OSS Distributions .mpo_reserved34 = (mpo_reserved_hook_t *)common_hook,
226*fdd8201dSApple OSS Distributions .mpo_reserved35 = (mpo_reserved_hook_t *)common_hook,
227*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(vnode_check_copyfile)
228*fdd8201dSApple OSS Distributions
229*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(mount_check_quotactl)
230*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(mount_check_fsctl)
231*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(mount_check_getattr)
232*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(mount_check_label_update)
233*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(mount_check_mount)
234*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(mount_check_remount)
235*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(mount_check_setattr)
236*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(mount_check_stat)
237*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(mount_check_umount)
238*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(mount_label_associate)
239*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(mount_label_destroy)
240*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(mount_label_externalize)
241*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(mount_label_init)
242*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(mount_label_internalize)
243*fdd8201dSApple OSS Distributions
244*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(proc_check_expose_task_with_flavor)
245*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(proc_check_get_task_with_flavor)
246*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(proc_check_task_id_token_get_task)
247*fdd8201dSApple OSS Distributions
248*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(pipe_check_ioctl)
249*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(pipe_check_kqfilter)
250*fdd8201dSApple OSS Distributions .mpo_reserved41 = (mpo_reserved_hook_t *)common_hook,
251*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(pipe_check_read)
252*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(pipe_check_select)
253*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(pipe_check_stat)
254*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(pipe_check_write)
255*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(pipe_label_associate)
256*fdd8201dSApple OSS Distributions .mpo_reserved42 = (mpo_reserved_hook_t *)common_hook,
257*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(pipe_label_destroy)
258*fdd8201dSApple OSS Distributions .mpo_reserved43 = (mpo_reserved_hook_t *)common_hook,
259*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(pipe_label_init)
260*fdd8201dSApple OSS Distributions .mpo_reserved44 = (mpo_reserved_hook_t *)common_hook,
261*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(proc_check_syscall_mac)
262*fdd8201dSApple OSS Distributions
263*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(policy_destroy)
264*fdd8201dSApple OSS Distributions /* special hooks for policy init's */
265*fdd8201dSApple OSS Distributions .mpo_policy_init = hook_policy_init,
266*fdd8201dSApple OSS Distributions .mpo_policy_initbsd = hook_policy_initbsd,
267*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(policy_syscall)
268*fdd8201dSApple OSS Distributions
269*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(system_check_sysctlbyname)
270*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(proc_check_inherit_ipc_ports)
271*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(vnode_check_rename)
272*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(kext_check_query)
273*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(proc_notify_exec_complete)
274*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(proc_notify_cs_invalidated)
275*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(proc_check_syscall_unix)
276*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(proc_check_expose_task)
277*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(proc_check_set_host_special_port)
278*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(proc_check_set_host_exception_port)
279*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(exc_action_check_exception_send)
280*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(exc_action_label_associate)
281*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(exc_action_label_populate)
282*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(exc_action_label_destroy)
283*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(exc_action_label_init)
284*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(exc_action_label_update)
285*fdd8201dSApple OSS Distributions
286*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(vnode_check_trigger_resolve)
287*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(mount_check_mount_late)
288*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(mount_check_snapshot_mount)
289*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(vnode_notify_reclaim)
290*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(skywalk_flow_check_connect)
291*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(skywalk_flow_check_listen)
292*fdd8201dSApple OSS Distributions
293*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(posixsem_check_create)
294*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(posixsem_check_open)
295*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(posixsem_check_post)
296*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(posixsem_check_unlink)
297*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(posixsem_check_wait)
298*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(posixsem_label_associate)
299*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(posixsem_label_destroy)
300*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(posixsem_label_init)
301*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(posixshm_check_create)
302*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(posixshm_check_mmap)
303*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(posixshm_check_open)
304*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(posixshm_check_stat)
305*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(posixshm_check_truncate)
306*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(posixshm_check_unlink)
307*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(posixshm_label_associate)
308*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(posixshm_label_destroy)
309*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(posixshm_label_init)
310*fdd8201dSApple OSS Distributions
311*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(proc_check_debug)
312*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(proc_check_fork)
313*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(proc_check_get_task_name)
314*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(proc_check_get_task)
315*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(proc_check_getaudit)
316*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(proc_check_getauid)
317*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(proc_check_getlcid)
318*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(proc_check_mprotect)
319*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(proc_check_sched)
320*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(proc_check_setaudit)
321*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(proc_check_setauid)
322*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(proc_check_setlcid)
323*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(proc_check_signal)
324*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(proc_check_wait)
325*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(proc_check_dump_core)
326*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(proc_check_remote_thread_create)
327*fdd8201dSApple OSS Distributions
328*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(socket_check_accept)
329*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(socket_check_accepted)
330*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(socket_check_bind)
331*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(socket_check_connect)
332*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(socket_check_create)
333*fdd8201dSApple OSS Distributions .mpo_reserved46 = (mpo_reserved_hook_t *)common_hook,
334*fdd8201dSApple OSS Distributions .mpo_reserved47 = (mpo_reserved_hook_t *)common_hook,
335*fdd8201dSApple OSS Distributions .mpo_reserved48 = (mpo_reserved_hook_t *)common_hook,
336*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(socket_check_listen)
337*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(socket_check_receive)
338*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(socket_check_received)
339*fdd8201dSApple OSS Distributions .mpo_reserved49 = (mpo_reserved_hook_t *)common_hook,
340*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(socket_check_send)
341*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(socket_check_stat)
342*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(socket_check_setsockopt)
343*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(socket_check_getsockopt)
344*fdd8201dSApple OSS Distributions
345*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(proc_check_get_movable_control_port)
346*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(proc_check_dyld_process_info_notify_register)
347*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(proc_check_setuid)
348*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(proc_check_seteuid)
349*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(proc_check_setreuid)
350*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(proc_check_setgid)
351*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(proc_check_setegid)
352*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(proc_check_setregid)
353*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(proc_check_settid)
354*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(proc_check_memorystatus_control)
355*fdd8201dSApple OSS Distributions
356*fdd8201dSApple OSS Distributions .mpo_reserved60 = (mpo_reserved_hook_t *)common_hook,
357*fdd8201dSApple OSS Distributions
358*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(thread_telemetry)
359*fdd8201dSApple OSS Distributions
360*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(iokit_check_open_service)
361*fdd8201dSApple OSS Distributions
362*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(system_check_acct)
363*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(system_check_audit)
364*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(system_check_auditctl)
365*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(system_check_auditon)
366*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(system_check_host_priv)
367*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(system_check_nfsd)
368*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(system_check_reboot)
369*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(system_check_settime)
370*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(system_check_swapoff)
371*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(system_check_swapon)
372*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(socket_check_ioctl)
373*fdd8201dSApple OSS Distributions
374*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(sysvmsg_label_associate)
375*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(sysvmsg_label_destroy)
376*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(sysvmsg_label_init)
377*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(sysvmsg_label_recycle)
378*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(sysvmsq_check_enqueue)
379*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(sysvmsq_check_msgrcv)
380*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(sysvmsq_check_msgrmid)
381*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(sysvmsq_check_msqctl)
382*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(sysvmsq_check_msqget)
383*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(sysvmsq_check_msqrcv)
384*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(sysvmsq_check_msqsnd)
385*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(sysvmsq_label_associate)
386*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(sysvmsq_label_destroy)
387*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(sysvmsq_label_init)
388*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(sysvmsq_label_recycle)
389*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(sysvsem_check_semctl)
390*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(sysvsem_check_semget)
391*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(sysvsem_check_semop)
392*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(sysvsem_label_associate)
393*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(sysvsem_label_destroy)
394*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(sysvsem_label_init)
395*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(sysvsem_label_recycle)
396*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(sysvshm_check_shmat)
397*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(sysvshm_check_shmctl)
398*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(sysvshm_check_shmdt)
399*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(sysvshm_check_shmget)
400*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(sysvshm_label_associate)
401*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(sysvshm_label_destroy)
402*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(sysvshm_label_init)
403*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(sysvshm_label_recycle)
404*fdd8201dSApple OSS Distributions
405*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(proc_notify_exit)
406*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(mount_check_snapshot_revert)
407*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(vnode_check_getattr)
408*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(mount_check_snapshot_create)
409*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(mount_check_snapshot_delete)
410*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(vnode_check_clone)
411*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(proc_check_get_cs_info)
412*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(proc_check_set_cs_info)
413*fdd8201dSApple OSS Distributions
414*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(iokit_check_hid_control)
415*fdd8201dSApple OSS Distributions
416*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(vnode_check_access)
417*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(vnode_check_chdir)
418*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(vnode_check_chroot)
419*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(vnode_check_create)
420*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(vnode_check_deleteextattr)
421*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(vnode_check_exchangedata)
422*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(vnode_check_exec)
423*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(vnode_check_getattrlist)
424*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(vnode_check_getextattr)
425*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(vnode_check_ioctl)
426*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(vnode_check_kqfilter)
427*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(vnode_check_label_update)
428*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(vnode_check_link)
429*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(vnode_check_listextattr)
430*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(vnode_check_lookup)
431*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(vnode_check_open)
432*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(vnode_check_read)
433*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(vnode_check_readdir)
434*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(vnode_check_readlink)
435*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(vnode_check_rename_from)
436*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(vnode_check_rename_to)
437*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(vnode_check_revoke)
438*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(vnode_check_select)
439*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(vnode_check_setattrlist)
440*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(vnode_check_setextattr)
441*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(vnode_check_setflags)
442*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(vnode_check_setmode)
443*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(vnode_check_setowner)
444*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(vnode_check_setutimes)
445*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(vnode_check_stat)
446*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(vnode_check_truncate)
447*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(vnode_check_unlink)
448*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(vnode_check_write)
449*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(vnode_label_associate_devfs)
450*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(vnode_label_associate_extattr)
451*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(vnode_label_associate_file)
452*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(vnode_label_associate_pipe)
453*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(vnode_label_associate_posixsem)
454*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(vnode_label_associate_posixshm)
455*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(vnode_label_associate_singlelabel)
456*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(vnode_label_associate_socket)
457*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(vnode_label_copy)
458*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(vnode_label_destroy)
459*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(vnode_label_externalize_audit)
460*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(vnode_label_externalize)
461*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(vnode_label_init)
462*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(vnode_label_internalize)
463*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(vnode_label_recycle)
464*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(vnode_label_store)
465*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(vnode_label_update_extattr)
466*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(vnode_label_update)
467*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(vnode_notify_create)
468*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(vnode_check_signature)
469*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(vnode_check_uipc_bind)
470*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(vnode_check_uipc_connect)
471*fdd8201dSApple OSS Distributions
472*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(proc_check_run_cs_invalid)
473*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(proc_check_suspend_resume)
474*fdd8201dSApple OSS Distributions
475*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(thread_userret)
476*fdd8201dSApple OSS Distributions
477*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(iokit_check_set_properties)
478*fdd8201dSApple OSS Distributions
479*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(vnode_check_supplemental_signature)
480*fdd8201dSApple OSS Distributions
481*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(vnode_check_searchfs)
482*fdd8201dSApple OSS Distributions
483*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(priv_check)
484*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(priv_grant)
485*fdd8201dSApple OSS Distributions
486*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(proc_check_map_anon)
487*fdd8201dSApple OSS Distributions
488*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(vnode_check_fsgetpath)
489*fdd8201dSApple OSS Distributions
490*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(iokit_check_open)
491*fdd8201dSApple OSS Distributions
492*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(proc_check_ledger)
493*fdd8201dSApple OSS Distributions
494*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(vnode_notify_rename)
495*fdd8201dSApple OSS Distributions
496*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(vnode_check_setacl)
497*fdd8201dSApple OSS Distributions
498*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(vnode_notify_deleteextattr)
499*fdd8201dSApple OSS Distributions
500*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(system_check_kas_info)
501*fdd8201dSApple OSS Distributions
502*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(vnode_check_lookup_preflight)
503*fdd8201dSApple OSS Distributions
504*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(vnode_notify_open)
505*fdd8201dSApple OSS Distributions
506*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(system_check_info)
507*fdd8201dSApple OSS Distributions
508*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(pty_notify_grant)
509*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(pty_notify_close)
510*fdd8201dSApple OSS Distributions
511*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(vnode_find_sigs)
512*fdd8201dSApple OSS Distributions
513*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(kext_check_load)
514*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(kext_check_unload)
515*fdd8201dSApple OSS Distributions
516*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(proc_check_proc_info)
517*fdd8201dSApple OSS Distributions
518*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(vnode_notify_link)
519*fdd8201dSApple OSS Distributions
520*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(iokit_check_filter_properties)
521*fdd8201dSApple OSS Distributions CHECK_SET_HOOK(iokit_check_get_property)
522*fdd8201dSApple OSS Distributions };
523*fdd8201dSApple OSS Distributions
524*fdd8201dSApple OSS Distributions /*
525*fdd8201dSApple OSS Distributions * Policy definition
526*fdd8201dSApple OSS Distributions */
527*fdd8201dSApple OSS Distributions static SECURITY_READ_ONLY_LATE(struct mac_policy_conf) policy_conf = {
528*fdd8201dSApple OSS Distributions .mpc_name = "CHECK",
529*fdd8201dSApple OSS Distributions .mpc_fullname = "Check Assumptions Policy",
530*fdd8201dSApple OSS Distributions .mpc_field_off = NULL, /* no label slot */
531*fdd8201dSApple OSS Distributions .mpc_labelnames = NULL, /* no policy label names */
532*fdd8201dSApple OSS Distributions .mpc_labelname_count = 0, /* count of label names is 0 */
533*fdd8201dSApple OSS Distributions .mpc_ops = &policy_ops, /* policy operations */
534*fdd8201dSApple OSS Distributions .mpc_loadtime_flags = 0,
535*fdd8201dSApple OSS Distributions .mpc_runtime_flags = 0,
536*fdd8201dSApple OSS Distributions };
537*fdd8201dSApple OSS Distributions
538*fdd8201dSApple OSS Distributions static SECURITY_READ_ONLY_LATE(mac_policy_handle_t) policy_handle;
539*fdd8201dSApple OSS Distributions
540*fdd8201dSApple OSS Distributions /*
541*fdd8201dSApple OSS Distributions * Init routine; for a loadable policy, this would be called during the KEXT
542*fdd8201dSApple OSS Distributions * initialization; we're going to call this from bsd_init() if the boot
543*fdd8201dSApple OSS Distributions * argument for checking is present.
544*fdd8201dSApple OSS Distributions */
545*fdd8201dSApple OSS Distributions errno_t
check_policy_init(int flags)546*fdd8201dSApple OSS Distributions check_policy_init(int flags)
547*fdd8201dSApple OSS Distributions {
548*fdd8201dSApple OSS Distributions /* Only instantiate the module if we have been asked to do checking */
549*fdd8201dSApple OSS Distributions if (!flags) {
550*fdd8201dSApple OSS Distributions return 0;
551*fdd8201dSApple OSS Distributions }
552*fdd8201dSApple OSS Distributions
553*fdd8201dSApple OSS Distributions policy_flags = flags;
554*fdd8201dSApple OSS Distributions
555*fdd8201dSApple OSS Distributions return mac_policy_register(&policy_conf, &policy_handle, NULL);
556*fdd8201dSApple OSS Distributions }
557