Created
March 26, 2025 00:13
-
-
Save m1guelpf/f119fb32ec0d6853c46a043db8c43614 to your computer and use it in GitHub Desktop.
Disallow debugging an iOS app on production
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#if !DEBUG && (defined(__arm64__) || defined(__aarch64__)) | |
void __attribute__((constructor)) security_setup(void) { | |
long PTRACE_SYSCALL = 26; | |
long PT_DENY_ATTACH = 31; | |
asm volatile( | |
"mov x0, %1\n" | |
"mov x1, #0\n" | |
"mov x2, #0\n" | |
"mov x3, #0\n" | |
"mov x16, %0\n" | |
"svc #0x80\n" | |
: | |
: "r" (PTRACE_SYSCALL), "r" (PT_DENY_ATTACH) | |
: "x0", "x1", "x2", "x3", "x16" | |
); | |
} | |
#endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment