Run a virtual iPhone on an Apple Silicon Mac.
Swift
[kernel-jb] disable vm_map_protect Shape B (crashes debugger on 26.4+)
zqxwce81b0cd828c88
diff --git a/research/0_binary_patch_comparison.md b/research/0_binary_patch_comparison.mdindex c7b71eb8..2b2d8fe4 100644--- a/research/0_binary_patch_comparison.md+++ b/research/0_binary_patch_comparison.md@@ -146,7 +146,7 @@| JB-22 | B | `patch_task_for_pid` | `_task_for_pid` | Allow task_for_pid via upstream early `pid == 0` gate NOP | Y || JB-23 | B | `patch_thid_should_crash` | `_thid_should_crash` | Prevent GUARD_TYPE_MACH_PORT crash | Y || JB-24 | B | `patch_vm_fault_enter_prepare` | `_vm_fault_enter_prepare` | Force `cs_bypass` fast path in runtime fault validation | Y |-| JB-25 | B | `patch_vm_map_protect` | `_vm_map_protect` | Skip upstream write-downgrade gate in `vm_map_protect` | Y |+| JB-25 | B | `patch_vm_map_protect` | `_vm_map_protect` | Skip upstream write-downgrade gate. Shape A (26.1–26.4) active; **Shape B (26.5) disabled 2026-07-05** — widened the `~VM_PROT_WRITE` COW strip (vm_map.c:6202) instead of the RWX gate (vm_map.c:5997), breaking COW and crashing the debugger (SPTM `VIOLATION_ILLEGAL_MAP`). Retired on 26.5+: SPTM code-mod (debugger + Substrate tweaks) uses write-then-flip via `vm_protect(VM_PROT_COPY)` → `XNU_USER_DEBUG`, so no RWX patch is needed. | Y/N |### EXP-Only Kernel Methods (Reference List)diff --git a/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchVmProtect.swift b/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchVmProtect.swiftindex 5c3f4c00..7d7dbd97 100644--- a/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchVmProtect.swift+++ b/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchVmProtect.swift@@ -57,18 +57,13 @@ extension KernelJBPatcher {return true}- // Shape B: runtime W^X mask register (26.5). Widen the mask constant #5 -> #7.- if let (movOff, maskReg) = findWxMaskMov(start: funcStart, end: funcEnd) {- guard let maskBytes = ARM64Encoder.encodeMovzW(rd: maskReg, imm16: 7) else {- log(" [-] could not encode widened W^X mask")- return false- }- emit(movOff, maskBytes,- patchID: "kernelcache_jb.vm_map_protect",- virtualAddress: fileOffsetToVA(movOff),- description: "mov w\(maskReg),#7 [_vm_map_protect widen W^X mask, allow W+X]")- return true- }+ // Shape B (26.5 mask-widen) disabled: findWxMaskMov hit vm_map.c:6202+ // `prot &= ~VM_PROT_WRITE` (the COW strip), not the RWX gate at vm_map.c:5997.+ // Widening it broke COW, so debugger/tweak writes crashed SPTM on 26.4++ // (VIOLATION_ILLEGAL_MAP). Not retargeted: on SPTM, code modification uses+ // write-then-flip via vm_protect(VM_PROT_COPY) -> XNU_USER_DEBUG, which needs no+ // RWX (debugger, Substrate tweaks, and the JB's own plugins all use this path).+ // Shape A stays for 26.1-26.4; this W^X patch is retired on 26.5+.log(" [-] vm_map_protect write-downgrade gate not found")return false