- MACHDBG_CODE(DBG_MACH_EXCP_SC, (call_number)) | DBG_FUNC_START,
- args.arg1, args.arg2, args.arg3, args.arg4, 0);
+ MACHDBG_CODE(DBG_MACH_EXCP_SC, (call_number)) | DBG_FUNC_START,
+ args.arg1, args.arg2, args.arg3, args.arg4, 0);
+
+#if CONFIG_MACF
+ /* Check mach trap filter mask, if exists. */
+ task_t task = current_task();
+ uint8_t *filter_mask = task->mach_trap_filter_mask;
+
+ if (__improbable(filter_mask != NULL &&
+ !bitstr_test(filter_mask, call_number))) {
+ /* Not in filter mask, evaluate policy. */
+ if (mac_task_mach_trap_evaluate != NULL) {
+ retval = mac_task_mach_trap_evaluate(get_bsdtask_info(task),
+ call_number);
+ if (retval) {
+ goto skip_machcall;
+ }
+ }
+ }
+#endif /* CONFIG_MACF */