Skip to content

Run a virtual iPhone on an Apple Silicon Mac.

Swift

Fix iOS 26.0 and 26.0.1 GUI boot

Xin Huang16663a2f5fd8
diff --git a/README.md b/README.md
index c45496f7..507c278d 100644
--- a/README.md
+++ b/README.md
@@ -10,6 +10,9 @@ Boot a virtual iPhone (iOS 26) via Apple's Virtualization.framework using PCC re
| Host | iPhone | CloudOS |
| ------------- | --------------------- | --------------- |
+| Mac16,8 26.5.1 | `17,3_26.0_23A341` | `26.1-23B85` |
+| Mac16,8 26.5.1 | `17,3_26.0.1_23A355` | `26.1-23B85` |
+| Mac16,8 26.5.1 | `17,3_26.1_23B85` | `26.1-23B85` |
| Mac16,12 26.3 | `17,3_26.1_23B85` | `26.1-23B85` |
| Mac16,12 26.3 | `17,3_26.3_23D127` | `26.1-23B85` |
| Mac16,12 26.3 | `17,3_26.3_23D127` | `26.3-23D128` |
@@ -17,6 +20,9 @@ Boot a virtual iPhone (iOS 26) via Apple's Virtualization.framework using PCC re
| Mac16,11 26.2 | `17,3_26.4_23E246` | `26.4-23E5207q` |
| Mac16,11 26.2 | `17,3_26.5_23F77` | `26.4-23E5207q` |
+iOS 26.0 and 26.0.1 use the 26.1 PCC vphone600 stack plus the CFW-time
+`IOMobileFramebuffer` SwapEnd payload-size patch.
+
## Firmware Variants
Five patch variants are available with increasing levels of security bypass:
diff --git a/research/0_binary_patch_comparison.md b/research/0_binary_patch_comparison.md
index 2b2d8fe4..957bd393 100644
--- a/research/0_binary_patch_comparison.md
+++ b/research/0_binary_patch_comparison.md
@@ -172,6 +172,7 @@ do NOT execute these).
| 6 | Weak dylib load injection | `launchd` | Load short alias `/b` (copy of `launchdhook.dylib`) at launch. On by default; set `DISABLE_LAUNCHD_HOOK=1` to skip because this pid-1 hook path is boot-critical and has produced boot-analysis failures | - | Y | Y |
| 7 | cstring byte 5 mangle `'h' → 'X'` (`"kern.hv_vmm_present"` → `"kern.Xv_vmm_present"`) + per-page slot-hash re-attestation, BLACKLIST semantics — **EXP only** | DSC dylibs | Companion to EXP kernel rename (`KernelEXPPatcher.patchHvVmmRename`). The mangle is applied to every DSC dylib EXCEPT those in `DONT_PATCH_INSTALL_NAMES` (sign-in / device-likeness consumers, ~15 entries). Patched dylibs query `kern.Xv_vmm_present` and get the truthful 1 (graphics / accel passthrough). Blacklisted dylibs keep the original cstring, hit ENOENT on the renamed kernel, cache 0, lie about VM presence. On `codeSigningMonitor == 2` hardware the byte-mangle alone causes `CODESIGNING/Invalid Page` SIGKILL because TXM enforces per-page hashes; the re-attestation pass recomputes the SHA-256 slot in the chunk's `CS_CodeDirectory` for every modified 16 KiB page. See `scripts/patchers/cfw_dsc_codesign.py` and `cfw_patch_hv_vmm_dsc.py`. | - | - | - |
| 8 | (removed — was: standalone-binary mangle in 6 rootfs Mach-Os via SSH) | n/a | Removed in the blacklist-flip redesign. With the EXP kernel rename in place, the 6 rootfs binaries (MobileActivationMigrator, CheckerBoard, StoreKitUISceneService, storekitd, appstored, CorePrescriptionService) get the desired "cache 0 / not in a VM" behavior for free: they keep their original cstring, hit ENOENT on the renamed kernel sysctl, defensive `cbnz w0, skip` leaves the cached byte at BSS-zero. No SSH-time standalone patch needed. | - | - | - |
+| 9 | `mov w3,#0x548` -> `mov w3,#0x560` in `_kern_SwapEnd` — **26.0 and 26.0.1 only** | DSC `IOMobileFramebuffer` | Fixes 26.0/26.0.1 GUI black-screen with the available PCC vphone600 userclient: 26.0 and 26.0.1 send a 0x548-byte external-method-5 SwapEnd state, while the userclient expects the 26.1-era 0x560 layout and otherwise returns `kIOReturnBadArgument`. The patch changes only this immediate in the installed 26.0 or 26.0.1 dyld cache and re-attests the modified DSC page. Validated after JB host install on `17,3_26.0_23A341` and `17,3_26.0.1_23A355`; 26.1 remains unmodified by this patch. | Y | Y | Y |
### Installed Components
@@ -652,6 +653,7 @@ cache rebuild.
| Procursus bootstrap deployment | - | - | Y (JB-2) | Y (JB-2) |
| BaseBin hook deployment (`*.dylib` -> `/mnt1/cores`) | - | - | Y (JB-3) | Y (JB-3) |
| First-boot JB finalization (`vphone_jb_setup.sh`) | - | - | Y (post-boot) | Y (post-boot) |
+| IOMobileFramebuffer SwapEnd payload-size patch (`26.0 and 26.0.1` only) | Y | Y | Y (inherited from base run) | Y (inherited from base run) |
| DSC pre-patch (`kern.hv_vmm_present` byte-5 mangle + slot reattest) | - | - | - | Y (pre-step, before base CFW) |
| DSC camera patches (12 patches across CMCapture / CoreMediaIO / AVFCapture / libMobileGestalt) | - | - | - | Y (pre-step, same cryptex mount as hv_vmm) |
| `watchdogd` surgical 2-insn patch + slot reattest | - | - | - | Y (EXP-JB-3.5) |
@@ -736,6 +738,7 @@ cache rebuild.
- unaligned integer reads across the firmware patcher now go through a shared safe `Data.loadLE(...)` helper, fixing the JB IM4P crash (`Swift/UnsafeRawPointer.swift:449` misaligned raw pointer load).
- `TXMPatcher` now preserves pristine Python parity by preferring the legacy trustcache binary-search site when present, and only falls back to the selector24 hash-flags call chain (`ldr x1, [x20,#0x38]` -> `add x2, sp, #4` -> `bl` -> `ldp x0, x1, [x20,#0x30]` -> `add x2, sp, #8` -> `bl`) when rerunning on a VM tree that already carries the dev/JB selector24 early-return patch.
- `scripts/fw_prepare.sh` now deletes stale sibling `*Restore*` directories in the working VM directory before patching continues, so a fresh `make fw_prepare && make fw_patch` cannot accidentally select an older prepared firmware tree (for example `26.1`) when a newer one (for example `26.3`) was just generated.
+ - 26.0 and 26.0.1 GUI bring-up now patches installed DSC `IOMobileFramebuffer` only when `ProductVersion` starts with `26.0`: `_kern_SwapEnd` passes a 0x560-byte state to the 26.1 PCC userclient instead of the 26.0/26.0.1 0x548-byte state. JB host installs were validated on `17,3_26.0_23A341`, `17,3_26.0.1_23A355`, and unchanged `17,3_26.1_23B85`.
- IM4P/output parity fixes completed after synthetic full-pipeline comparison:
- `IM4PHandler.save()` no longer forces a generic LZFSE re-encode.
- Swift now rebuilds IM4Ps in the same effective shape as the Python patch flow and only preserves trailing `PAYP` metadata for `TXM` (`trxm`) and `kernelcache` (`krnl`).
diff --git a/research/firmware_manifest_and_origins.md b/research/firmware_manifest_and_origins.md
index aac06b6d..d2286b57 100644
--- a/research/firmware_manifest_and_origins.md
+++ b/research/firmware_manifest_and_origins.md
@@ -23,11 +23,18 @@ restore directory, then `fw_manifest.py` generates the hybrid BuildManifest.
| Source | Identities | DeviceClasses |
| -------------- | ---------- | ------------------------------------------------------- |
+| iPhone 26.0 | 5 | All d47ap |
+| iPhone 26.0.1 | 5 | All d47ap |
| iPhone 26.1 | 5 | All d47ap |
| iPhone 26.3 | 5 | All d47ap |
| CloudOS 26.1 | 6 | j236cap, j475dap, vphone600ap (x2), vresearch101ap (x2) |
| KnownWork 26.1 | 5 | All vresearch101ap |
+26.0 and 26.0.1 have no matching public PCC vphone600 drop in this repo's tested set, so
+it is prepared as iPhone 26.0 or 26.0.1 userspace plus the 26.1 PCC boot/runtime stack.
+The 26.0 and 26.0.1 `IOMobileFramebuffer` dyld-cache patch in CFW install fixes the
+only observed GUI ABI mismatch (`SwapEnd` payload size 0x548 -> 0x560).
+
### CloudOS 26.1 Identity Structure (6 identities)
| Index | DeviceClass | Variant | BuildStyle | Manifest Keys |
diff --git a/scripts/cfw_install.sh b/scripts/cfw_install.sh
index 6dfcb97e..0c6ff265 100755
--- a/scripts/cfw_install.sh
+++ b/scripts/cfw_install.sh
@@ -283,6 +283,18 @@ else
echo " [+] Cryptex installed"
fi
+# iOS 26.0 and 26.0.1 IOMobileFramebuffer send the older 0x548-byte SwapEnd
+# payload, but the PCC vphone600 userclient rejects anything below the
+# 26.1-era 0x560 layout. Patch only that immediate in the installed 26.0 or 26.0.1
+# DSC; do not replace frameworks or normalize GPU metadata.
+IOS_VERSION=$(/usr/bin/plutil -extract ProductVersion raw -o - "$MNT1/System/Library/CoreServices/SystemVersion.plist" 2>/dev/null || true)
+if [[ "$IOS_VERSION" == 26.0* ]]; then
+ echo " [*] Patching 26.0/26.0.1 IOMobileFramebuffer SwapEnd payload size..."
+ DSC_DIR="$MNT1/System/Cryptexes/OS/System/Library/Caches/com.apple.dyld"
+ [[ -d "$DSC_DIR" ]] || die "dyld cache dir missing: $DSC_DIR"
+ "$PYTHON3" "$SCRIPT_DIR/patchers/cfw.py" patch-iomfb-swapend "$DSC_DIR"
+fi
+
# ═══════════ 2/7 PATCH SEPUTIL ════════════════════════════════
echo ""
echo "[2/7] Patching seputil..."
diff --git a/scripts/cfw_install_dev.sh b/scripts/cfw_install_dev.sh
index 498139b8..860ff647 100755
--- a/scripts/cfw_install_dev.sh
+++ b/scripts/cfw_install_dev.sh
@@ -300,6 +300,18 @@ safe_detach "$MNT_APPOS"
echo " [+] Cryptex installed"
+# iOS 26.0 and 26.0.1 IOMobileFramebuffer send the older 0x548-byte SwapEnd
+# payload, but the PCC vphone600 userclient rejects anything below the
+# 26.1-era 0x560 layout. Patch only that immediate in the installed 26.0 or 26.0.1
+# DSC; do not replace frameworks or normalize GPU metadata.
+IOS_VERSION=$(/usr/bin/plutil -extract ProductVersion raw -o - "$MNT1/System/Library/CoreServices/SystemVersion.plist" 2>/dev/null || true)
+if [[ "$IOS_VERSION" == 26.0* ]]; then
+ echo " [*] Patching 26.0/26.0.1 IOMobileFramebuffer SwapEnd payload size..."
+ DSC_DIR="$MNT1/System/Cryptexes/OS/System/Library/Caches/com.apple.dyld"
+ [[ -d "$DSC_DIR" ]] || die "dyld cache dir missing: $DSC_DIR"
+ "$PYTHON3" "$SCRIPT_DIR/patchers/cfw.py" patch-iomfb-swapend "$DSC_DIR"
+fi
+
# ═══════════ 2/7 PATCH SEPUTIL ════════════════════════════════
echo ""
echo "[2/7] Patching seputil..."
diff --git a/scripts/patchers/cfw.py b/scripts/patchers/cfw.py
index 95f05aaf..174c79e1 100755
--- a/scripts/patchers/cfw.py
+++ b/scripts/patchers/cfw.py
@@ -29,6 +29,11 @@ Commands:
the mounted SystemOS Cryptex). Targets a fixed list of identity,
store, and consumer-service dylibs; skips compute/accel libs.
+ patch-iomfb-swapend <chunks_dir> [--dry-run]
+ Patch iOS 26.0 and 26.0.1 IOMobileFramebuffer's _kern_SwapEnd external-method
+ payload size from 0x548 to 0x560 for the PCC vphone600 userclient,
+ then re-attest the modified DSC page hash.
+
patch-camera-dsc <chunks_dir> <dsc_header> [--dry-run] [--force]
Apply the 10-patch set to the DSC chunks that makes Camera.app
launch-survivable on a vphone VM: synthesises a single
@@ -77,6 +82,7 @@ if __name__ == "__main__":
from patchers.cfw_patch_mobileactivationd import patch_mobileactivationd
from patchers.cfw_patch_jetsam import patch_launchd_jetsam
from patchers.cfw_patch_hv_vmm_dsc import patch_hv_vmm_in_dsc
+ from patchers.cfw_patch_iomfb_swapend import patch_iomfb_swapend
from patchers.cfw_patch_camera_dsc import apply_all_camera_patches
from patchers.cfw_patch_watchdogd import patch_watchdogd
from patchers.cfw_daemons import parse_cryptex_paths, inject_daemons, patch_dropbear_plist
@@ -86,6 +92,7 @@ else:
from .cfw_patch_mobileactivationd import patch_mobileactivationd
from .cfw_patch_jetsam import patch_launchd_jetsam
from .cfw_patch_hv_vmm_dsc import patch_hv_vmm_in_dsc
+ from .cfw_patch_iomfb_swapend import patch_iomfb_swapend
from .cfw_patch_camera_dsc import apply_all_camera_patches
from .cfw_patch_watchdogd import patch_watchdogd
from .cfw_daemons import parse_cryptex_paths, inject_daemons, patch_dropbear_plist
@@ -142,6 +149,18 @@ def main():
results = patch_hv_vmm_in_dsc(sys.argv[2], dry_run=dry_run)
sys.exit(0)
+ elif cmd == "patch-iomfb-swapend":
+ if len(sys.argv) < 3:
+ print("Usage: patch_cfw.py patch-iomfb-swapend <chunks_dir> [--dry-run]")
+ sys.exit(1)
+ dry_run = "--dry-run" in sys.argv[3:]
+ try:
+ patch_iomfb_swapend(sys.argv[2], dry_run=dry_run)
+ except ValueError as e:
+ print(f"[-] {e}")
+ sys.exit(1)
+ sys.exit(0)
+
elif cmd == "patch-camera-dsc":
if len(sys.argv) < 4:
print("Usage: patch_cfw.py patch-camera-dsc <chunks_dir> <dsc_header> [--dry-run] [--force]")
@@ -203,7 +222,8 @@ def main():
print(f"Unknown command: {cmd}")
print("Commands: cryptex-paths, patch-seputil, patch-launchd-cache-loader, patch-camera-dsc,")
print(" patch-mobileactivationd, patch-launchd-jetsam,")
- print(" patch-hv-vmm-dsc, patch-watchdogd, inject-daemons, patch-dropbear-plist, inject-dylib")
+ print(" patch-hv-vmm-dsc, patch-iomfb-swapend, patch-watchdogd,")
+ print(" inject-daemons, patch-dropbear-plist, inject-dylib")
sys.exit(1)
diff --git a/scripts/patchers/cfw_patch_iomfb_swapend.py b/scripts/patchers/cfw_patch_iomfb_swapend.py
new file mode 100644
index 00000000..7af69d84
--- /dev/null
+++ b/scripts/patchers/cfw_patch_iomfb_swapend.py
@@ -0,0 +1,91 @@
+"""Patch iOS 26.0 and 26.0.1 IOMobileFramebuffer SwapEnd payload size.
+
+The PCC vphone600 26.1 kernel-side IOMobileFramebuffer external method 5
+expects the newer 0x560-byte swap state. iOS 26.0 and 26.0.1 userland send 0x548,
+so SwapEnd returns kIOReturnBadArgument and the VM display stays black.
+"""
+
+try:
+ from .cfw_dsc_chunks import DSCChunks
+ from .cfw_dsc_codesign import reattest_modified_pages
+except ImportError: # direct self-test execution
+ from cfw_dsc_chunks import DSCChunks
+ from cfw_dsc_codesign import reattest_modified_pages
+
+
+IOMFB = "/System/Library/PrivateFrameworks/IOMobileFramebuffer.framework/IOMobileFramebuffer"
+
+# _kern_SwapEnd:
+# ldr w0, [x0,#0x14]
+# add x2, x19,#0x18
+# mov w1,#5
+# mov w3,#0x548 <-- patch to 0x560
+# mov x4,#0
+# mov x5,#0
+OLD = bytes.fromhex("001440b962620091a100805203a98052040080d2050080d2")
+NEW_INSN = bytes.fromhex("03ac8052")
+
+
+def patch_iomfb_swapend(chunks_dir, *, dry_run=False):
+ chunks = DSCChunks(chunks_dir)
+ print(f" [.] {chunks!r}")
+ modified = []
+ already = 0
+ refused = 0
+
+ for _cp, _foff, vma_start, buf in chunks.iter_executable_mapping_bytes():
+ i = 0
+ while True:
+ p = buf.find(OLD, i)
+ if p < 0:
+ break
+ insn_vma = vma_start + p + 12
+ header = chunks.find_macho_header_before(insn_vma)
+ install = chunks.read_install_name_at(header) if header is not None else None
+ if install != IOMFB:
+ refused += 1
+ print(f" [-] refusing non-IOMFB hit at 0x{insn_vma:X}: {install}")
+ else:
+ if not dry_run:
+ chunks.write_at_vma(insn_vma, NEW_INSN)
+ modified.append(insn_vma)
+ print(f" [+] {'would patch' if dry_run else 'patched'} {IOMFB} _kern_SwapEnd size 0x548 -> 0x560 at 0x{insn_vma:X}")
+ i = p + 4
+
+ # Idempotent rerun support.
+ patched = OLD[:12] + NEW_INSN + OLD[16:]
+ i = 0
+ while True:
+ p = buf.find(patched, i)
+ if p < 0:
+ break
+ insn_vma = vma_start + p + 12
+ header = chunks.find_macho_header_before(insn_vma)
+ install = chunks.read_install_name_at(header) if header is not None else None
+ if install == IOMFB:
+ already += 1
+ modified.append(insn_vma)
+ print(f" [=] already patched at 0x{insn_vma:X}")
+ i = p + 4
+
+ if not modified:
+ raise ValueError("IOMobileFramebuffer 26.0/26.0.1 SwapEnd size site not found")
+ if modified and not dry_run:
+ print(f" [.] re-attesting {len(set(modified))} modified page(s)...")
+ reattest_modified_pages(chunks, sorted(set(modified)), dry_run=False)
+ elif modified:
+ print(f" [.] dry-run: would re-attest {len(set(modified))} page(s)")
+
+ print(f" [+] IOMFB SwapEnd patch complete: {len(modified) - already} patched, {already} already, {refused} refused")
+ return len(modified)
+
+
+def _self_test():
+ assert OLD[12:16] == bytes.fromhex("03a98052")
+ assert NEW_INSN == bytes.fromhex("03ac8052")
+ patched = OLD[:12] + NEW_INSN + OLD[16:]
+ assert patched == bytes.fromhex("001440b962620091a100805203ac8052040080d2050080d2")
+
+
+if __name__ == "__main__":
+ _self_test()