1 #include <errno.h> 2 #include <pthread.h> 3 #include <signal.h> 4 #include <stdio.h> 5 #include <string.h> 6 #include <unistd.h> 7 8 #include <mach/mach.h> 9 #include <mach/mach_traps.h> 10 #include <mach/mach_types.h> 11 12 #include <darwintest.h> 13 #include <darwintest_utils.h> 14 15 #include <sys/kern_debug.h> 16 17 T_GLOBAL_META( 18 T_META_NAMESPACE("xnu.debug"), 19 T_META_RADAR_COMPONENT_NAME("xnu"), 20 T_META_RADAR_COMPONENT_VERSION("arm"), 21 T_META_OWNER("joster"), 22 T_META_ENABLED(FALSE) 23 ); 24 25 T_DECL(debug_enable_syscall_rejection, 26 "Verify that syscall rejection works") 27 { 28 syscall_rejection_selector_t masks[] = { 29 SYSCALL_REJECTION_ALLOW(SYSCALL_REJECTION_ALL), 30 SYSCALL_REJECTION_DENY(2) 31 }; 32 33 int ret = debug_syscall_reject(masks, 2); 34 35 T_WITH_ERRNO; T_ASSERT_POSIX_SUCCESS(ret, "debug_syscall_reject"); 36 37 ret = chdir("/tmp"); 38 39 printf("chdir: %i\n", ret); 40 } 41