Repository navigation
Tags
Tags
darwin: Avoid remapping code on iOS >= 15.0 Overwriting executable mappings on XNU 8019 can leave the target inaccessible, crashing during cache invalidation. The signature flavor probe only maps a scratch page and does not detect this restriction. Stop using code segments from that kernel on, and only try the newer page swap on macOS, so in-place patching runs everywhere else. Add a test that patches a shared cache function with its own bytes and checks that its page stays executable and the function still works. Co-authored-by: Ole André Vadla Ravnås <oleavr@frida.re>
memory: Swap patched code pages in on Darwin Without RWX the pages being patched were briefly not executable, and threads created while the others were suspended ran into them. Busy dispatch processes crashed on attach and detach as a result. On arm64, remap the patched copy over each run of pages instead, which replaces a run atomically and needs no thread suspended. Suspend only for pages that could not be swapped, which take the old path.
x86: Relocate and virtualize LOOP instructions LOOP, LOOPE and LOOPNE were copied verbatim, leaving their rel8 relative to the wrong address, and Stalker lost control when they were taken. Rewrite them like JECXZ and JRCXZ, and carry over the address-size prefix, as it selects the counter width. This also stops JECXZ from turning into JRCXZ on x86_64.
PreviousNext