You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[macOS arm64] gum_darwin_query_page_size() returns 16 KB (0x4000) for Rosetta 2 (x86_64) processes, causing gum_darwin_read() to fail with KERN_INVALID_ADDRESS #1193
OS: macOS 26.6.2 (25G83, Darwin 25.6.0, xnu-12377.161.14~5/RELEASE_ARM64_T6050)
SIP / Boot-args: SIP disabled, boot-args="-arm64e_preview_abi thid_should_crash=0 tss_should_crash=0", target signed with com.apple.security.cs.debugger
Problem 1: gum_darwin_query_page_size() returns 0x4000 instead of 0x1000 for Rosetta (P_TRANSLATED) tasks
When attaching to a Rosetta-translated x86_64 process from arm64 Frida (frida.attach(pid)), frida-helper-arm64 fails in gum_darwin_module_resolver_load_from_dyld_info() with:
frida.NotSupportedError: unable to read from process memory
In the target Rosetta process (vmmap), a dylib (fcntl.cpython-310-darwin.so) is mapped on a 4 KB (0x1000) boundary at 0x404c7000, with an unmapped 8 KB hole immediately preceding it (0x404c5000–0x404c7000):
gum_darwin_query_page_size() calls gum_darwin_cpu_type_from_pid(pid, &cpu_type) and sets *page_size = 4096 if cpu_type is GUM_CPU_IA32 (1) or GUM_CPU_AMD64 (2), and 16384 (0x4000) if cpu_type is GUM_CPU_ARM64 (4).
However, in arm64 builds (#elif defined (HAVE_ARM) || defined (HAVE_ARM64)), gum_darwin_cpu_type_from_pid() only checks P_LP64 (0x4) in info.kp_proc.p_flag and ignores P_TRANSLATED (0x00020000):
Because gum_darwin_cpu_type_from_pid() never returns GUM_CPU_IA32 or GUM_CPU_AMD64 on arm64 builds, the 4096 page size branch in gum_darwin_query_page_size() is dead code.
gum_darwin_read() then rounds 0x404c7000 down by ~0x3fff to 0x404c4000 and attempts a 0x4000-byte mach_vm_read, which spans the unmapped hole at 0x404c5000–0x404c7000 and fails with KERN_INVALID_ADDRESS.
Problem 2: Rosetta 2 injection on modern macOS (x86_64 vs arm64fruitjector)
Attempting to attach using x86_64 Frida under Rosetta fails at remote thread creation/state setup with thread_create returned '(os/kern) invalid argument', even with thid_should_crash=0 tss_should_crash=0 and com.apple.security.cs.debugger.
Meanwhile, calling thread_create() from a native arm64 process succeeds (KERN_SUCCESS), but creates an arm64 Mach thread whereas TASK_DYLD_INFO in the Rosetta process points to x86_64 dylibs.
Activity