Skip to content

Run a virtual iPhone on an Apple Silicon Mac.

Swift

Package optional guest sibling components separately

Lakr8ebae938a1ff
diff --git a/AGENTS.md b/AGENTS.md
index 724d47b5..39f2c70b 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -182,9 +182,12 @@ scripts/ # Build scripts and payloads only; no runtime
├── setup_tools.sh [b] # Builds insert_dylib, the Mach-O byte-parity test reference
├── payloads/ # Small GPU driver archive; no bootstrap payloads
├── vphoned/ # Guest daemon source; only its plist and entitlements ship
-├── tweakloader/ vpregister/ vcamcaptured/ camfix/ # Unshipped experimental sources
└── repos/ # Toolchain source (git submodule: insert_dylib)
+siblings/ # Optional guest components; separate Makefile/package
+├── camfix/ vcamcaptured/ # Camera hooks and filter plists
+└── tweakloader/ vpregister/ # Loader and iOS 27 app registrar
+
research/ # Detailed firmware/patch documentation
```
diff --git a/Makefile b/Makefile
index e547b56e..fc94e7c3 100644
--- a/Makefile
+++ b/Makefile
@@ -74,6 +74,7 @@ help:
@echo "Build:"
@echo " make build Build + sign vphone-cli"
@echo " make vphoned Cross-compile + sign vphoned for iOS"
+ @echo " make siblings_package Build + archive optional guest components"
@echo " make clean Remove build/tooling artifacts only"
@echo " Options: CLEAN_VM=1 Also remove VM_DIR=$(VM_DIR) after confirmation"
@echo " CLEAN_IPSW=1 Also remove ipsws/ after confirmation"
@@ -228,9 +229,8 @@ $(AMFI_BINARY): $(AMFI_SOURCE)
bundle:
@zsh $(SCRIPTS)/build.sh
-# The five iOS binaries the guest runs. Compiled here, on the build machine,
-# because compiling them at CFW-install time is what made Xcode a prerequisite
-# for running a VM. See scripts/guest_binaries.mk.
+# The required guest daemon is compiled on the build machine, so running a VM
+# never requires Xcode. Optional sibling components have their own package.
include $(SCRIPTS)/guest_binaries.mk
# vphoned for a live guest. This target only prepares the build artifact;
@@ -242,6 +242,10 @@ vphoned: $(GUEST_DIR)/vphoned $(BINARY)
.build/vphoned.signed
@echo " signed → .build/vphoned.signed"
+.PHONY: siblings_package
+siblings_package:
+ @$(MAKE) --no-print-directory -C siblings package
+
# ═══════════════════════════════════════════════════════════════════
# VM management
# ═══════════════════════════════════════════════════════════════════
diff --git a/research/0_binary_patch_comparison.md b/research/0_binary_patch_comparison.md
index 7d740f62..1d735c66 100644
--- a/research/0_binary_patch_comparison.md
+++ b/research/0_binary_patch_comparison.md
@@ -206,7 +206,7 @@ do NOT execute these).
| 9 | `mov w3,#<size>` -> `mov w3,#<base-size>` in `_kern_SwapEnd` — **26.0/26.0.1 and 18.x** | DSC `IOMobileFramebuffer` | Fixes host VZ GUI black-screen with the available PCC vphone600 userclient: the userclient does an exact `checkStructureInputSize` check on external-method-5 (SwapEnd) input, so a userland whose `_kern_SwapEnd` sends a different-sized state gets `kIOReturnBadArgument` and the host display stays black (guest still renders — the Apple logo is visible over VNC, just not in the vphone-cli view). **The accepted size is a property of the base kernel, not the userland**: 26.1 base -> **0x560**, 26.4 base (xnu-12377) -> **0x588**. The 0x588 value is confirmed two ways: the sole dispatch-shaped entry in `kernelcache.*.vphone600` with `checkStructureInputSize==0x588` (scalarIn=0, scalarOut=0, structOut=0, preceded by a ptrauth code ptr, at decompressed file offset 0x9c7228), and empirically — native 26.5 userland sends 0x588 and displays correctly on this stack. Source (userland-sent) sizes observed: 18.6.2 = 0x514, 26.0/26.0.1 = 0x548, 27.0 (24A5380h) = 0x6e0. The patcher is semantic (anchors on `mov w1,#5` -> `mov w3,#imm` -> `mov x4,#0`/`mov x5,#0` -> `bl` inside `_kern_SwapEnd`) and idempotent — rewrites the size to `--target-size` regardless of source and re-attests the modified DSC page. Install gate: `26.0*` / `18.*` -> 0x560 (26.1 base). Validated after host install on `17,3_26.0_23A341`, `17,3_26.0.1_23A355`, and `17,3_18.6.2_22G100` (Apple logo renders) against the 26.1 base. **CORRECTION (2026-07-15): iOS 27.0 is NO LONGER handled here.** 27 presents the paravirt display via IOMFB's `_virt_*` callback path — external method 5 is NEVER called — so no SwapEnd *size* change can help 27 (confirmed by kernel trace + live AppleParavirtGPU idle scheduler). iOS 27 now uses **force-kern (item 11)** to route present back onto method 5; this row applies to 26.0/26.0.1/18.x only. | Y | Y | Y |
| 10 | Zero `maxSlide` in `dyld_cache_header` (`@0xF0`) — **iOS 27.0 / any userland whose cache overflows the 6 GiB region** | DSC `dyld_shared_cache_arm64e` header | Fixes pid-1 `launchd` panic at boot on the vphone600 26.x kernel. The kernel reserves `SHARED_REGION_SIZE_ARM64 = 0x180000000` (6 GiB) and, at map time, needs room for the cache's mapped span **plus** the header `maxSlide` (ASLR range). iOS 27.0's cache (span `0x17c830000` ≈ 5.95 GiB) + `maxSlide 0x20000000` = `0x19c830000` > 6 GiB, so `_shared_region_map_and_slide` returns `ENOMEM`, dyld cannot map `libSystem.B.dylib`, and `launchd` panics (`initproc failed to start`). Zeroing `maxSlide` (LE u64) in the main chunk maps the cache at slide 0 (fits with ~58 MiB spare). Install gate: **`27.*`** (hard-gated in `cfw_install.sh` as of 2026-07-20 — an 18.x/26.x base skips it entirely). The patcher additionally self-gates (`patch-dsc-maxslide`): no-op unless span + maxSlide > `0x180000000`, kept as defense-in-depth so 26.x / 18.x are untouched even if the install gate were removed. **Opt-in for non-27 bases** (added 2026-07-23): `FORCE_DSC_MAXSLIDE=1` in the `cfw_install.sh` environment runs `patch-dsc-maxslide --force` on 18.x/26.x too; `--force` bypasses the fits-check and zeroes `maxSlide` unconditionally (still idempotent — no-op if already 0). Default off, so non-27 bases keep their native ASLR slide unless explicitly requested; the `27.*` path is unchanged. **No** page re-attestation (header metadata, not a `cs_validate`'d code page — confirmed empirically). Validated on `17,3_27.0_24A5380h` + cloudOS 26.4 (`c0ecdb4b…`): `dyld cache mapped system-wide`, launchd reaches first unlock, vphoned connects as iOS 27.0.0, 0 panics. See `scripts/patchers/cfw_patch_dsc_maxslide.py`. | Y | Y | Y |
| 11 | Retarget public `_IOMobileFramebufferSwap*` trampolines -> `b _kern_Swap*` (force-kern) — **iOS 27.0** | DSC `IOMobileFramebuffer` | **iOS-27 VZ-view (host paravirt-GPU scanout) fix, userland half.** The host `VZVirtualMachineView` is fed by the guest `AppleParavirtGPU` scanout, which the 26.4 kernel drives ONLY from the IOMFB userclient SwapEnd (external method 5) — the `_kern_Swap*` path. iOS 27 defaults the paravirt display's present to IOMFB's parallel `_virt_Swap*` path (`_virt_SwapEnd` does no userclient call — it invokes an in-process callback `blraaz [conn+0xe68]` and hands the IOSurface to a virtual-display consumer), so the paravirt GPU never scans out → host VZ window black (guest still composites; GUI visible over in-guest TrollVNC; AppleParavirtGPU `SchedulerState` idle). The public `_IOMobileFramebufferSwap*` entrypoints are thin trampolines (`cbz x0; ldr xN,[x0,#slot]; cbz xN; braaz xN`) that tail-call the per-connection swap fp (kern or virt impl). This patch rewrites each trampoline's first insn to `b _kern_Swap<Name>`, forcing present onto method 5 regardless of how 27 classified the display (tail-call, args intact → behaviourally identical to selecting the kern fp). Fully dynamic: public + `_kern_` addrs resolved by name via `ipsw dyld symaddr`, trampoline shape verified by Capstone, branch bytes from Keystone `asm_at()`, modified DSC code pages re-attested. Requires ≥{SwapBegin,SwapEnd,SwapSetLayer} or raises (dry-run retargets 31 entrypoints on 24A5380h, skips 4 non-trampolines). **Pairs with the JB kernel patches (`patchIomfbSwapEndVariableSize` + `patchIomfbSwapEndHandlerSize`)** which relax the 26.4 userclient's two exact `0x588` size gates to accept 27's native `0x6e0` IOMFBSwapRec (prefix matches 26.x, so the paravirt swap handler reads valid fields). Install gate: `27.*`. See `scripts/patchers/cfw_patch_iomfb_force_kern.py`. **VALIDATED on-device (2026-07-15, `17,3_27.0_24A5380h` + cloudOS 26.4 `c0ecdb4b…`, JB): iOS 27 userland renders AND is interactive in the native VZ view (not just TrollVNC); clean boot — no `kIOReturnBadArgument`/SwapEnd rejection/panic.** Runtime confirmed 31 entrypoints retargeted (4 non-trampoline setters left on virt). | Y | Y | Y |
-| 12 | NOP `-[_LSDModifyClient clientIsEntitledForEmbeddedRegistrationOperations]` entitlement gate + per-page re-attest — **iOS 27.0** | DSC `CoreServices` (LaunchServices) | **iOS-27 app-registration fix.** lsd gates `-[_LSDModifyClient performPostInstallationRegistration:operationUUID:reply:]` (and the containerized/rebuild registration paths) behind `clientIsEntitledForEmbeddedRegistrationOperations`, which does `xpc_connection_copy_entitlement_value` on the XPC peer for any of `com.apple.private.coreservices.lsaw` / `com.apple.private.installcoordinationd.daemon` / `com.apple.private.coreservices.can-register-install-results`. A client without one gets `NSOSStatusErrorDomain -54` (permErr, `LSDModifyService.mm:1639`), so `registerApplicationDictionary:` / `registerContainerizedApplicationWithInfoDictionaries:` fail and no app can (re)register — blocking vphoned's installer, TrollStore, and uicache/Sileo alike. The entitlement route is a dead end even for a launchd platform daemon (vphoned) whose validated csblob (`csops CS_OPS_ENTITLEMENTS_BLOB`) contains all three: LS registration is proxied, so the XPC peer lsd inspects is not the registering process. Fix: NOP the final `cbz w0, <not_entitled>` (the conditional branch whose fall-through sets the `mov w<reg>,#1` result) so the method always returns YES. Fully dynamic: method resolved via the DSC's own `.symbols` in-image local-symbol table (ipsw `symaddr -a`/`a2s` time out on this cache), gate located by control-flow shape in Capstone, NOP from Keystone `asm("nop")`, modified 16 KiB page re-attested (`cfw_dsc_codesign.py`; TXM enforces per-page). The resulting CDHash change is accepted by the JB always-true AMFI cdhash-trust patch. Install gate: **`27.*`** (hard-gated in `cfw_install.sh` as of 2026-07-20 — an 18.x/26.x base does not apply it). The patcher additionally self-gates (`patch-lsd-embedded-reg`): no-op on pre-iOS-27 userlands where the method is absent. **Pairs with vphoned's `vp_register_path` containerized-registration fallback** (`registerContainerizedApplicationWithInfoDictionaries:...:registrationError:`, treating a nil `registrationError` as success since it returns NO even when it registers). Also paired with **`/cores/vpregister`** (built + deployed by `cfw_install_jb.sh` / `cfw_install_exp.sh`, invoked by `vphone_jb_setup.sh` at first boot — 27-gated by DEPLOYMENT: `cfw_install_jb.sh`/`cfw_install_exp.sh` copy `/cores/vpregister` only when the mounted rootfs `SystemVersion.plist` is `27.*`, and the setup script's `[ -x /cores/vpregister ]` presence check is the runtime gate. Do NOT gate the invocation on a guest `sw_vers` check — the hybrid guest does not reliably report the 27 userland version at first boot, which silently skipped registration): it registers JB app bundles (Sileo) via the same containerized API, because `uicache -a`'s `registerApplicationDictionary:` is a deprecated no-op on iOS 27 (lsd logs *"you cannot use ... to register applications anymore. These interfaces have been deprecated for years."*). **VALIDATED (2026-07-17, `17,3_27.0_24A5380h` + cloudOS 26.4, JB): -54 gone; Sileo registers (`uicache -l` 0→1) via `vpregister`; vphoned installs+registers a test IPA (`com.vphone.vptest`) to `/var/containers/Bundle/Application/` end-to-end. Clean boot (re-attest correct; no CoreServices page rejection).** See `scripts/patchers/cfw_patch_lsd_embedded_reg.py` and `scripts/vpregister/vpregister.m`. **FIX (2026-08-10):** `_find_gate` only matched the live `cbz`/`cbnz` branch shape, so re-running `cfw install` (host-mount flow, `myphone` VM, `17,3_27.0_24A5390f`) against a cache where this gate was already NOP'd from a prior pass raised `ValueError: ... entitled-result gate ... not found` instead of recognizing the idempotent state (unlike the Cryptex/IOMFB steps, which log `already ... idempotent` and skip cleanly). Confirmed live via host-mount disassembly: the third check's `bl <check3>` is followed by a bare `nop` at the gate site (exact match against `asm("nop")` bytes) immediately before `mov w20, #1` — i.e. already patched. `_find_gate` now also matches `nop` immediately preceding `mov w<reg>,#1` as an already-patched gate, so a re-run just re-attests the page instead of erroring. | Y | Y | Y |
+| 12 | NOP `-[_LSDModifyClient clientIsEntitledForEmbeddedRegistrationOperations]` entitlement gate + per-page re-attest — **iOS 27.0** | DSC `CoreServices` (LaunchServices) | **iOS-27 app-registration fix.** lsd gates `-[_LSDModifyClient performPostInstallationRegistration:operationUUID:reply:]` (and the containerized/rebuild registration paths) behind `clientIsEntitledForEmbeddedRegistrationOperations`, which does `xpc_connection_copy_entitlement_value` on the XPC peer for any of `com.apple.private.coreservices.lsaw` / `com.apple.private.installcoordinationd.daemon` / `com.apple.private.coreservices.can-register-install-results`. A client without one gets `NSOSStatusErrorDomain -54` (permErr, `LSDModifyService.mm:1639`), so `registerApplicationDictionary:` / `registerContainerizedApplicationWithInfoDictionaries:` fail and no app can (re)register — blocking vphoned's installer, TrollStore, and uicache/Sileo alike. The entitlement route is a dead end even for a launchd platform daemon (vphoned) whose validated csblob (`csops CS_OPS_ENTITLEMENTS_BLOB`) contains all three: LS registration is proxied, so the XPC peer lsd inspects is not the registering process. Fix: NOP the final `cbz w0, <not_entitled>` (the conditional branch whose fall-through sets the `mov w<reg>,#1` result) so the method always returns YES. Fully dynamic: method resolved via the DSC's own `.symbols` in-image local-symbol table (ipsw `symaddr -a`/`a2s` time out on this cache), gate located by control-flow shape in Capstone, NOP from Keystone `asm("nop")`, modified 16 KiB page re-attested (`cfw_dsc_codesign.py`; TXM enforces per-page). The resulting CDHash change is accepted by the JB always-true AMFI cdhash-trust patch. Install gate: **`27.*`** (hard-gated in `cfw_install.sh` as of 2026-07-20 — an 18.x/26.x base does not apply it). The patcher additionally self-gates (`patch-lsd-embedded-reg`): no-op on pre-iOS-27 userlands where the method is absent. **Pairs with vphoned's `vp_register_path` containerized-registration fallback** (`registerContainerizedApplicationWithInfoDictionaries:...:registrationError:`, treating a nil `registrationError` as success since it returns NO even when it registers). Also paired with **`/cores/vpregister`** (built + deployed by `cfw_install_jb.sh` / `cfw_install_exp.sh`, invoked by `vphone_jb_setup.sh` at first boot — 27-gated by DEPLOYMENT: `cfw_install_jb.sh`/`cfw_install_exp.sh` copy `/cores/vpregister` only when the mounted rootfs `SystemVersion.plist` is `27.*`, and the setup script's `[ -x /cores/vpregister ]` presence check is the runtime gate. Do NOT gate the invocation on a guest `sw_vers` check — the hybrid guest does not reliably report the 27 userland version at first boot, which silently skipped registration): it registers JB app bundles (Sileo) via the same containerized API, because `uicache -a`'s `registerApplicationDictionary:` is a deprecated no-op on iOS 27 (lsd logs *"you cannot use ... to register applications anymore. These interfaces have been deprecated for years."*). **VALIDATED (2026-07-17, `17,3_27.0_24A5380h` + cloudOS 26.4, JB): -54 gone; Sileo registers (`uicache -l` 0→1) via `vpregister`; vphoned installs+registers a test IPA (`com.vphone.vptest`) to `/var/containers/Bundle/Application/` end-to-end. Clean boot (re-attest correct; no CoreServices page rejection).** See `scripts/patchers/cfw_patch_lsd_embedded_reg.py` and `siblings/vpregister/vpregister.m`. **FIX (2026-08-10):** `_find_gate` only matched the live `cbz`/`cbnz` branch shape, so re-running `cfw install` (host-mount flow, `myphone` VM, `17,3_27.0_24A5390f`) against a cache where this gate was already NOP'd from a prior pass raised `ValueError: ... entitled-result gate ... not found` instead of recognizing the idempotent state (unlike the Cryptex/IOMFB steps, which log `already ... idempotent` and skip cleanly). Confirmed live via host-mount disassembly: the third check's `bl <check3>` is followed by a bare `nop` at the gate site (exact match against `asm("nop")` bytes) immediately before `mov w20, #1` — i.e. already patched. `_find_gate` now also matches `nop` immediately preceding `mov w<reg>,#1` as an already-patched gate, so a re-run just re-attests the page instead of erroring. | Y | Y | Y |
| 13 | `mov x0,#1; ret` on `-[DIDiskArb isMountCompleteWithExpectedCount:diskTracker:]` — **iOS 27.0** | `diskimagesiod` | **iOS-27 DDI (`/System/Developer`) auto-mount — mount-gate.** After the personalized DDI attaches (kernel side: JB-28 + JB-09), MobileStorageMounter waits on diskimagesiod's `-[DIDiskArb waitForDAMountWithExpectedCount:diskTracker:]` before it does the real (nobrowse) mount at `/System/Developer`. That wait loops until `isMountComplete` (= `callbackReached \|\| (appearedDiskCount>=expectedCount && mountedDiskCount>=mountableDiskCount)`) is YES; on the 26.4-kernel / 27-userland hybrid it never becomes true (not all of the DMG's IOMedia "appear" to diskimagesiod's DiskArbitration session, and diskarbitrationd never auto-mounts the volume), so the wait hangs and pmd3 times out. diskimagesiod itself does NOT mount the DDI (its `-[DIDiskArb mountWithDeviceName:...]` is dead code) — it only gates MobileStorageMounter. Forcing `isMountComplete` → YES lets the wait return so MobileStorageMounter proceeds. IMP resolved via LC_SYMTAB or ObjC metadata (selector → `__objc_selrefs` → `__TEXT,__objc_methlist` relative method list → IMP); prologue overwritten `mov x0,#1 ; ret` (safe — the method returns to the caller's unsigned LR without pushing a frame). **Gated to 27.\*** in `cfw_install.sh` (same `$IOS_VERSION` as the DSC patches): on a version-matched userland the native wait completes correctly and forcing it early could race the real mount, so it is NOT applied there. Embedded sandbox profile + private DA/apfs entitlements preserved on re-sign (`ldid_sign_ent`). **Validated on `c0ecdb4b` 26.4 + 27.0 userland: `pmd3 mounter auto-mount` → rc=0, DDI at `/System/Developer`, idempotent across fresh boots.** See `scripts/patchers/cfw_patch_diskimagesiod.py`. | Y | Y | Y |
| 14 | Merge backboard/frontboard launch mach-services into `com.apple.security.exception.mach-lookup.global-name` + `ldid_sign_ent` re-sign — **iOS 27.0** | `/Applications/Campo.app/Campo` | **iOS-27 Campo (wallpaper renderer) crash-loop fix — sandbox half.** Campo declares `com.apple.private.sandbox.profile:embedded = temporary-sandbox` + `no-container`, so it runs under the `temporary-sandbox` profile. On the 26.4 vphone600 kernel that builtin profile predates iOS 27 and DENIES the `mach-lookup` of the backboard/frontboard launch services, so `BKSDisplayServicesStart` (looks up `com.apple.backboard.display.services`) and then `+[BKSHIDEventDeliveryManager sharedInstance]` (HID) fail, log *"backboardd isn't running -- or we couldn't talk to it"*, and `brk #0` ~34 ms after launch → continuous crash-loop, no wallpaper (launchd eventually throttles it off). **JB-02d is NOT sufficient here:** it stops the exec-time container-manager-upcall autobox *KILL*, but Campo is still placed in `temporary-sandbox` (its own declared profile — confirmed the JB-02d `b`-flip is present in the running kernel yet Campo still traps), and that profile still denies the lookups. Fix: append the needed services to Campo's OWN `com.apple.security.exception.mach-lookup.global-name` array — the Apple-sanctioned escape hatch, which `temporary-sandbox` honors (Campo already ships ~20 such exceptions; these launch services simply aren't among them because 27's profile allows them directly). Services added (backboard names exact, from `com.apple.backboardd.plist` MachServices): `com.apple.backboard.display.services`, `com.apple.iohideventsystem`, `com.apple.CARenderServer`, `com.apple.backboard.hid.services`, `com.apple.backboard.hid-services.xpc`, `com.apple.backboard.TouchDeliveryPolicyServer`, `com.apple.backboard.system-app-server`, `com.apple.backboard.watchdog`, `com.apple.backboard.oswatchdog`, `com.apple.backboard.altsysapp`, `com.apple.AttentionAwareness`, `PurpleSystemEventPort`, `PurpleWorkspacePort`, `com.apple.frontboard.systemappservices`, `com.apple.frontboard.workspace`, `com.apple.frontboardservices.systemappmanager`, `com.apple.frontboard.watchdog`. Merge is done by the external helper `scripts/patchers/campo_mach_lookup_exceptions.py` (Python `plistlib`, not `plutil` — the entitlement key contains dots that `plutil` keypaths would mis-split; idempotent, preserves the existing array); re-signed with the JB `signcert.p12` via `ldid_sign_ent` (AMFI enforcement is relaxed on the research VM, so the re-signed cdhash loads and the entitlements are honored). Applied at host-mount build time in `cfw_install_jb.sh` / `cfw_install_exp.sh` step **[JB-3b]**, **hard-gated to `27.*`** via the mounted rootfs `SystemVersion.plist` `ProductVersion` (same gate as the vpregister/DSC patches) — skipped entirely on 26.x/18.x, which don't need it and where `Campo.app` also exists. **VALIDATED on-device (2026-07-21, `17,3_27.0_24A5390f` + cloudOS 26.4, JB): Campo launches and stays up (stable pid, no BKSDisplayServicesStart/BKSHIDEventDeliveryManager trap, no crash-loop); first-cut display-only exception advanced the trap from display→HID, confirming the mechanism, then the full service set cleared it.** See `scripts/cfw_install_jb.sh` / `scripts/cfw_install_exp.sh` step JB-3b and the merge helper `scripts/patchers/campo_mach_lookup_exceptions.py`. | - | - | Y |
| 15 | Derive `matched` from `error_code` + drop the `brk #1` in libxpc `_xpc_token_satisfies_lwcr` (`cset w8,ne; eor w8,w0,w8; tbz w8,#0` → `cset w0,eq; nop; nop`) + per-page re-attest — **iOS 27.0** | DSC `libxpc.dylib` | **iOS-27 daemon crash-loop fix (Lightweight Code Requirement).** iOS 27 lets an XPC server pin a "lightweight code requirement" (LWCR) on its listener — `xpc_connection_set_peer_lightweight_code_requirement`, or the Swift `XPCPeerRequirement.hasEntitlement(_:)` wrapper (→ `xpc_peer_requirement_create_entitlement_exists` → `_xpc_peer_requirement_create_lwcr_entitlement_requirement` → `xpc_peer_requirement_create_lwcr`). Creating the requirement runs a self-check, `_xpc_token_satisfies_lwcr`, which calls an internal matcher returning a `matched` bool (w0) plus a `match_result.error_code` (`AICMR_MATCH == 0`), then hard-asserts they agree (`matched == (error_code == 0)`) via `_os_crash_msg` → `brk #1`. On stock iOS the two always agree; under our JB code-signing environment the matcher's query writes `error_code = MATCH(0)` yet returns a failure status, so the matcher yields the forbidden `(matched=0, error_code=0)` pair and libxpc aborts. Because EVERY daemon that pins an entitlement peer-requirement at startup hits it, `intelligencetasksd` / `searchpartyd` / `transparencyd` / `bluetoothd` (and others) crash-loop continuously from boot (launchd re-spawn + ReportCrash churn). Fix: recompute `matched` from `error_code` and make the abort unreachable — `cset w8,ne; eor w8,w0,w8; tbz w8,#0,<abort>` → `cset w0,eq; nop; nop`; the function now returns `(error_code == 0)`, which reproduces stock's verdict when the two agree and resolves the contradiction toward "satisfied" when error_code says MATCH (real allow/deny for genuinely (un)satisfied peers is unchanged, since those set `error_code` != 0). Fully dynamic: resolved via the DSC's own `.symbols` in-image local-symbol table as `__xpc_token_satisfies_lwcr` (the double-underscore mangled name; a single-underscore lookup silently skipped every iOS-27 build until fixed 2026-08-11), the check located by control-flow shape in Capstone (`cset wC,ne; eor wE,w0,wC; tbz wE,#0`), replacements from Keystone, modified 16 KiB page re-attested (`cfw_dsc_codesign.py`; TXM enforces per-page; CDHash change accepted by the JB always-true AMFI cdhash-trust patch). Install gate: **`27.*`** (in `cfw_install.sh`, same block as maxSlide/lsd). Patcher additionally self-gates (`patch-xpc-lwcr`): no-op on pre-iOS-27 userlands where the symbol is absent. **VALIDATED on-device (2026-07-22, `17,3_27.0_24A5390f` + cloudOS 26.4, JB, host-mount deploy): patched bytes live (`e0179f1a 1f2003d5 1f2003d5`); the four LWCR crash-loopers disappear from the crash census after boot; launchd itself (which links libxpc) boots clean past first unlock — patch does not brick boot. NOTE: does NOT stop the resprings — those are a separate `FileProviderResolver` ResolverService memory-balloon → jetsam → backboardd kill (see investigation notes).** See `scripts/patchers/cfw_patch_xpc_lwcr.py`. **FIX (2026-09-22):** same idempotence gap as row 12, and for the same structural reason: `_find_consistency_check` searches for `cset wC,ne; eor wE,w0,wC; tbz wE,#0`, which is precisely the idiom this patch replaces, so on a cache it had already patched the search returned `None` and raised `ValueError: LWCR consistency idiom ... not found`. The per-edit `already patched` byte comparison further down could never run, because it needs the addresses that search has to supply first. Hit live on `17,3_27.0_24A435` (RC) + cloudOS 26.4, JB, host-mount flow, when a first `cfw_install_host` pass completed phase 1/7 and then failed later at JB-1 (missing `insert_dylib`); the retry died here. Confirmed by read-only host-mount disassembly of `__xpc_token_satisfies_lwcr` @ `0x1805DD5BC`: `cmp w8,#0; cset w0,eq; nop; nop` — already patched. A new `_find_patched_shape` now recognizes that post-patch shape (`cset w0,eq` + two `nop`s, anchored on the `cmp wX,#0` that feeds it) and returns a no-op instead of raising. Checked against the live cache (dry run returns rather than raises) and with negative controls: fed the pre-patch stream the detector stays silent and the normal idiom search still matches, so the patching path is intact on a pristine cache. | Y | Y | Y |
diff --git a/scripts/camfix/.gitignore b/scripts/camfix/.gitignore
deleted file mode 100644
index e5d04671..00000000
--- a/scripts/camfix/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-*.dylib
diff --git a/scripts/check_aux.sh b/scripts/check_aux.sh
index de612677..f4eaad0f 100755
--- a/scripts/check_aux.sh
+++ b/scripts/check_aux.sh
@@ -168,8 +168,8 @@ check_closure() {
while IFS= read -r obj; do queue+=("$obj"); done < <(
find "$root" -type f -perm -u+x 2>/dev/null \
| while IFS= read -r f; do
- # Resources/guest holds the five iOS binaries the CFW installers copy
- # into the VM, plus vphoned.signed for a live install. They are arm64
+ # Resources/guest holds the iOS guest daemon and related resources,
+ # plus vphoned.signed for a live install. They are arm64
# iphoneos Mach-Os; they never run on this host and their link lines
# say nothing about whether this .app is self-contained.
[[ "$f" == */Contents/Resources/guest/* ]] && continue
diff --git a/scripts/dist_manifest.sh b/scripts/dist_manifest.sh
index 7dbbc40d..6ff61ced 100755
--- a/scripts/dist_manifest.sh
+++ b/scripts/dist_manifest.sh
@@ -59,9 +59,8 @@ done
#
# What is deliberately ABSENT is as important:
# repos/ toolchain submodules — build tier, sources only
-# tweakloader/ vpregister/ vcamcaptured/ camfix/ .m sources; the compiled
-# artifacts ship in Contents/Resources/guest instead, so the
-# install needs no iPhoneOS SDK
+# ../siblings/ optional guest sources and archives; not part of the
+# shipped app or automatic VM installation
# vphoned/*.m *.h vendor/ Makefile same, and it is the bulk of scripts/
print -r -- "payloads/AppleParavirtGPUMetalIOGPUFamily.tar" # guest GPU driver
print -r -- "vphoned/vphoned.plist" # LaunchDaemon plist, injectLaunchDaemons
diff --git a/scripts/vcamcaptured/.gitignore b/scripts/vcamcaptured/.gitignore
deleted file mode 100644
index e5d04671..00000000
--- a/scripts/vcamcaptured/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-*.dylib
diff --git a/scripts/vcamcaptured/Makefile b/scripts/vcamcaptured/Makefile
deleted file mode 100644
index 3b401895..00000000
--- a/scripts/vcamcaptured/Makefile
+++ /dev/null
@@ -1,23 +0,0 @@
-# libvcamcaptured — dylib loaded into cameracaptured via LC_LOAD_DYLIB
-
-SRCS := $(wildcard *.m)
-OUT := libvcamcaptured.dylib
-
-.PHONY: all clean
-
-all: $(OUT)
-
-$(OUT): $(SRCS) $(wildcard *.h)
- @echo "=== Building libvcamcaptured (arm64e, iphoneos, dylib) ==="
- xcrun -sdk iphoneos clang -arch arm64e -Os -fobjc-arc \
- -dynamiclib \
- -install_name /var/jb/usr/lib/libvcamcaptured.dylib \
- -I. \
- -o $@ $(SRCS) \
- -framework Foundation \
- -framework CoreMedia \
- -framework CoreVideo
- @echo " built OK ($$(stat -f%z $(OUT)) bytes)"
-
-clean:
- rm -f $(OUT)
diff --git a/siblings/Makefile b/siblings/Makefile
new file mode 100644
index 00000000..f42de999
--- /dev/null
+++ b/siblings/Makefile
@@ -0,0 +1,62 @@
+# Optional guest components. Build on the developer machine with the iPhoneOS SDK.
+# Nothing here is staged into vphone-cli.app or installed in a VM.
+
+OUT := $(abspath ../.build/siblings)
+STAGE := $(OUT)/stage
+ARCHIVE := $(OUT)/siblings.tar
+CLANG := xcrun --sdk iphoneos clang
+COMMON_FLAGS := -arch arm64e -miphoneos-version-min=26.0 -Os -fobjc-arc
+
+CAMFIX := $(STAGE)/camfix/libcamfix.dylib
+VCAMCAPTURED := $(STAGE)/vcamcaptured/libvcamcaptured.dylib
+TWEAKLOADER := $(STAGE)/tweakloader/TweakLoader.dylib
+VPREGISTER := $(STAGE)/vpregister/vpregister
+ARTIFACTS := $(CAMFIX) $(VCAMCAPTURED) $(TWEAKLOADER) $(VPREGISTER)
+PLISTS := $(STAGE)/camfix/libcamfix.plist $(STAGE)/vcamcaptured/libvcamcaptured.plist
+
+.PHONY: all package clean
+
+all: $(ARTIFACTS) $(PLISTS)
+
+package: all
+ @rm -f $(ARCHIVE)
+ @/usr/bin/tar -cf $(ARCHIVE) -C $(STAGE) camfix vcamcaptured tweakloader vpregister
+ @echo "Packaged $(ARCHIVE)"
+
+$(STAGE)/camfix $(STAGE)/vcamcaptured $(STAGE)/tweakloader $(STAGE)/vpregister:
+ @mkdir -p $@
+
+$(CAMFIX): camfix/libcamfix.m | $(STAGE)/camfix
+ $(CLANG) $(COMMON_FLAGS) -dynamiclib \
+ -install_name /var/jb/usr/lib/libcamfix.dylib \
+ -o $@ $< \
+ -framework Foundation -framework AVFoundation -framework ImageIO \
+ -framework IOSurface -framework CoreMedia -framework CoreVideo \
+ -framework CoreGraphics -framework QuartzCore
+ @codesign --force --sign - $@
+
+$(VCAMCAPTURED): vcamcaptured/libvcamcaptured.m | $(STAGE)/vcamcaptured
+ $(CLANG) $(COMMON_FLAGS) -dynamiclib \
+ -install_name /var/jb/usr/lib/libvcamcaptured.dylib \
+ -o $@ $< \
+ -framework Foundation -framework CoreMedia -framework CoreVideo
+ @codesign --force --sign - $@
+
+$(TWEAKLOADER): tweakloader/TweakLoader.m | $(STAGE)/tweakloader
+ $(CLANG) $(COMMON_FLAGS) -dynamiclib \
+ -install_name /var/jb/usr/lib/TweakLoader.dylib \
+ -o $@ $< -framework Foundation
+ @codesign --force --sign - $@
+
+$(VPREGISTER): vpregister/vpregister.m | $(STAGE)/vpregister
+ $(CLANG) $(COMMON_FLAGS) -o $@ $< -framework Foundation
+ @codesign --force --sign - $@
+
+$(STAGE)/camfix/libcamfix.plist: camfix/libcamfix.plist | $(STAGE)/camfix
+ @cp $< $@
+
+$(STAGE)/vcamcaptured/libvcamcaptured.plist: vcamcaptured/libvcamcaptured.plist | $(STAGE)/vcamcaptured
+ @cp $< $@
+
+clean:
+ @rm -rf $(OUT)
diff --git a/siblings/README.md b/siblings/README.md
new file mode 100644
index 00000000..52ce2b86
--- /dev/null
+++ b/siblings/README.md
@@ -0,0 +1,18 @@
+# Optional sibling components
+
+`make siblings_package` (or `make -C siblings package`) cross-compiles the
+four optional guest components with Xcode's iPhoneOS SDK and writes
+`.build/siblings/siblings.tar`. The archive contains signed arm64e binaries and
+the two tweak filter plists:
+
+| Component | Archive contents |
+| --- | --- |
+| Camera app hook | `camfix/libcamfix.dylib`, `camfix/libcamfix.plist` |
+| Camera daemon hook | `vcamcaptured/libvcamcaptured.dylib`, `vcamcaptured/libvcamcaptured.plist` |
+| Tweak loader | `tweakloader/TweakLoader.dylib` |
+| iOS 27 app registrar | `vpregister/vpregister` |
+
+This is a build artifact, not a VM bootstrap. The normal JB build and install
+flow does not stage or install these components. The GPU component is handled
+separately until its firmware-derived build flow is integrated here; no Apple
+GPU driver is stored in this directory.
diff --git a/scripts/camfix/libcamfix.m b/siblings/camfix/libcamfix.m
similarity index 100%
rename from scripts/camfix/libcamfix.m
rename to siblings/camfix/libcamfix.m
diff --git a/scripts/camfix/libcamfix.plist b/siblings/camfix/libcamfix.plist
similarity index 100%
rename from scripts/camfix/libcamfix.plist
rename to siblings/camfix/libcamfix.plist
diff --git a/scripts/tweakloader/README.md b/siblings/tweakloader/README.md
similarity index 100%
rename from scripts/tweakloader/README.md
rename to siblings/tweakloader/README.md
diff --git a/scripts/tweakloader/TweakLoader.m b/siblings/tweakloader/TweakLoader.m
similarity index 100%
rename from scripts/tweakloader/TweakLoader.m
rename to siblings/tweakloader/TweakLoader.m
diff --git a/scripts/vcamcaptured/libvcamcaptured.m b/siblings/vcamcaptured/libvcamcaptured.m
similarity index 100%
rename from scripts/vcamcaptured/libvcamcaptured.m
rename to siblings/vcamcaptured/libvcamcaptured.m
diff --git a/scripts/vcamcaptured/libvcamcaptured.plist b/siblings/vcamcaptured/libvcamcaptured.plist
similarity index 100%
rename from scripts/vcamcaptured/libvcamcaptured.plist
rename to siblings/vcamcaptured/libvcamcaptured.plist
diff --git a/scripts/vpregister/vpregister.m b/siblings/vpregister/vpregister.m
similarity index 87%
rename from scripts/vpregister/vpregister.m
rename to siblings/vpregister/vpregister.m
index e966b674..f994597b 100644
--- a/scripts/vpregister/vpregister.m
+++ b/siblings/vpregister/vpregister.m
@@ -6,6 +6,7 @@
// (no args = scan /var/jb/Applications/*.app).
#import <Foundation/Foundation.h>
#import <dlfcn.h>
+#import <objc/message.h>
@interface LSApplicationWorkspace : NSObject
+ (instancetype)defaultWorkspace;
- (BOOL)registerContainerizedApplicationWithInfoDictionaries:(NSArray *)infos
@@ -46,7 +47,17 @@ static BOOL register_app(LSApplicationWorkspace *ws, NSString *path) {
int main(int argc, char **argv) {
@autoreleasepool {
dlopen("/System/Library/Frameworks/CoreServices.framework/CoreServices", RTLD_NOW);
- LSApplicationWorkspace *ws = [LSApplicationWorkspace defaultWorkspace];
+ Class workspaceClass = NSClassFromString(@"LSApplicationWorkspace");
+ if (!workspaceClass) {
+ fprintf(stderr, "LaunchServices workspace is unavailable\n");
+ return 1;
+ }
+ LSApplicationWorkspace *ws = ((id (*)(id, SEL))objc_msgSend)(
+ workspaceClass, @selector(defaultWorkspace));
+ if (!ws) {
+ fprintf(stderr, "LaunchServices workspace could not be opened\n");
+ return 1;
+ }
NSMutableArray *paths = [NSMutableArray array];
for (int i = 1; i < argc; i++) [paths addObject:@(argv[i])];
if (paths.count == 0) {