]> git.saurik.com Git - apple/xnu.git/blob - tests/shared_cache_reslide_test.c
0c6a498fd6048504f3b484503c1058df986a0f2a
[apple/xnu.git] / tests / shared_cache_reslide_test.c
1 #define PRIVATE
2 #include <darwintest.h>
3
4 #include <errno.h>
5 #include <fcntl.h>
6 #include <signal.h>
7 #include <spawn.h>
8 #include <spawn_private.h>
9 #include <stdbool.h>
10 #include <stdint.h>
11 #include <stdio.h>
12 #include <stdlib.h>
13 #include <string.h>
14 #include <sys/spawn_internal.h>
15 #include <sys/sysctl.h>
16 #include <sys/syslimits.h>
17 #include <sys/reason.h>
18 #include <sysexits.h>
19 #include <unistd.h>
20 #include <signal.h>
21 #include <libproc.h>
22 #undef PRIVATE
23
24 #include <mach-o/dyld.h>
25 #include <mach-o/dyld_priv.h>
26 #include <dlfcn.h>
27
28 #define SHARED_CACHE_HELPER "get_shared_cache_address"
29 #define DO_RUSAGE_CHECK "check_rusage_flag"
30 #define DO_DUMMY "dummy"
31 #define ADDRESS_OUTPUT_SIZE 12L
32
33 #ifndef _POSIX_SPAWN_RESLIDE
34 #define _POSIX_SPAWN_RESLIDE 0x0800
35 #endif
36
37 #ifndef OS_REASON_FLAG_SHAREDREGION_FAULT
38 #define OS_REASON_FLAG_SHAREDREGION_FAULT 0x400
39 #endif
40
41 T_GLOBAL_META(T_META_RUN_CONCURRENTLY(true));
42
43
44 T_DECL(reslide_sharedcache, "crash induced reslide of the shared cache",
45 T_META_CHECK_LEAKS(false), T_META_IGNORECRASHES(".*shared_cache_reslide_test.*"),
46 T_META_ASROOT(true))
47 {
48 T_SKIP("shared cache reslide is currently only supported on arm64e iPhones");
49 }