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