]>
git.saurik.com Git - apple/xnu.git/blob - tests/restrict_jit.c
3 #include <sys/sysctl.h>
6 #include <darwintest.h>
10 * macOS only test. Try to map 2 different MAP_JIT regions. 2nd should fail.
12 T_DECL(restrict_jit
, "macOS restricted JIT entitlement test")
17 size_t size
= 64 * 1024;
20 addr1
= mmap(NULL
, size
, PROT_READ
| PROT_WRITE
| PROT_EXEC
, MAP_ANON
| MAP_PRIVATE
| MAP_JIT
, -1, 0);
21 T_ASSERT_NE_PTR(addr1
, MAP_FAILED
, "First map MAP_JIT");
23 addr2
= mmap(NULL
, size
, PROT_READ
| PROT_WRITE
| PROT_EXEC
, MAP_ANON
| MAP_PRIVATE
| MAP_JIT
, -1, 0);
24 if (addr2
== MAP_FAILED
) {
25 T_PASS("Only one MAP_JIT was allowed");
27 T_FAIL("Second MAP_JIT was allowed");