Run a virtual iPhone on an Apple Silicon Mac.
Swift
Let daemons open the paravirtual GPU in the standard preset
Jacky74629ee992dd
diff --git a/Research/0_binary_patch_comparison.md b/Research/0_binary_patch_comparison.mdindex 92328d19..38dff199 100644--- a/Research/0_binary_patch_comparison.md+++ b/Research/0_binary_patch_comparison.md@@ -482,7 +482,7 @@| JB-28 | A | `patch_disk_images2_client_abi` | `com.apple.driver.AppleDiskImages2` kext: `DIDeviceCreatorUserClient::CreateDevice` + `DIDeviceIOUserClient::Connect` ABI-version gates, and the `AllocPortsArray`/`RegisterNotificationPort` notif-port sizing | **iOS-27 DDI (`/System/Developer`) auto-mount — attach layer.** `pymobiledevice3 mounter auto-mount` on the 26.4-kernel / 27-userland hybrid fails at attach: the kernel DiskImages2 driver is ABI v9, the 27 userland's DiskImages2 controller/daemon is ABI v11 (`DIDeviceCreatorUserClient::CreateDevice: Incompatible client: expected ABI version 9 actual 11`). Three layers: **GATE1** NOPs the CreateDevice controller-ABI `cmp #9 ; b.ne` reject; **GATE2b** NOPs the Connect daemon-ABI `cmp #9 ; b.ne` reject (both anchored on the C++ signature cstring → unique `cmp #9`/`b.ne`; version-robust; no-op-in-effect on version-matched userlands where ABI 9==9). **GATE2** (array + 2 bound checks) fixes a RegisterNotificationPort off-by-one (userland registers at index==maxPorts, one past the array) by widening the AllocPortsArray allocation (`lsl x1,xN,#3` → `mov x1,#0x4000`) AND both bound-check field loads (`ldrh [.,#0xd8]`/`ldr [.,#0xe8]` → `mov wD,#0x800`); applied **all-or-nothing** (widening the bound checks without the backing array would let RegisterNotificationPort write past it → corruption) and skipped/logged on builds whose notif-port codegen differs (the off-by-one is 26.4-hybrid-specific). Pairs with the sandbox ops[124] allow (JB-09) and the diskimagesiod userland patch (CFW binary-patch #13). Anchors structural (Capstone decode of the pinned function's instructions); replacement bytes from the Keystone-backed `ARM64Encoder`. **GATE2a anchor note:** the AllocPortsArray size-shift is matched on `lsl` mnemonic + destination `x1` (the unique size-writing lsl in the function) — NOT a 3-operand `lsl xd,xn,#imm` shape, because Capstone on this toolchain decodes the lsl-immediate (a UBFM alias) as **2 operands**; requiring 3 operands makes GATE2 silently skip (the all-or-nothing returns a harmless no-op). Verified on the `c0ecdb4b` 26.4 deployment kernel via `patch-component --component kernel-jb --records-out`: all five di2 records emit (`di2_createdevice_abi`, `di2_connect_abi`, `di2_allocports_size`, `di2_notif_boundcheck_d8`, `di2_notif_boundcheck_e8`) — always verify the di2 records EMIT, not merely that the JB suite reports "no failures". No-op-in-effect for version-matched userlands. | Y || JB-29 | C | `patch_fpfs_scoped_vnode_open` | Sandbox MACF `mpo_vnode_check_open` (`ops[267]`) → per-process trampoline code cave | **iOS-27 random-respring fix (fpfs balloon).** JB-09 blanket-neuters `mpo_vnode_check_open` (`ops[267]` → allow) so processes can read `/var/jb`. But FileProvider's fpfs parent-walk (`fpfs_pkg_fd_lookup` → `openbyid` climbing via `getattrlistat(ATTR_CMN_PAROBJID)`) uses the stock check's EACCES at the domain-container boundary as its terminus; neutered, the walk climbs unbounded → `ResolverService` (FileProviderResolver) balloons to ~12 GB → `vm-compressor-space-shortage` jetsam → backboardd killed → **respring** (seen on 27b4/24A5390f). Fix keeps the global bypass and enforces the real check for the FileProvider daemons only: on 27, `ops[267]` is left un-neutered (removed from JB-09's blanket list — conditional `if !applyIOS27` in `patchSandboxHooksExtended`), then retargeted to a 20-insn code-cave trampoline that inlines `current_proc` (`mrs tpidr_el1` → `ldr [+0x3F0]` uthread → `ldr [+0x18]` proc), loads `p_comm` (`+0x56C`), compares the first 8 bytes to `"Resolver"`/`"fileprov"`, and on match `b`s to the real `vnode_check_open` (restores the terminus) else returns allow (`mov x0,#0 ; ret` → `/var/jb` reads + Sileo/TrollStore icons unaffected). Register-only (x8–x10), no frame/call (~18 insns/open). Struct offsets recovered via the VZ gdb stub on vphone600; cave bytes from the Keystone-backed `ARM64Encoder`, verified by Capstone round-trip; the `ops[267]` retarget preserves the auth-rebase high bits (same encoder family as JB-09). **VALIDATED on-device (2026-07-23, `17,3_27.0_24A5390f` + cloudOS 26.4, JB, `setup_machine` deploy): resprings stop; Sileo/TrollStoreLite icons render.** Backward-compat: a 26.5 base is unaffected (`ops[267]` still blanket-neutered there) — verified byte-identical kernelcache pre-vs-post (`cmp` clean, `sha256` unchanged). See `KernelJBPatchFpfsScopedOpen.swift`. | Y || JB-30 | B | `patchParavirtDisplayRefreshRate` | `AppleParavirtDisplay::createDisplayAttributes` (AppleParavirtGPUIOGPUFamily), the per-mode timing element call | **120 Hz display timing (opt-in, `kernel-exp-display_refresh_120hz`, off in `standard`).** The host VM service builds its one `PGDisplayMode` with a constant 60.0 Hz and writes it into the display shared state page as a 16-byte entry (u16 width, u16 height, u32 refresh in 16.16 Hz, flags); the guest turns each entry into an IOAV timing element with `ldurh w1,[xN,#-8]; ldurh w2,[xN,#-6]; ldur w3,[xN,#-4]; bl`. The `ldur w3` becomes `movz w3,#120,lsl #16`. Anchor: the `createDisplayAttributes` logger cstring (all refs in one function) + the only w1/w2/w3 load triple off one base at -8/-6/-4 ahead of a call. Gated by `KernelCustomFirmwarePatcher.applyDisplayRefresh`, set from the plan. See `Research/Guest/display_refresh_rate.md`. | opt-in |-| JB-31 | C | `patchParavirtUserClientsNarrow` (records `kernel-exp-paravirt_user_clients.redirect` / `.cave`) | Same IOUserClient Sandbox gate; the deny block's `ldr Xt,[sp,#imm]` eight bytes before the fail-log `adrp` | **Paravirtual device access on a 26.x / 18.x base (opt-in, off in `standard`).** Narrow replacement for the broad gate-off: at the deny point the class-name C string is already in x0, so a code-cave trampoline reads its first eight bytes and branches to the gate's NotPermitted allow target only for `ApplePar` / `AppleVid` / `AppleVir` / `IOSurfac` (AppleParavirt\*, AppleVideoToolboxParavirt\*, AppleVirtIO\*, IOSurfaceAcceleratorParavirtClient); every other denial runs the displaced `ldr` and falls through to the real deny. Fixes `MTLCreateSystemDefaultDevice()` nil in daemons/CLI and the VideoToolbox/ANE/IOSurface denials (upstream issue #22) without opening the rest. Cave words verified by clang/as + capstone round-trip; the two `b` words via `ARM64Encoder`. Gated by `KernelCustomFirmwarePatcher.applyParavirtUserClients`, set from the plan when `applyIOS27` is false. See `Research/Guest/gpu_acceleration.md`. | opt-in |+| JB-31 | C | `patchParavirtUserClientsNarrow` (records `kernel-cfw-paravirt_user_clients.redirect` / `.cave`; introduced as `kernel-exp-paravirt_user_clients`, renamed when `standard` turned it on) | Same IOUserClient Sandbox gate; the deny block's `ldr Xt,[sp,#imm]` eight bytes before the fail-log `adrp` | **Paravirtual device access on a 26.x / 18.x base (on in `standard` since 2026-10-04; it shipped opt-in).** Narrow replacement for the broad gate-off: at the deny point the class-name C string is already in x0, so a code-cave trampoline reads its first eight bytes and branches to the gate's NotPermitted allow target only for `ApplePar` / `AppleVid` / `AppleVir` / `IOSurfac` (AppleParavirt\*, AppleVideoToolboxParavirt\*, AppleVirtIO\*, IOSurfaceAcceleratorParavirtClient); every other denial runs the displaced `ldr` and falls through to the real deny. Fixes `MTLCreateSystemDefaultDevice()` nil in daemons/CLI and the VideoToolbox/ANE/IOSurface denials (upstream issue #22) without opening the rest. Cave words verified by clang/as + capstone round-trip; the two `b` words via `ARM64Encoder`. Gated by `KernelCustomFirmwarePatcher.applyParavirtUserClients`, set from the plan when `applyIOS27` is false. See `Research/Guest/gpu_acceleration.md`. | Y |### EXP-Only Kernel Methods (Reference List)@@ -2212,3 +2212,58 @@ early-exiting grep and awk closed their file/vtool producers under pipefail.Those probes now drain producer output while keeping matching, first-platformselection, failure propagation, and all signature checks. The full workspacebuild and strict signatures then passed.++## The paravirtual user-client allowlist joins `standard` (2026-10-04)++No new Apple binary patch and no new bytes. JB-31+(`kernel-cfw-paravirt_user_clients`, formerly `kernel-exp-`; see "Renamed" below) leaves+`standard`'s block list and `FirmwarePatchSetCatalog.manualOnlyPatches`, so a+26.x or 18.x guest made with `standard` now gets the narrow IOUserClient+sandbox allowlist for classes beginning `ApplePar`, `AppleVid`, `AppleVir` and+`IOSurfac`. On 27 nothing changes: the declaration's `iOSBase` gate is+`.oneOf([.major(26), .major(18)])`, so the patch skips by version there, and the+boot-essential `kernel-boot-iouc_sandbox_gate` (JB-10b) already opens every user+client. The pipeline's no-plan fallback in `buildComponentList` follows the same+rule (on for an 18.x or 26.x base, off for 27 and for an unreadable base), so a+pipeline built without a preset agrees with `standard`. The patcher's own default+stays false, so `KernelcacheCustomFirmwareComparisonTests` still compares against+the records the reference was taken from.++**Why.** On an iPadOS 26.6.2 guest with the old `standard`, `cameracaptured`+crash-loops at every boot: its shader prewarm (`FigCapturePreloadShadersInternal`+→ CMCapture `PrewarmThreadSafeSBPs` → NRFV3 `-[NRFProcessorV3 prewarm]`) is+refused the GPU at this gate and dies with SIGSEGV at `0xc` inside+`AppleParavirtGPUMetalIOGPUFamily`. While it crash-loops, the first process to+touch the AVCapture defaults blocks on a synchronous XPC to it; when a guest app+starts recording that is SpringBoard's main thread (Control Center's sensor+indicator → `AVCaptureDeviceDiscoverySession` →+`AVCaptureProprietaryDefaultsSingleton` → `csr_ensureClientEstablished`), so the+UI freezes, `audiomxd`'s recording `StartIO` waits 18 s, and the first recording+after boot fails.++**What it widens, and why that is acceptable.** Every process whose sandbox+refuses one of those classes at this gate — daemons, command-line tools and+system XPC services such as `cameracaptured`, WebKit, `spotlightknowledged`,+`callservicesd` and `vphoned` — now passes it; apps gain nothing, because their+container profile already opens these devices. The prefix match admits every+class with those first eight bytes, which on this board means the paravirtual+GPU and device clients, the paravirtual VideoToolbox decoder, the VirtIO drivers+(the Neural Engine among them) and IOSurface's clients. Every other class is+still refused, which is why the narrow patch rather than the broad gate-off is+the shape on 26.x. For a research VM whose sandbox hooks are already stubbed+(JB-09) and whose IOUC MACF gate is already open (JB-10), this was the last thing+stopping a daemon reaching a device every app reaches. See+`Research/Guest/gpu_acceleration.md`, "On in `standard`".++**Renamed.** The patch was introduced the same day (37ed2e6) as+`kernel-exp-paravirt_user_clients`, opt-in. The `{component}-{effect}-{name}`+rule derives `exp` for a patch `standard` leaves off and `cfw` otherwise, so it+is renamed **`kernel-cfw-paravirt_user_clients`** (records `.redirect` and+`.cave`), as `dyld-cfw-mis_trust_auth` was renamed the other way on 2026-09-30.+`fw patch` resolves a VM's `PatchSelection.plist` against the catalogue and+throws `unknownPatch` for an identifier nothing declares, so a VM whose record+still names `kernel-exp-paravirt_user_clients` fails there until that entry is+removed. There is no migration.++**Opting out.** `vphone-cli fw set-patches <vm> --block+kernel-cfw-paravirt_user_clients`, then re-patch.diff --git a/Research/Guest/gpu_acceleration.md b/Research/Guest/gpu_acceleration.mdindex d43ac5c0..91d60e52 100644--- a/Research/Guest/gpu_acceleration.md+++ b/Research/Guest/gpu_acceleration.md@@ -56,11 +56,11 @@ refused, on the same guest:| `IOSurfaceAcceleratorParavirtClient` (scaler) | `vphoned` |On a 27 base this gate is already off: `kernel-boot-iouc_sandbox_gate` is-boot-essential there, because 27 refuses backboardd its framebuffer. The opt-in-patch `kernel-exp-paravirt_user_clients` makes the same edit on a 26.x or 18.x-base. With it, on `gpuaccel-ipad`, the tool prints-`device: Apple Paravirtual device GPU` and the console holds no-`failed sandbox` line at all.+boot-essential there, because 27 refuses backboardd its framebuffer. The patch+`kernel-cfw-paravirt_user_clients` makes a narrower edit on a 26.x or 18.x base,+and `standard` turns it on (see "On in `standard`" below). With it, on+`gpuaccel-ipad`, the tool prints `device: Apple Paravirtual device GPU` and the+console holds no `failed sandbox` line at all.### Narrow by class name@@ -76,8 +76,8 @@ displaced `ldr` and falls through to the real deny, so every other sandbox deniastays. The cave's fixed words are verified by clang/as assembly and a capstoneround-trip; the two position-dependent branches come from `ARM64Encoder`. Theanchor is the fail-string xref, the NotPermitted allow target and the deny-entry-`cbnz`, the same three the broad gate uses; the record is still-`kernel-exp-paravirt_user_clients` (sites `.redirect` and `.cave`).+`cbnz`, the same three the broad gate uses; the declaration is+`kernel-cfw-paravirt_user_clients` (sites `.redirect` and `.cave`).Verified on a fresh iPad Pro guest (`narrowtest-ipad`, 26.6.2, both opt-inpatches on): it boots, and a plain command-line tool prints@@ -88,15 +88,77 @@ Metal device -> ALLOWED```— the paravirtual GPU opens from a daemon context while a non-allowlisted client-is still refused. It stays off in `standard`: Metal in daemons/CLI is a niche-need (apps already have it), so turning it on is a per-VM or preset choice; it is-a candidate to default on once it has had wider testing.+is still refused. It first shipped off in `standard`, as a per-VM choice; it is+now on, for the reason below.What it does not change: HLS video in Safari already played at the stream's60 frames per second without it, with `mediaplaybackd` at 9% of a core and`videocodecd` at 4%, so WebKit being refused the decoder is not a visible costthere.+### On in `standard`++`standard` stopped blocking the patch on 2026-10-04. The case that decided it is+`cameracaptured`, measured on an iPadOS 26.6.2 guest with the old `standard`:++- At every boot it prewarms its capture shaders+ (`FigCapturePreloadShadersInternal` → CMCapture `PrewarmThreadSafeSBPs` →+ NRFV3 `-[NRFProcessorV3 prewarm]`). It is a daemon, so the gate refuses it the+ GPU, and it dies with SIGSEGV at `0xc` inside+ `AppleParavirtGPUMetalIOGPUFamily`. launchd restarts it, and it crash-loops.+- While it does, the first process to touch the AVCapture defaults blocks on a+ synchronous XPC to it (`AVCaptureProprietaryDefaultsSingleton` →+ `csr_ensureClientEstablished`). When a guest app starts recording, that process+ is SpringBoard: Control Center's sensor indicator builds an+ `AVCaptureDeviceDiscoverySession` on the main thread, and the guest UI freezes.+ `audiomxd`'s recording `StartIO` waits 18 s on the same path, and the first+ recording after boot fails.++So a daemon reaching the GPU is not a niche need: a stock system daemon expects+it. A separate change makes `libvcamcaptured` skip the prewarm defensively; this+one gives `cameracaptured` the device it expects, so it runs normally.++**What this widens.** The edit is at the IOUserClient sandbox gate only. A+process whose own sandbox profile refuses `iokit-open-user-client` for a class+whose name begins with `ApplePar`, `AppleVid`, `AppleVir` or `IOSurfac` is now+let through that gate; every other class is still refused there. The checks a+driver makes itself (entitlements in `newUserClient`, its argument validation)+are untouched; the MACF check before this gate was already opened by+`patch_iouc_failed_macf` (JB-10). The match is on the first eight bytes of the+class name, so it admits every class with one of those prefixes, not only the+four named in the table above: on this research board that means the+paravirtual GPU and device clients (`AppleParavirt*`), the paravirtual+VideoToolbox decoder (`AppleVideo*`), the VirtIO drivers (`AppleVirtIO*`, among+them the Neural Engine) and IOSurface's clients (`IOSurface*`, the root+client as well as the paravirtual accelerator). Who gains: daemons, command-line+tools and system XPC services that run under the platform profile or a profile+of their own — `cameracaptured`, `com.apple.WebKit` processes,+`spotlightknowledged`, `callservicesd`, `vphoned`, and anything a researcher+runs from a shell or a launchd job. Apps gain nothing: their container profile+already opens these devices. On which bases: 26.x and 18.x. On 27 the patch+skips by version, because the boot-essential `kernel-boot-iouc_sandbox_gate`+already opens every user client there, so a 27 guest is unchanged.++**Why that is acceptable for `standard`.** These are research VMs, already+running with the sandbox hooks stubbed and the trust cache admitting anything;+this gate is what still stopped a daemon from opening a device an app opens+freely. The devices are the guest's own paravirtual hardware, their host side+is a per-VM ParavirtualizedGraphics task or the VM process, and every app on the+guest already reaches them, so the attack surface they expose is already+exposed. The narrow patch is still the right shape on 26.x: the broad+gate-off would open `RootDomainUserClient` and every other client too, which+nothing here needs.++A VM that wants the old behaviour unticks the patch+(`vphone-cli fw set-patches <vm> --block kernel-cfw-paravirt_user_clients`) and+re-patches.++The patch was introduced opt-in as `kernel-exp-paravirt_user_clients` and renamed+`kernel-cfw-paravirt_user_clients` when `standard` turned it on, as the naming+rule in `Skills/authoring-patch-sets/SKILL.md` requires. A VM whose+`PatchSelection.plist` still names the old identifier gets `unknownPatch` from+`fw patch` until that entry is removed.+## Lag After Every BootHome Screen page swipes on `hz120-ipadpro`, by time since the VM started:diff --git a/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/Kernel/KernelCustomFirmwarePatcher.swift b/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/Kernel/KernelCustomFirmwarePatcher.swiftindex 3209f2da..8485d251 100644--- a/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/Kernel/KernelCustomFirmwarePatcher.swift+++ b/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/Kernel/KernelCustomFirmwarePatcher.swift@@ -35,10 +35,11 @@ public final class KernelCustomFirmwarePatcher: KernelCustomFirmwarePatcherBase,/// a guest keeps the host's 60 Hz mode unless the VM asked otherwise.public var applyDisplayRefresh = false- /// Opt-in on a base older than 27: a narrow allowlist at the same sandbox gate,- /// so a process outside an app sandbox can open the paravirtual GPU, video- /// decoder, Neural Engine and IOSurface scaler user clients and nothing else.- /// Set from the plan; `standard` blocks it.+ /// On a base older than 27: a narrow allowlist at the same sandbox gate, so a+ /// process outside an app sandbox can open the paravirtual GPU, video decoder,+ /// Neural Engine and IOSurface scaler user clients and nothing else. Set from+ /// the plan, and `standard` turns it on. False here so a patcher built directly+ /// writes what the reference records were taken from.public var applyParavirtUserClients = falsepublic func findAll() throws -> [PatchRecord] {diff --git a/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/PatchSets/FirmwareKernelCustomFirmwarePatchSet.swift b/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/PatchSets/FirmwareKernelCustomFirmwarePatchSet.swiftindex 2dfc4ac0..f30fd373 100644--- a/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/PatchSets/FirmwareKernelCustomFirmwarePatchSet.swift+++ b/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/PatchSets/FirmwareKernelCustomFirmwarePatchSet.swift@@ -271,7 +271,8 @@ public enum FirmwareKernelCustomFirmwarePatchSet {Lets a process outside an app sandbox open the paravirtual GPU, video decoder, \Neural Engine and IOSurface scaler, so daemons and command-line tools get Metal \and WebKit decodes video in hardware. Allows only those four device classes by \- name; every other sandbox denial stays. Off by default.+ name; every other sandbox denial stays. Without it cameracaptured cannot \+ prewarm its shaders and crash-loops at every boot.""",target: .firmware(.kernelcache),applicability: VPhonePatchApplicability(iOSBase: .oneOf([.major(26), .major(18)])),diff --git a/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/PatchSets/FirmwarePatchSetCatalog.swift b/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/PatchSets/FirmwarePatchSetCatalog.swiftindex 02479465..0b93b69c 100644--- a/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/PatchSets/FirmwarePatchSetCatalog.swift+++ b/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/PatchSets/FirmwarePatchSetCatalog.swift@@ -58,13 +58,13 @@ public enum FirmwarePatchSetCatalog {/// `kernel-exp-display_refresh_120hz` is off because it is a preference with a/// cost: see ``displayRefreshPatch``.///- /// `kernel-exp-paravirt_user_clients` is off because it lifts a sandbox denial- /// that nothing in the guest needs to boot: see ``paravirtUserClientsPatch``.+ /// `kernel-cfw-paravirt_user_clients` is not in this list: `standard` turns it+ /// on. See ``paravirtUserClientsPatch``.public static let manualOnlyPatches: Set<String> =Set(FirmwareKernelFridaPatchSet.manifest.patches.map(\.identifier)).union(hypervisorConcealmentPatches).union(experimentalIdentityPatches)- .union([misTrustAuthPatch, displayRefreshPatch, paravirtUserClientsPatch])+ .union([misTrustAuthPatch, displayRefreshPatch])/// The 120 Hz timing for the paravirtual display.///@@ -80,11 +80,20 @@ public enum FirmwarePatchSetCatalog {/// so only an app's container profile lets a process open them. A daemon or a/// command-line tool gets no Metal device, WebKit no hardware video decoder,/// and Core ML no Neural Engine. The edit allows only the four paravirt device- /// classes, by name, and leaves every other denial in place. Off in `standard`:- /// apps already get these devices, so it is a per-VM choice.+ /// classes, by name, and leaves every other denial in place.+ ///+ /// On in `standard`. `cameracaptured` prewarms its capture shaders on the GPU at+ /// every boot; refused the device, it crashes inside the paravirtual Metal+ /// driver and crash-loops, and the first process to touch AVCapture blocks on a+ /// synchronous XPC to it — SpringBoard's main thread when a guest app starts+ /// recording. What it widens is four class-name prefixes of devices apps already+ /// open, to processes outside an app sandbox, on a research VM.+ ///+ /// Introduced opt-in as `kernel-exp-paravirt_user_clients`; renamed `cfw` when+ /// `standard` turned it on, as the naming rule requires./// On 27 the broad `kernel-boot-iouc_sandbox_gate` is boot-essential instead. See/// `Research/Guest/gpu_acceleration.md`.- public static let paravirtUserClientsPatch = "kernel-exp-paravirt_user_clients"+ public static let paravirtUserClientsPatch = "kernel-cfw-paravirt_user_clients"/// The shared-cache short-circuit of `libmis`'s `checkTrustAndAuthorization`.///diff --git a/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/Pipeline/FirmwarePipelineComponents.swift b/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/Pipeline/FirmwarePipelineComponents.swiftindex 976983eb..a7ca2f67 100644--- a/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/Pipeline/FirmwarePipelineComponents.swift+++ b/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/Pipeline/FirmwarePipelineComponents.swift@@ -92,7 +92,12 @@ extension FirmwarePipeline {// The 120 Hz display timing, off unless the VM asked for it.let applyDisplayRefresh = isEnabled(FirmwarePatchSetCatalog.displayRefreshPatch, fallback: false)- let applyParavirtUserClients = isEnabled(FirmwarePatchSetCatalog.paravirtUserClientsPatch, fallback: false)+ // The paravirtual user-client allowlist, on in `standard` and pinned to the+ // 26.x and 18.x bases (27 opens the whole gate instead).+ let applyParavirtUserClients = isEnabled(+ FirmwarePatchSetCatalog.paravirtUserClientsPatch,+ fallback: baseIs18 || iOSBase?.major == 26,+ )// iOS 18 bases: disable the skywalk flowswitch netagents via boot-arg so// Network.framework uses the BSD path (the 26.1-kernel skywalkdiff --git a/VPhoneExecutable/VPhoneCommand/FirmwarePatcherTests/Core/FirmwarePatcherTests.swift b/VPhoneExecutable/VPhoneCommand/FirmwarePatcherTests/Core/FirmwarePatcherTests.swiftindex 3348c8f8..1ee12996 100644--- a/VPhoneExecutable/VPhoneCommand/FirmwarePatcherTests/Core/FirmwarePatcherTests.swift+++ b/VPhoneExecutable/VPhoneCommand/FirmwarePatcherTests/Core/FirmwarePatcherTests.swift@@ -604,6 +604,39 @@ struct FirmwarePipelineTests {#expect(components.first { $0.name == "Manifest" }?.patcherFactories.isEmpty == true)}+ @Test func `standard turns the paravirtual user-client allowlist on before 27`() throws {+ // The flag the kernel CFW patcher is built with, from the standard plan and+ // from the no-plan fallback, which has to give the same answer.+ let root = URL(fileURLWithPath: NSTemporaryDirectory())+ func flag(_ base: String?, standard: Bool) throws -> Bool {+ let version = VPhoneVersion(base)+ let pipeline = FirmwarePipeline(+ vmDirectory: root,+ variant: .jb,+ verbose: false,+ preset: standard ? FirmwarePatchSetCatalog.standardPreset : nil,+ )+ let plan = try pipeline.resolvePlan(iOSBase: version, cloudOS: VPhoneVersion("26.4"))+ let components = pipeline.buildComponentList(+ restoreDir: root,+ iOSBase: version,+ plan: plan,+ gate: plan.map { VPhonePatchGate(plan: $0) } ?? .unrestricted,+ )+ let kernel = try #require(components.first { $0.name == "kernelcache" })+ let patcher = try #require(+ kernel.patcherFactories.lazy.compactMap { try? $0(Data(), false) as? KernelCustomFirmwarePatcher }.first,+ )+ return patcher.applyParavirtUserClients+ }+ for standard in [true, false] {+ #expect(try flag("26.6.2", standard: standard))+ #expect(try flag("18.6.2", standard: standard))+ #expect(try !flag("27.0", standard: standard))+ #expect(try !flag(nil, standard: standard))+ }+ }+@Test func `find file supports glob patterns`() throws {let fm = FileManager.defaultlet tempDir = URL(fileURLWithPath: NSTemporaryDirectory())diff --git a/VPhoneExecutable/VPhoneCommand/FirmwarePatcherTests/PatchSets/FirmwarePatchSetCatalogTests.swift b/VPhoneExecutable/VPhoneCommand/FirmwarePatcherTests/PatchSets/FirmwarePatchSetCatalogTests.swiftindex 23d05d19..04197ac4 100644--- a/VPhoneExecutable/VPhoneCommand/FirmwarePatcherTests/PatchSets/FirmwarePatchSetCatalogTests.swift+++ b/VPhoneExecutable/VPhoneCommand/FirmwarePatcherTests/PatchSets/FirmwarePatchSetCatalogTests.swift@@ -173,6 +173,32 @@ struct FirmwarePatchSetCatalogTests {}}+ @Test+ func `Standard opens the paravirtual user clients on every base`() throws {+ // A daemon has to reach the paravirtual GPU: cameracaptured prewarms its+ // shaders at boot and crash-loops without it. Before 27 that is the narrow+ // allowlist; on 27 the broad gate is boot-essential and opens everything, so+ // the narrow patch skips by version there rather than being blocked.+ let narrow = FirmwarePatchSetCatalog.paravirtUserClientsPatch+ let broad = "kernel-boot-iouc_sandbox_gate"+ #expect(!FirmwarePatchSetCatalog.manualOnlyPatches.contains(narrow))+ #expect(FirmwarePatchSetCatalog.standardPreset.selection.includes(narrow))+ for base in ["18.6.2", "26.0", "26.4", "26.6.2", "27.0"] {+ for cloud in ["26.1", "26.4"] {+ let plan = try VPhonePatchPlan.resolve(+ preset: FirmwarePatchSetCatalog.standardPreset,+ patchSets: FirmwarePatchSetCatalog.bundled,+ iOSBase: VPhoneVersion(base),+ cloudOS: VPhoneVersion(cloud),+ )+ let is27 = base.hasPrefix("27.")+ #expect(plan.isEnabled(narrow) == !is27, "\(narrow) on \(base)/\(cloud)")+ #expect(plan.skippedByVersion.contains(narrow) == is27, "\(narrow) on \(base)/\(cloud)")+ #expect(plan.isEnabled(broad) == is27, "\(broad) on \(base)/\(cloud)")+ }+ }+ }+@Testfunc `The Frida relaxations need cloudOS 26.4`() throws {for cloud in ["26.1", "26.4"] {diff --git a/VPhoneExecutable/VPhoneVirtualization/Resources/patches_presets/standard.plist b/VPhoneExecutable/VPhoneVirtualization/Resources/patches_presets/standard.plistindex ba172f45..51b067a7 100644--- a/VPhoneExecutable/VPhoneVirtualization/Resources/patches_presets/standard.plist+++ b/VPhoneExecutable/VPhoneVirtualization/Resources/patches_presets/standard.plist@@ -4,7 +4,7 @@The preset every VM gets unless another is named.It is the CFW baseline plus the virtual camera. It draws on every patch set the- bundle ships and turns on all of their patches bar six groups. The Frida+ bundle ships and turns on all of their patches bar five groups. The FridaStalker pair widens what any process in the guest may do and nothing needs it inorder to boot. The hv_vmm_present concealment — the kernel OID rename, theshared-cache mangle and the watchdogd patch — leaves a freshly restored 26.4@@ -21,9 +21,9 @@even be applied. See FirmwarePatchSetCatalog.misTrustAuthPatch.The fifth is the 120 Hz display timing, a preference that doubles how often theguest renders. See FirmwarePatchSetCatalog.displayRefreshPatch.- The sixth lets processes outside an app sandbox reach the paravirtual GPU, video- decoder, Neural Engine and IOSurface scaler through a narrow sandbox allowlist of- those classes. See+ The narrow paravirtual user-client allowlist (kernel-cfw-paravirt_user_clients) is+ on: without it a daemon on a 26.x or 18.x base cannot open the paravirtual GPU,+ and cameracaptured crash-loops on it. SeeFirmwarePatchSetCatalog.paravirtUserClientsPatch.Each patch's own version gate still decides whether it lands on this pairing of@@ -122,7 +122,6 @@<string>preboot-exp-devicetree_identity</string><string>dyld-exp-mis_trust_auth</string><string>kernel-exp-display_refresh_120hz</string>- <string>kernel-exp-paravirt_user_clients</string></array></dict></dict>