Run a virtual iPhone on an Apple Silicon Mac.
Swift
Merge branch 'pr-811' into merge-pr-811
Jacky583684766d94
diff --cc Research/0_binary_patch_comparison.mdindex 707f5427,c29020cf..92c4c7fd--- a/Research/0_binary_patch_comparison.md+++ b/Research/0_binary_patch_comparison.md@@@ -6238,391 -5996,97 +6243,486 @@@ completion covers the argument kinds thfetch buffer, vertex id, textures, samplers, fragment inputs, position andvertex outputs, render targets); an argument kind the reflection reads in alayout the completion does not produce could still crash the compiler+ service. With primitive restart no longer sent, a strip that draws vertex+ 65535 while restart is disabled is cut there. This includes ES2 and ES3's+ initial or explicitly disabled state; row 33 addresses that gap.++ ## Native GLES follow-up (2026-11-02)++ Rows 31–36 are selected by `standard` only for iOS 26.6/cloudOS 26.4,+ including patch releases; TV, HomePod and HomeView presets exclude them.+ A missing plan enables none, opt-in cannot widen the version gate, and current+ guest selections can enable declarations absent from an older boot plan.++ **Orientation, `system-systemhook-cfw-gles_upper_left` (row 31).** Reveal+ AppleMetalGLRenderer's `AGX_GL_VIEWPORT_INVERT_CONFIG` / `UPPER_LEFT` strings+ and `populateConfigData`, then follow `drawableInvert`, `drawablePBEInvert`,+ `updateRenderViewport` and `updateRenderScissor`. SystemHook selects this+ existing viewport/scissor path at constructor entry only while the installer+ marker exists, preserving explicit environment values. It avoids the private+ IOSurface attachment `yInvert` flag that had no effect in PV controls.+ No Apple binary changes; opt-out removes the marker.++ **Descriptor, `dyld-cfw-metal_vertex_id_format` (row 32).** Resolve Metal's+ image-local `PipelineLibrarySerializer::serializeVertexDescriptor` and format+ getter; prove the unique wire-property-1 write from decoded operands/control+ flow. A 32-byte trampoline converts only private ID formats 43/44 to UInt+ (36) at that write, after guest shader variant generation. Original descriptors,+ AIR and other formats remain intact. Private format 43 reproduced the host+ `CloneAttributeDescriptor` crash; the same AIR with UInt compiled successfully.++ **Restart, `dyld-cfw-gles_primitive_restart` (row 33).** Resolve+ `gldRenderVertexArray` and `updateRenderPrimitiveRestart`; derive state fields+ from the decoded updater. A 68-byte entry trampoline returns zero only for+ disabled indexed line/triangle strips, selecting GLEngine's existing primitive+ expansion, which retains vertex/instance IDs in a nonindexed draw. Other draws+ keep their normal path. All affected strips pay CPU copying cost. Dependencies+ are command suppression (row 30) and ID-format repair (row 32); removing only+ the unsupported command leaves Metal's maximum-index restart active.++ **Points, `dyld-cfw-gles_point_draw` (row 34).** Recover full next-symbol+ function bounds and context fields from `setRenderPipeline`. Replace three+ point-size bit-7 `TBZ` guards in `gldRenderVertexArray` and one in+ `gldEndPrimitiveBuffer` with NOPs; preserve point-mode, pipeline, buffer and+ other gates. The indexed path must prove the exact NUL-terminated draw selector+ in `beginRenderPass`, encoder/selector arguments to `methodForSelector:`,+ returned IMP store and use of the recovered encoder/IMP slots. Validate all+ four sites before writing. PV's inherited pipeline-flags method returns zero;+ no global reflection flags are fabricated to compensate.++ **Identity, `system-paravirt_gpu-cfw-compiler_cache` (row 35).** Reveal+ `setupCompiler` through relative Objective-C metadata, then verify imported+ SHA-256 Init/Update/Update/Final dataflow, both eight-byte date/time inputs and+ use of the digest as `cacheUUID`. Decoded code references to both literals+ must be exclusive to these inputs. Replace only their 16 bytes with base64 of+ the installed plugin's first 12 SHA-256 bytes (96 identity bits), preserving+ terminators; validate and read back both writes. The installer hashes the+ actual plugin after refresh, composes selected driver patches from one pristine+ backup and signs the result. Opt-out restores the original seed while retaining+ other selected driver changes.++ **Reuse, `dyld-cfw-metal_cache_reuse_key` (row 36).** Row 29's original+ interpretation was incomplete: `FS_CACHE_REUSE_ON_REBOOT=1` skips the 32-byte+ key check as well as the 64-byte boot/system-stamp check. In `libCoreFSCache`,+ follow the environment branch and both comparisons; prove the recovered+ skip-boot flag's complete lifetime, semantic uses and callee-save restoration.+ Redirect only the reuse-enabled branch through an eight-byte trampoline that+ sets the flag to one and resumes at the existing key comparison after its+ normal assignment. A mismatched key rejects the cache; a matching key skips+ only the boot comparison. The no-reuse path is unchanged. This and row 35+ invalidate stale compiler output without deleting application caches.++ All four DSC patches snapshot code/hash bytes, re-attest changed pages and+ capture undo before publication. Trampolines require verified unused executable+ header padding. Unsupported shapes and occupied space are refused. Failed+ writes are restored and read back; failed restoration retains recovery records+ and reports possible partial modification. Actual 23G90 point and cache-reuse+ apply/repeat/undo checks each restore all 85 files exactly; repeats change+ neither bytes nor undo records. Points change four instructions and one page+ hash; reuse changes one branch, an eight-byte cave and two page hashes.++ Selection preflight rejects compiler identity plus cross-boot reuse without+ key validation, exiting 64 before disk attachment or mutation. Installation+ also verifies that key validation actually applied before any plugin refresh,+ requires a private APFS clone of `Disk.img`, and discards it if identity patching+ fails. Host tests cover the applied-key dependency and failure handling;+ clone-discard paths were not exercised through injected VM failures.++ Retained tests cover malformed discovery, exact identity writes, same/different+ plugin replay, rollback and selection/dependency guards. Generated ARM64 executes+ 192 restart draw/state combinations; cache tests validate the production+ trampoline and semantic discovery in a `verify_list_file` fixture. AIR tests+ cover ES1 metadata and GLES-only point-coordinate adaptation, preserving unrelated+ inputs and rejecting malformed ones. Development builds were tested on iOS+ 26.6.2 (23G90)/cloudOS 26.4 (23E5207q), macOS 26.6.2 (25G83, Apple M5 Max).+ See [GPU research](Guest/gpu_acceleration.md#native-gles-semantics) for the+ failure controls, historical installed-VM results, replay procedure and limits.+++service. With primitive restart no longer sent, an OpenGL ES 2 strip that draws+vertex 65535 is cut there.++## The stock launchd_cache_loader takes a re-signed launchd.plist (2026-11-01)++`minimal` used to keep one userland security patch,+`filesystem-boot-launchd_cache_loader_unsecure_cache_gate`, because vphoned's+entry in `/System/Library/xpc/launchd.plist` made the stock loader refuse the+file. It no longer needs it: `filesystem-boot-vphoned` signs the edited file+the way Apple signs it, and the static trust cache the restore image already+rebuilds (and TSS signs) carries the new cdhashes. The patch is now+`filesystem-exp-launchd_cache_loader_unsecure_cache_gate`, not boot-essential,+left out of `minimal` and `watchos`; `renamedPatches` migrates a VM's old+record. A Watch7,18 watchOS 26.4 (23T240) guest on cloudOS 26.4 (23E244),+restored with the gate blocked, booted to the pairing screen with vphoned up:+its stock loader logged "cdhash: … 0xeacd92f9… is trusted" for the re-signed+`launchd.plist.sig` and "Cache sent to launchd successfully" (2026-11-02).++What the loader checks (`/usr/libexec/launchd_cache_loader`, libxpc-2894.140.12,+iOS 18.6 22G86, read from the disassembly):++1. `0x100000a44`: the default paths, `/System/Library/xpc/launchd.plist` and+ `/System/Library/xpc/launchd.plist.sig` ("Code: %s Sig: %s").+2. `0x100000b2c`: `kern.bootargs`; with `launchd_unsecure_cache=` the+ `cbz x0` at `0x100000b58` falls into "Using unsecure cache" and skips 3-6.+ That `cbz` is what the old patch NOPs.+3. `SecStaticCodeCreateWithPath(plist)`, `SecCodeSetDetachedSignature(sig)`,+ `SecStaticCodeCheckValidity(code, 6)` (no executable or resource+ validation; errSecCSSignatureNotVerifiable, -67060, is let through).+4. `SecCodeCopySigningInformation` → `kSecCodeInfoUnique` (the cdhash) →+ `IOConnectCallMethod` selector 6 on `AppleMobileFileIntegrity`+ (`AppleMobileFileIntegrityUserClient::isCdhashInTrustCache` in the kernel+ log). Not found (`0xe00002f0`) logs "cdhash: %s is not in trust cache" and+ aborts (`abort_with_reason`).+5. `SecCodeMapMemory` attaches the signature to the vnode ("Failed to push+ signature to kernel" otherwise), so the pages read next are checked against+ the code directory.+6. `open`/`mmap` the plist, copy it into memory mapped into launchd ("Sending+ validated cache to launchd").++`launchd.plist.sig` is a detached ad hoc signature: a SuperBlob with a SHA-1+code directory, empty requirements, a SHA-256 alternate code directory, an+empty CMS wrapper and an identification wrapper (slot 0x10001) holding the+file's SHA-1. Both directories are version 0x20500, flags 0x10002 (ad hoc,+runtime), runtime version 11.0.0, 4 KiB pages, identifier+`launchd-<sha1 of the file>`. The stock static trust cache+(`043-19071-100.dmg.aea.trustcache`) lists both cdhashes of Apple's file+(`72c3cf9a…` SHA-256, `2e45eca3…` SHA-1), as it does those of+`extensions.plist.sig`. `cryptexctl generate-trust-cache` hashes Mach-O code+directories only, so the edited plist's new signature has to be added by hand.++`CustomFirmwareDetachedSignature` writes that signature: for 22G86's+`extensions.plist` it reproduces Apple's `extensions.plist.sig` byte for byte+(`codesign -s - -o runtime --pagesize 4096 --detached` differs only in its+0x20100 header). `resignLaunchdCache` replaces `launchd.plist.sig` (root:admin+0644) after vphoned's entry is merged; `createTrustcache` reads it back from the+image and hands `cryptexctl` a second `--base-trust-cache`, a raw version 1+trust cache with its two cdhashes. Apple's stale entries stay; nothing has+their bytes any more.++Checked on 2026-11-01: `vm create lcl-186 --preset minimal --device iPhone11,6`+(18.6 22G86 on cloudOS 22G86, bundle 2.12.2-local.442efa84) signed the plist+(`c6a34260…` SHA-1, `b4ace6ca…` SHA-256), the rebuilt `new.trustcache` held+both, the patch log listed the gate under "Turned off", and the boot log shows+the secure path:++```+Code: /System/Library/xpc/launchd.plist Sig: /System/Library/xpc/launchd.plist.sig+…isCdhashInTrustCache…: Returning IOReturn 0x0 to process 28+cdhash: {length = 20, bytes = 0xb4ace6cacd1e77cf9b8546e7c9bed89a0914462e} is trusted+Attached signature to file, checking ...+Sending validated cache to launchd+Cache sent to launchd successfully+```++with no "Using unsecure cache". SpringBoard came up and `guest rpc+processes.list` answered from `/usr/bin/vphoned`.++## Launch-constraint categories in the rebuilt static trust cache (2026-11-02)++`filesystem-boot-cryptex_merge` rebuilds the static trust cache with+`cryptexctl generate-trust-cache`, which writes a version 1 cache: entries of+cdhash, hash type and flags, no launch-constraint category. Apple's iOS trust+caches (the OS's `StaticTrustCache`, `Cryptex1,SystemTrustCache` and+`Cryptex1,AppTrustCache`) are version 2 and give each cdhash a category, so on+a `minimal` guest every system service ran with category 0 and the kernel+logged `Launch Constraint Violation (not enforcing) … launched as a system+service unexpectedly but met System Service constraints` for each: 212 lines+(355 distinct programs) in lcl-186's serial log of one 18.6 Minimal boot,+303 lines (898 occurrences) in `iphone-265.log`, a 26.5 Minimal boot.++`createTrustcache` now rewrites cryptexctl's output as version 2+(`TrustCache.withConstraintCategories`): each entry gets the category its+cdhash has in Apple's three caches; a file the merge signs again gets the+category its IPSW cdhashes had (`resignedCDHashes`: `launchd_cache_loader`+where it is still patched, mobileactivationd, and the detached+`launchd.plist.sig` of "The stock launchd_cache_loader takes a re-signed+launchd.plist"); what Apple's caches do not list (vphoned, its Swift library,+the GPU driver bundle, kexts Apple left out) keeps 0. Entries, order, flags,+UUID and the IM4P's type and description stay as cryptexctl wrote them.++The detached signature's cdhashes reach cryptexctl through the second base+trust cache and are in none of Apple's caches. Apple's 22G86 static trust+cache (`043-19071-100.dmg.aea.trustcache`) gives both cdhashes of its own+`launchd.plist.sig` (`72c3cf9a…` SHA-256, `2e45eca3…` SHA-1) category 2, and+`resignLaunchdCache` maps the new cdhashes to those. Apple's 26.5 static+trust cache (`094-54920-099.dmg.aea.trustcache`) does the same for its+`launchd.plist.sig` (`b2f662df…` SHA-1, `cb7da9ce…` SHA-256).++Checked on 2026-11-02 with two `minimal` guests that also carried the other+Minimal changes of that week (a stock LLB with only iBEC's image-4 callback+patched, vphoned's paravirtual user-client entitlements, the restore tree+published as clones). int-186 (iPhone11,6 18.6 22G86 on cloudOS 22G86, bundle+2.12.2-local.c632b261), patch log:++```+[+] Apple's launchd.plist.sig: cdhash 2e45eca3ba25f02a7166775802481dfadaa2757c+[+] Apple's launchd.plist.sig: cdhash 72c3cf9a1de7d4eb05fe0da99889cbb47ab41afc+[+] Signed launchd.plist: cdhash c6a34260… (hash type 1)+[+] Signed launchd.plist: cdhash b4ace6ca… (hash type 2)+[+] Constraint categories for 6228 of 6693 trust cache entries+[+] Re-signed cdhash 5c5eb26e… (hash type 2): category 3 (mobileactivationd)+[+] Re-signed cdhash b4ace6ca… (hash type 2): category 2+[+] Re-signed cdhash c6a34260… (hash type 1): category 2+```++The installed `new.trustcache` is version 2, 3428 CDHashes, with both new+cdhashes at category 2. A reboot's unified log (Persist tracev3 pulled with+`guest pull` and read with `log show` over a hand-built archive, since the+stock LLB passes no serial boot-args) shows:++- `isCdhashInTrustCache … Process 28 is checking if a cdhash is in the trust+ cache` / `Returning IOReturn 0x0 to process 28`, the same pid and pair+ lcl-186's serial log shows just before `cdhash: … b4ace6ca… is trusted`.+ The loader's own lines are not in the persisted log (it runs before logd).+- Two `Launch Constraint Violation (not enforcing) … met System Service+ constraints` lines, for `/usr/libexec/init_exclavekit` and+ `/usr/bin/vphoned`, both at category 0 because Apple's caches do not list+ them.+- No `Launch Constraint Violation (enforcing)`, no CODESIGNING exit, no crash+ report (`idevicecrashreport -k`: only `restore_perform.txt`);+ launchd_cache_loader, mobileactivationd and vphoned ran.++int-265 (iPhone17,3 26.5 23F77 on cloudOS 23F75) was built with `minimal`+plus `--allow llb-boot-boot_args --allow ibec-boot-boot_args`, so that the+host serial log has the boot. Its patch log gives 6729 of 7277 entries a+category, the new `launchd.plist.sig` cdhashes (`4230469c…`, `20f70244…`)+category 2 and mobileactivationd's category 3, and the serial log shows the+secure path:++```+Code: /System/Library/xpc/launchd.plist Sig: /System/Library/xpc/launchd.plist.sig+cdhash: {length = 20, bytes = 0x20f702440c87a4d86aa49deca652100424c19381} is trusted+Attached signature to file, checking ...+Sending validated cache to launchd+Cache sent to launchd successfully+```++with three `Launch Constraint Violation (not enforcing)` lines+(`MobileAssetEarlyBootTask`, `init_exclavekit`, `vphoned`), no enforcing+violation and no crash report.++## Always On display (2026-11-02)++No new patch identifier and no new bytes in an Apple binary.+`preboot-cfw-devicetree_iphone_product` (the iPhone product repair, which `cfw+install` and `cfw update-environment` run) also adds+`/product/vphone-always-on-display = 1` when the board's own tree has+`/arm-io/disp0` `always-on-time`. MobileGestalt reads nothing by that name.+vphoned reads it at startup and answers DeviceSupportsAlwaysOnDisplay+(`2OOJf1VhaM7NxfRok3HbWQ`) and DeviceSupportsAlwaysOnTime+(`j8/Omm6s1lsmTDFsXjsBfA`) yes in the MobileGestalt cache's `CacheExtra`+(`GuestMobileGestaltAnswers`, `GuestMobileGestaltCache.presentAlwaysOnDisplayOnStartup`).+Settings then offers Always On Display and SpringBoard dims the Lock Screen+instead of turning it off. Issue #650.++**Why not the tree.** libMobileGestalt (24A446) answers the three questions from+one node:++| Answer | Source |+| --- | --- |+| DeviceSupportsAlwaysOnTime | `IODeviceTree:/arm-io/disp0` `always-on-time` |+| DeviceSupportsAlwaysOnDisplay | AlwaysOnTime, else `disp0` `always-on-device` |+| DeviceSupportsAlwaysOnDisplayFlipbook | AlwaysOnTime, else `disp0` `always-on-device-flipbook` |++Settings shows the row only with AlwaysOnTime (DisplayAndBrightnessSettings+asks for it; with AlwaysOnDisplay alone there is no row, measured). The board's+`always-on-time` therefore answers the flipbook yes too. CoreBrightness reads it+in backboardd (`-[CBAODState initializeAODSupportConfiguration]`) and drives the+flipbook through the panel controller (DCP), which the paravirtual panel does+not have. An iPhone18,1 27.0.1 guest with an `/arm-io/disp0` stub carrying the+board's `always-on-time` lost backboardd at every boot (`rebooting due to+critical process crashes: backboardd`) and launchd restarted it into the device+recovery environment. A second guest made without the stub booted, and+answering all three yes in its `CacheExtra` crashed it the same way. Without+the flipbook, `-[BLSHBacklightOSInterfaceProvider initWithPlatformProvider:]`+gives SpringBoard BacklightServices' own renderer (`BLSHPseudoFlipbook`), which+works on a guest. Answering the first two in the cache leaves the flipbook+unanswered there and so no. Keeping `always-on-time` in the tree and answering+the flipbook no in the cache would not do: the tree decides whenever the cache+is missing, at a guest's first boot and after every drop, and one boot with the+flipbook is enough to lose backboardd.++A guest that went through that crash loop kept losing backboardd after the+answers and the whole cache were removed; the cause was not found. Do not+test the flipbook answer on a VM you want to keep.++**When the answers land.** libMobileGestalt writes the cache when a process+first asks after it is gone: at a guest's first boot, and after vphoned drops a+cache older than the tree. vphoned waits for it (up to 10 minutes), adds the+answers once, and sets `mobilegestalt_restart_pending`; the cache keeps them+across boots, and a rebuilt cache gets them again at the next start. A new+machine's creation boots more than once, so it is offered from its first use.++**The window.** On a foldable guest the VM window covers the panel while+`display.orientation` says `screen_off`, so a waking panel does not show its+frame from before (`bde6440c`). SpringBoard posts `hasBlankedScreen` for the+always-on Lock Screen too, so the window covered it. FoldDisplay now publishes+whether the panel went off since SpringBoard last lit the screen+(`com.vphone.folddisplay.panel-dark`: 1 stayed on, 2 went off), and+`screen_off` is SpringBoard's blank and that.++**Verified.**+- New machine: iPhone18,1 27.0.1, cloudOS 26.4, bundle from this branch on+ 2.14.2. `cfw install` logged `product/vphone-always-on-display: 'absent' ->+ '01000000'`; with nothing done by hand, the cache had both answers yes and the+ flipbook unanswered, Settings showed Always On Display On, and the locked+ screen stayed dimmed with the clock moving (9:34 to 9:36). No backboardd crash.+- Existing machine: iPhone19,4 27.1 (24A94425), `vm set-bundle+ --update-environment`. The repair added the marker; the next boot dropped the+ cache, the rebuilt one got the answers and the restart was reported pending;+ after the restart the Lock Screen went always-on, the panel state stayed 1,+ `screen_off` false, and the VM window showed it. With Always On Display+ switched off in Settings the panel went off (state 2), `screen_off` was true+ and the window covered it, then uncovered it on wake.++**Not covered.** Other iPhones with the display were not run. Apple Watch:+N227b's tree has `always-on-time` too, but on a Watch7,18 26.4 guest the same two+answers left the screen fully dark after the timeout (Carousel decides; not+investigated), so the repair stays iPhone-only. No iPad board has the property.+The VM keeps rendering while dimmed: there is no low-power display.++## Experimental iOS 16.6.1 desktop bring-up++Measured pairing: iPhone15,2 (iPhone 14 Pro), iOS 16.6.1/20G81 userland,+cloudOS 26.1/23B85 vphone600 boot chain. All additions below are manual opt-ins;+shipped presets and the no-plan path leave them disabled. See+`Research/Guest/ios16_bringup.md` for procedure, evidence and limitations.++- `system-launchd-exp-ios16_mach_ports` bridges the old out-of-line self-task+ Mach-port API to the newer fixed-three-port RPCs in the native launch hooks.+ `dyld-exp-ios16_mach_ports_lookup` updates the old libxpc client's pre-constructor+ lookup through a symbol-derived, bounded cache patch with undo capture.+- `system-backboard-exp-ios16_migration` skips the fresh lab's measured migration+ wait and releases its local shell sentinel/PreBoard re-block. It does not+ migrate existing user data or persist completion. `system-springboard-exp-ios16_desktop`+ avoids unavailable startup media, widget and flashlight services and uses the+ native local setup-state setter. These services remain unavailable.+- `system-systemhook-exp-ios16_surface` converts capability replies 0x28 ->+ 0x18 and allocation/lookup replies 0xC68 -> 0xA68, including narrowed fields+ and the changed plane stride. Offline metadata derives the framework-private+ transport stub, verifies its instruction pattern and records its Mach-O UUID.+ The runtime detour checks UUID/expected bytes, suspends peer threads, uses+ private COW memory without writable executable pages, and restores protection.+- `system-systemhook-exp-ios16_framebuffer` translates the measured old 0x46C+ SwapEnd payload into the modern 0x560 layout. It inserts the new event/port+ slots, retaining frame token, surfaces, rectangles and measured flags. Native+ create/lock/write/read/unlock and surface lookup probes pass; submitted color+ bars and the real SpringBoard desktop are visible.+- `preboot-exp-ios16_ephemeral_storage` changes only the existing chosen/product+ ephemeral-storage fields, preserving their widths and tree size. Native+ `hw.ephemeral_storage` and `os_variant_uses_ephemeral_storage` then report 1;+ PreBoard no longer owns the shell. Restore pre-ephemeral snapshots to undo+ guest data effects; restoring device-tree bits alone is insufficient.+- `system-vphoned-exp-ios16_touchscreen` registers a built-in HID touchscreen+ only when none exists. With desktop startup selected, native backlight-state+ changes also publish the legacy HID factor. Real mouse swipes and clicks now+ reach the guest rather than being dropped as missing-digitizer/display-off.+- `system-springboard-exp-ios16_keybagless_ui` is restricted to a fresh ephemeral+ lab. The root daemon requires explicit markers and a strict session/persona+ keybag-directory allowlist before publishing a single-link, root-owned,+ magic-checked lease. Three signature-checked UI getters honor that lease for+ at most three seconds and otherwise forward to native. MKB/AKS and encrypted+ data remain unchanged; this is not working credentials or protected storage.+- The existing battery helper weak-imports the unavailable newer precise-power+ API and falls back to its existing ByType API. This resolves the measured+ Preferences pre-main dyld crash without synthesizing an IOKit export.++The real guest displays Home Screen, accepts mouse input and opens Settings >+General > About (16.6.1, iPhone 14 Pro, 64 GB). Initial About lookup can wait for+IOKit/SystemConfiguration quiescence; a proposed fallback was never deployed and+is excluded. Wallpaper preview fails without Metal; its cancelled, unvalidated+prototype is excluded as well. No general iOS 16/15, Metal, full audio, camera,+networking or persistent protected-data compatibility is claimed.++## Userspace debugging on `minimal`, watchOS and HomePod (2026-11-02)++`system-debugserver-cfw-install` re-signs the guest's `/usr/libexec/debugserver`+(strips `seatbelt-profiles`, sets `task_for_pid-allow`, ad hoc) in `cfw install`,+which `minimal` never runs. `filesystem-exp-debugserver` makes the same change in+the restore-image merge, before the reseal, so the new hash lands in the+regenerated static trust cache. Both stages share the entitlement transform+(`CustomFirmwareDebugserver.attachEntitlements`) and are a logged no-op when the+system ships no debugserver. The merged iPhone17,3 26.5, Watch7,18 26.4 and+HomePod Software 27.0 systems all ship one. A watch's debugserver also carries an+arm64_32 slice the signer cannot rewrite, so the merge thins it to arm64e first.++The entitlement alone does not let debugserver run or attach on `minimal`'s stock+kernel and TXM: AMFI asks TXM for developer mode and kills it ("Developer mode is+disabled, task_for_pid-allow is disallowed"), and an enrolment from the guest does+not survive a forced reboot. The `userspace-debugging` feature+(`FirmwarePatchSetCatalog.userspaceDebugging`) is the smallest set found to attach+to a system daemon and read its memory:++| Part | `minimal` / `watchos` | HomePod (`cfw install`) | Why |+| --- | --- | --- | --- |+| debugserver | `filesystem-exp-debugserver` | `system-debugserver-cfw-install` | The re-signed debugserver. |+| launchd | `filesystem-exp-launchd_jetsam_panic_guard` | `system-launchd-boot-jetsam_panic_guard_bypass` | See below. |+| kernel | `kernel-cfw-task_for_pid`, `kernel-boot-task_conversion_eval`, `kernel-cfw-debugger`, `kernel-boot-port_to_map`, `kernel-boot-proc_security_policy`, `kernel-boot-cred_label_update_execve` + `kernel-boot-hook_cred_label` | already in the preset | Task port for a process the caller does not own, and its conversion; the debugger gate `task_for_pid` checks; no panic converting the port to a vm_map; the per-process policy; the platform label and the MACF hook that reaches it. |+| TXM | `txm-boot-developer_mode_bypass`, `txm-cfw-debugger_entitlement`, `txm-boot-sel42_29` + `txm-cfw-get_task_allow` | already in the preset | Developer mode on without enrolment; selector 42's debugger entitlement check; the target's get-task-allow byte where selectors 42 and 41 read it. |++A part names one patch per delivery, and a preset takes the first its sets+declare. `standard` already has every part, so Launchpad offers no box there. The+Apple TV presets get none either: `cfw install` refuses debugserver and launchd+patches not validated for tvOS (`FirmwareGuestPatchResolution`), and the feature+checks that list. HomePod's list now admits the two, as validated below.++**AMFI patches are not needed.** `kernel-boot-amfi_trustcache` and+`kernel-boot-amfi_execve` were in the first cut "should debugserver run outside+the image's trust cache". It doesn't: the re-sign is in the resealed trust cache.+An iPhone17,3 26.5 `minimal` guest without them launches the re-signed+debugserver from launchd and attaches.++**launchd's jetsam guard.** With developer mode on, the host's CoreDevice (a+`minimal` guest pairs with the Mac over the NAT) mounts Xcode's personalized+Developer disk image whenever a developer service needs it, for example+`xcrun devicectl device info processes`. `MobileStorageMounter` mounts+`Xcode_iOS_DDI`, launchd loads its daemons, and launchd kills init:+`initproc exited -- ... jetsam property category (Daemon) is not initialized`.+Observed on the first boots of an iPhone guest without the patch (and in an+earlier `minimal-ctf` machine's log). `standard` avoids it with+`system-launchd-boot-jetsam_panic_guard_bypass`; on `minimal` launchd is in the+sealed system, so `filesystem-exp-launchd_jetsam_panic_guard` applies the same+`CustomFirmwareJetsamPatcher` change in the merge. With it, the same+`devicectl` call mounts the DDI, `dtappserviced` starts, and the guest stays up.+On HomePod, launchd is patched for the persona adapter, which returned before+the jetsam verb; `cfw install` now applies both to the one copy.++To make the feature selectable without a preset of its own, `minimal` and+`watchos` name the two kernel sets and select nothing from them. The pipeline+builds a kernel patcher only when the plan turns on a patch from those sets (the+research board's kext mix targets the kernelcache too, so the target alone does+not say), so a plain `minimal` kernel stays stock. A feature is only a list of+patch identifiers: turning it on is `--allow` for each, and `fw patches` reports+it (`features` in `--json`, with `available` and the patches for the active+preset) so Launchpad's patch sheet offers one box without declaring a patch+itself. On an installed `minimal` VM a kernel patch is reported as delivered by+a restore, not by `cfw update-kernel`, which refuses a VM whose system was+customised before its restore.++Validation (Launchpad `vm create` with the feature's patches allowed, then a+launchd job running `/usr/libexec/debugserver 0.0.0.0:<port> --attach=<configd>`+and LLDB over gdb-remote: attach, `(int)getpid()` evaluated in the target, 16+bytes of its code read):++| Guest | Preset | Kernel and TXM | Result |+| --- | --- | --- | --- |+| iPhone17,3 26.5 (23F77) / cloudOS 26.5 (23F75) | `minimal` | 22 kernelcache (2 base + 20 cfw) and 9 TXM records | developer mode `enabled`; attach to configd in 6.8 s; DDI mounted by `devicectl`, no panic |+| Watch7,18 26.4 (23T240) / cloudOS 26.4 (23E244) | `watchos` | 22 kernelcache (2 base + 20 cfw) and 9 TXM records on the watch mix | developer mode `enabled`; attach to configd in 10.3 s; the watch is not paired with the Mac, so no host DDI mount |+| AudioAccessory5,1 27.0 (24J361) / cloudOS 26.4 (23E5207q) | `homepod-mini` | preset's own | attach to configd in 4.3 s; Xcode has no DDI for its board |+| iPhone11,6 18.6 (22G86) / cloudOS 18.6 (22G86) | `minimal` | 22 kernelcache (2 base + 20 cfw) and 9 TXM records, with the iOS 18 finders | developer mode `enabled`; attach to configd in 1.1 s; after pairing, `devicectl` mounted the DDI, no panic, attach still works |++On iOS 18 the feature needs the iOS 18 kernel and TXM finders of+`feature/ios18-standard` ("Find the standard kernel patches in the iOS 18+research board kernels", "Find the LLB rootfs and TXM CFW patches on cloudOS+18"). Without them `fw patch` stops at TXM: on cloudOS 18.6 the developer-mode,+debugger and get-task-allow sites are not found. The iOS 18 row ran with those+two commits on top of this branch.++On a stock boot chain (`minimal` and `watchos` with no iBEC or LLB patch, and+the launchd_cache_loader gate off; 2026-11-02) the feature works the same: the+same 22 kernelcache and 9 TXM records, `iBEC: no patches` and `LLB: no+patches` in the patch log, the stock LLB booting the patched kernel and TXM to+SpringBoard (iPhone17,3 26.5) and Carousel (Watch7,18 26.4) with vphoned up and+developer mode `enabled`, and LLDB attached to configd through the re-signed+debugserver, evaluated `(int)getpid()` and read 16 bytes at its pc. The watch+guest needed more than 2048 MB: at 2048 MB a stock LLB, with or without the+feature, stops the VM after `iLLB decompressed`; at 8192 MB both boot.diff --cc VPhoneExecutable/VPhoneCommand/FirmwarePatcher/PatchSets/FirmwareGuestSystemPatchSet.swiftindex f886eafa,e13dc4c1..119609d6--- a/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/PatchSets/FirmwareGuestSystemPatchSet.swift+++ b/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/PatchSets/FirmwareGuestSystemPatchSet.swift@@@ -25,24 -25,14 +25,30 @@@ public enum FirmwareGuestSystemPatchSepublic static let homePodAdHocInstall = "system-installd-exp-homepod_adhoc"public static let homePodMISFixLibrary = "/usr/lib/libvphonehomepodmisfix.dylib"public static let ios17Desktop = "system-springboard-exp-ios17_desktop"+ public static let ios16MachPorts = "system-launchd-exp-ios16_mach_ports"+ public static let ios16PortsLookup = "dyld-exp-ios16_mach_ports_lookup"+ public static let ios16Migration = "system-backboard-exp-ios16_migration"+ public static let ios16Desktop = "system-springboard-exp-ios16_desktop"+ public static let ios16Keybag = "system-keybag-exp-ios16_ephemeral"+ public static let ios16Surface = "system-systemhook-exp-ios16_surface"+ public static let ios16SurfaceMarker = "/usr/lib/vphone-ios16-surface"+ public static let ios16Framebuffer = "system-systemhook-exp-ios16_framebuffer"+ public static let ios16FramebufferMarker = "/usr/lib/vphone-ios16-framebuffer"+ public static let ios16EphemeralStorage = "preboot-exp-ios16_ephemeral_storage"+ public static let ios16Touchscreen = "system-vphoned-exp-ios16_touchscreen"+ public static let ios16TouchscreenMarker = "/usr/lib/vphone-ios16-touchscreen"+ public static let ios16KeybaglessUI = "system-springboard-exp-ios16_keybagless_ui"+ public static let ios16KeybaglessUIMarker = "/usr/lib/vphone-ios16-keybagless-ui"+ public static let ios16KeybagMarker = "/usr/lib/vphone-ios16-keybag-ephemeral"+ public static let ios16MachPortsMarker = "/usr/lib/vphone-ios16-mach-ports"public static let metalCacheReuse = "system-systemhook-cfw-metal_cache_reuse"public static let metalCacheReuseMarker = "/usr/lib/vphone-metal-cache-reuse"+ public static let glesUpperLeft = "system-systemhook-cfw-gles_upper_left"+ public static let glesUpperLeftMarker = "/usr/lib/vphone-gles-upper-left"+ public static let metalVertexIDFormat = "dyld-cfw-metal_vertex_id_format"+ public static let glesPrimitiveRestart = "dyld-cfw-gles_primitive_restart"+ public static let glesPointDraw = "dyld-cfw-gles_point_draw"+ public static let metalCacheReuseKey = "dyld-cfw-metal_cache_reuse_key"public static let gyroscope = "system-backboardd-cfw-gyroscope"public static let accelerometer = "system-backboardd-cfw-accelerometer"public static let hinge = "system-backboardd-cfw-hinge"diff --cc VPhoneExecutable/VPhoneCommand/VPhoneCommand/Firmware/VPhoneCustomFirmwareInstaller.swiftindex 05ff67ae,90fbcaac..f06079c3--- a/VPhoneExecutable/VPhoneCommand/VPhoneCommand/Firmware/VPhoneCustomFirmwareInstaller.swift+++ b/VPhoneExecutable/VPhoneCommand/VPhoneCommand/Firmware/VPhoneCustomFirmwareInstaller.swift@@@ -1342,14 -1336,8 +1354,16 @@@ struct VPhoneCustomFirmwareInstaller&& identifier != FirmwareGuestSystemPatchSet.hinge&& identifier != FirmwareGuestSystemPatchSet.foldGuard&& identifier != FirmwareGuestSystemPatchSet.ios17Desktop+ && identifier != FirmwareGuestSystemPatchSet.ios16MachPorts+ && identifier != FirmwareGuestSystemPatchSet.ios16Migration+ && identifier != FirmwareGuestSystemPatchSet.ios16Desktop+ && identifier != FirmwareGuestSystemPatchSet.ios16Keybag+ && identifier != FirmwareGuestSystemPatchSet.ios16Surface+ && identifier != FirmwareGuestSystemPatchSet.ios16Framebuffer+ && identifier != FirmwareGuestSystemPatchSet.ios16Touchscreen+ && identifier != FirmwareGuestSystemPatchSet.ios16KeybaglessUI+ && identifier != FirmwareGuestSystemPatchSet.glesUpperLeft+ && identifier != FirmwareGuestSystemPatchSet.paravirtGPUCompilerCache}guard plan.isEnabled(identifier) else {print(" [·] \(identifier): off in preset \(plan.presetIdentifier)")@@@ -1806,7 -1771,10 +1820,11 @@@dyld.append(("dyld-boot-iomfb_swapend", "patch-iomfb-swapend", [dsc, "--target-size", "0x560"]))}dyld += [+ (FirmwareGuestSystemPatchSet.ios16PortsLookup, "patch-ios16-mach-ports", [dsc]),+ (FirmwareGuestSystemPatchSet.metalCacheReuseKey, "patch-metal-cache-reuse-key", [dsc]),+ (FirmwareGuestSystemPatchSet.metalVertexIDFormat, "patch-metal-vertex-id-format", [dsc]),+ (FirmwareGuestSystemPatchSet.glesPrimitiveRestart, "patch-gles-primitive-restart", [dsc]),+ (FirmwareGuestSystemPatchSet.glesPointDraw, "patch-gles-point-draw", [dsc]),(FirmwareGuestSystemPatchSet.homeViewEnvironmentService, "patch-homeview-environment", [dsc]),(FirmwareGuestSystemPatchSet.settingsSoftwareUpdate, "patch-settings-software-update", [dsc]),(FirmwarePatchSetCatalog.misTrustAuthPatch, "patch-mis-trust-auth", [dsc]),@@@ -2469,8 -2421,13 +2535,14 @@@failures: inout [String],) throws {func enabled(_ id: String) -> Bool {+ if id == FirmwareGuestSystemPatchSet.ios16PortsLookup { return plan?.isEnabled(id) == true }- if id == FirmwareGuestSystemPatchSet.homeViewEnvironmentService { return plan?.isEnabled(id) == true }+ if id == FirmwareGuestSystemPatchSet.homeViewEnvironmentService+ || id == FirmwareGuestSystemPatchSet.metalCacheReuseKey+ || id == FirmwareGuestSystemPatchSet.metalVertexIDFormat+ || id == FirmwareGuestSystemPatchSet.glesPointDraw+ || id == FirmwareGuestSystemPatchSet.glesPrimitiveRestart {+ return plan?.isEnabled(id) == true+ }return plan?.isEnabled(id) ?? !FirmwareGuestSystemPatchSet.settingsRowPatches.contains(id)}func requireBootstrap(_ id: String, error: any Error) throws {