]> git.saurik.com Git - apple/dyld.git/blob - testing/kernel-cache-tests/rwx-permissions-error/test.py
dyld-851.27.tar.gz
[apple/dyld.git] / testing / kernel-cache-tests / rwx-permissions-error / test.py
1 #!/usr/bin/python2.7
2
3 import os
4 import KernelCollection
5
6 # Check errors from canBePlacedInKernelCollection()
7 # All arm64* binaries cannot use RWX permissions
8
9 def check(kernel_cache):
10 kernel_cache.buildKernelCollection("arm64", "/rwx-permissions-error/main.kc", "/rwx-permissions-error/main.kernel", "", [], ["-json-errors"])
11 assert len(kernel_cache.dictionary()) == 1
12 # kernel
13 assert kernel_cache.dictionary()[0]["id"] == "com.apple.kernel"
14 assert len(kernel_cache.dictionary()[0]["errors"]) == 1
15 assert kernel_cache.dictionary()[0]["errors"][0] == "cannot be placed in kernel collection because: Segments are not allowed to be both writable and executable"
16
17
18 # [~]> xcrun -sdk iphoneos cc -arch arm64 -Wl,-static -mkernel -nostdlib -Wl,-add_split_seg_info -Wl,-rename_section,__TEXT,__text,__TEXT_EXEC,__text -Wl,-e,__start -Wl,-pagezero_size,0x0 -Wl,-pie -segprot __RWX rwx rwx main.c -o main.kernel
19