Run a virtual iPhone on an Apple Silicon Mac.
Swift
cfw: Fix iOS 27 app registration — patch lsd embedded-reg gate + vphoned containerized fallback
zqxwce82485d988d09
diff --git a/research/0_binary_patch_comparison.md b/research/0_binary_patch_comparison.mdindex 01b21213..15401514 100644--- a/research/0_binary_patch_comparison.md+++ b/research/0_binary_patch_comparison.md@@ -182,6 +182,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). Self-gating (`patch-dsc-maxslide`): no-op unless span + maxSlide > `0x180000000`, so 26.x / 18.x are untouched. **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. Self-gating (`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). **VALIDATED (2026-07-17, `17,3_27.0_24A5380h` + cloudOS 26.4, JB): -54 gone; Sileo registers (`uicache -l` 0→1); 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`. | Y | Y | Y |### Installed Componentsdiff --git a/scripts/cfw_install.sh b/scripts/cfw_install.shindex e66bf888..2beaaa7d 100755--- a/scripts/cfw_install.sh+++ b/scripts/cfw_install.sh@@ -327,18 +327,29 @@ case "$IOS_VERSION" in;;esac-# Newer userlands ship a dyld shared cache that nearly fills the vphone600 26.x-# kernel's fixed 6 GiB shared region. The kernel reserves the cache's mapped span-# PLUS the cache-header maxSlide (512 MiB); when that overflows 0x180000000 (iOS-# 27.0: ~5.95 GiB span + 512 MiB), _shared_region_map_and_slide returns ENOMEM,-# dyld cannot map libSystem, and launchd (pid 1) panics at boot. Zero maxSlide so-# the cache maps at slide 0 within the region. Self-gating: no-op for older-# userlands (26.x/18.x) that already fit with full slide.+# iOS-27-only DSC patches (hard-gated — a 26.x/18.x base applies neither).+# - maxSlide: iOS 27's dyld shared cache nearly fills the vphone600 26.x kernel's+# fixed 6 GiB shared region. The kernel reserves the cache's mapped span PLUS the+# cache-header maxSlide (512 MiB); iOS 27.0 (~5.95 GiB span + 512 MiB) overflows+# 0x180000000, so _shared_region_map_and_slide returns ENOMEM, dyld cannot map+# libSystem, and launchd (pid 1) panics at boot. Zero maxSlide so the cache maps+# at slide 0. (The patcher also self-gates on the actual span, but older userlands+# fit with full slide and never need it — so it is not run there at all.)+# - lsd embedded-registration gate: opens lsd's containerized-registration path so+# the iOS-27 vpregister first-boot tool can register JB apps (uicache's+# registerApplicationDictionary is a no-op stub on 27). Not needed on 26.x/18.x,+# where uicache registers apps normally.DSC_DIR="$MNT1/System/Cryptexes/OS/System/Library/Caches/com.apple.dyld"-if [[ -d "$DSC_DIR" ]]; then- echo " [*] Checking dyld cache maxSlide vs kernel shared region..."- "$PYTHON3" "$SCRIPT_DIR/patchers/cfw.py" patch-dsc-maxslide "$DSC_DIR"-fi+case "$IOS_VERSION" in+ 27.*)+ if [[ -d "$DSC_DIR" ]]; then+ echo " [*] Checking dyld cache maxSlide vs kernel shared region..."+ "$PYTHON3" "$SCRIPT_DIR/patchers/cfw.py" patch-dsc-maxslide "$DSC_DIR"+ echo " [*] Patching lsd embedded-registration gate (iOS 27 app registration)..."+ "$PYTHON3" "$SCRIPT_DIR/patchers/cfw.py" patch-lsd-embedded-reg "$DSC_DIR"+ fi+ ;;+esac# ═══════════ 2/7 PATCH SEPUTIL ════════════════════════════════echo ""diff --git a/scripts/patchers/cfw.py b/scripts/patchers/cfw.pyindex f04b1732..23c327ee 100755--- a/scripts/patchers/cfw.py+++ b/scripts/patchers/cfw.py@@ -50,6 +50,13 @@ Commands:can map libSystem. Self-gating (no-op if it already fits); no re-attest needed(header field, not a cs_validate'd code page).+ patch-lsd-embedded-reg <chunks_dir> [--dry-run]+ Force lsd's -[_LSDModifyClient clientIsEntitledForEmbeddedRegistrationOperations]+ to always succeed (NOP its entitlement gate + re-attest the page), so app+ (re)registration works on iOS 27 without the three privileged entitlements it+ otherwise demands from the XPC peer. Unblocks vphoned/TrollStore/uicache app+ installs. Self-gating (no-op on pre-iOS-27 userlands where the method is absent).+patch-camera-dsc <chunks_dir> <dsc_header> [--dry-run] [--force]Apply the 10-patch set to the DSC chunks that makes Camera.applaunch-survivable on a vphone VM: synthesises a single@@ -101,6 +108,7 @@ if __name__ == "__main__":from patchers.cfw_patch_iomfb_swapend import patch_iomfb_swapendfrom patchers.cfw_patch_iomfb_force_kern import patch_iomfb_force_kernfrom patchers.cfw_patch_dsc_maxslide import patch_dsc_maxslide+ from patchers.cfw_patch_lsd_embedded_reg import patch_lsd_embedded_regfrom patchers.cfw_patch_camera_dsc import apply_all_camera_patchesfrom patchers.cfw_patch_watchdogd import patch_watchdogdfrom patchers.cfw_daemons import parse_cryptex_paths, inject_daemons, patch_dropbear_plist@@ -113,6 +121,7 @@ else:from .cfw_patch_iomfb_swapend import patch_iomfb_swapendfrom .cfw_patch_iomfb_force_kern import patch_iomfb_force_kernfrom .cfw_patch_dsc_maxslide import patch_dsc_maxslide+ from .cfw_patch_lsd_embedded_reg import patch_lsd_embedded_regfrom .cfw_patch_camera_dsc import apply_all_camera_patchesfrom .cfw_patch_watchdogd import patch_watchdogdfrom .cfw_daemons import parse_cryptex_paths, inject_daemons, patch_dropbear_plist@@ -206,6 +215,14 @@ def main():patch_dsc_maxslide(sys.argv[2], dry_run=dry_run)sys.exit(0)+ elif cmd == "patch-lsd-embedded-reg":+ if len(sys.argv) < 3:+ print("Usage: patch_cfw.py patch-lsd-embedded-reg <chunks_dir> [--dry-run]")+ sys.exit(1)+ dry_run = "--dry-run" in sys.argv[3:]+ patch_lsd_embedded_reg(sys.argv[2], dry_run=dry_run)+ sys.exit(0)+elif cmd == "patch-camera-dsc":if len(sys.argv) < 4:print("Usage: patch_cfw.py patch-camera-dsc <chunks_dir> <dsc_header> [--dry-run] [--force]")@@ -267,7 +284,7 @@ def main():print(f"Unknown command: {cmd}")print("Commands: cryptex-paths, patch-seputil, patch-launchd-cache-loader, patch-camera-dsc,")print(" patch-mobileactivationd, patch-launchd-jetsam,")- print(" patch-hv-vmm-dsc, patch-iomfb-swapend, patch-iomfb-force-kern, patch-dsc-maxslide, patch-watchdogd,")+ print(" patch-hv-vmm-dsc, patch-iomfb-swapend, patch-iomfb-force-kern, patch-dsc-maxslide, patch-lsd-embedded-reg, patch-watchdogd,")print(" inject-daemons, patch-dropbear-plist, inject-dylib")sys.exit(1)diff --git a/scripts/patchers/cfw_patch_lsd_embedded_reg.py b/scripts/patchers/cfw_patch_lsd_embedded_reg.pynew file mode 100644index 00000000..0520d014--- /dev/null+++ b/scripts/patchers/cfw_patch_lsd_embedded_reg.py@@ -0,0 +1,180 @@+"""Patch LaunchServices so lsd allows app (re)registration from any client.++iOS 27's lsd gates `-[_LSDModifyClient performPostInstallationRegistration:...]`+(and the sibling containerized/rebuild registration paths) behind+`-[_LSDModifyClient clientIsEntitledForEmbeddedRegistrationOperations]`, which+does `xpc_connection_copy_entitlement_value` on the XPC PEER for any of three+privileged entitlements (com.apple.private.coreservices.lsaw /+com.apple.private.installcoordinationd.daemon /+com.apple.private.coreservices.can-register-install-results). A client without+one gets NSError NSOSStatusErrorDomain -54 (permErr) from LSDModifyService.mm,+so `registerApplicationDictionary:` returns NO. This blocks JB app registration+(uicache/Sileo), vphoned's IPA installer, and TrollStore alike.++The entitlement route is a dead end on this stack: even a launchd-spawned+platform daemon (vphoned) with all three entitlements in its VALIDATED csblob+(csops CS_OPS_ENTITLEMENTS_BLOB confirms) is still rejected, because the XPC+peer lsd inspects is not the registering process (LS registration is proxied).++So force the check to always succeed. `clientIsEntitledForEmbeddedRegistration+Operations` ORs three entitlement checks:++ bl <check ent1> ; cbnz w0, entitled+ bl <check ent2> ; cbnz w0, entitled+ bl <check ent3> ; cbz w0, not_entitled <- gate: NOP this+ entitled:+ mov w20, #1 <- YES result (returned)+ ... ; mov x0, x20 ; retab+ not_entitled:+ mov w20, #0 -> returns 0++NOP'ing the final `cbz w0, <not_entitled>` (the one whose fall-through is the+`mov w<result>, #1`) makes every path reach the YES result. One instruction.++Nothing is hardcoded: the method is resolved from the DSC's own local-symbol+table (in-image), disassembled with Capstone, and the gate located by+control-flow shape (the conditional branch immediately preceding the `mov+w<reg>,#1` that becomes the return value). The replacement is Keystone `nop`.+Modifying a DSC page invalidates its 16 KiB slot hash, so the page is+re-attested (TXM enforces per-page); the resulting CDHash change is accepted by+the JB's always-true AMFI cdhash-trust patch.+"""++import struct++from capstone.arm64_const import ARM64_OP_REG, ARM64_OP_IMM++try:+ from .cfw_asm import asm, _cs+ from .cfw_dsc_chunks import DSCChunks+ from .cfw_dsc_codesign import reattest_modified_pages+except ImportError: # direct self-test / standalone execution+ from cfw_asm import asm, _cs+ from cfw_dsc_chunks import DSCChunks+ from cfw_dsc_codesign import reattest_modified_pages+++LAUNCHSERVICES = "/System/Library/Frameworks/CoreServices.framework/CoreServices"+METHOD = "-[_LSDModifyClient clientIsEntitledForEmbeddedRegistrationOperations]"+++def _resolve_local_symbol(chunks_dir, name):+ """Resolve an ObjC method symbol to its vmaddr via the DSC's own+ `.symbols` local-symbol table (in-image; no repo-exported dumps). ipsw+ `symaddr -a` times out on this cache, so parse the table directly."""+ import os+ sym = os.path.join(chunks_dir, "dyld_shared_cache_arm64e.symbols")+ with open(sym, "rb") as f:+ hdr = f.read(0x100)+ if hdr[:15] != b"dyld_v1 arm64e":+ raise RuntimeError(f"unexpected .symbols magic in {sym}")+ local_off = struct.unpack_from("<Q", hdr, 72)[0]+ f.seek(local_off)+ nlist_off, nlist_cnt, str_off, str_sz, _eo, _ec = struct.unpack("<IIIIII", f.read(24))+ f.seek(local_off + str_off)+ strings = f.read(str_sz)+ f.seek(local_off + nlist_off)+ nl = f.read(nlist_cnt * 16)+ want = name.encode()+ for i in range(nlist_cnt):+ n_strx, _t, _s, _d, n_value = struct.unpack_from("<IBBHQ", nl, i * 16)+ if n_strx >= len(strings):+ continue+ end = strings.find(b"\x00", n_strx)+ if strings[n_strx:end] == want:+ return n_value+ raise RuntimeError(f"could not resolve {name!r} in .symbols")+++def _mov_reg_imm(insn):+ if insn.mnemonic != "mov":+ return None+ ops = insn.operands+ if len(ops) != 2 or ops[0].type != ARM64_OP_REG or ops[1].type != ARM64_OP_IMM:+ return None+ return insn.reg_name(ops[0].reg), ops[1].imm+++def _disasm_function(chunks, vma, max_insns=96):+ buf = chunks.bytes_at_vma(vma, max_insns * 4)+ insns = []+ for insn in _cs.disasm(buf, vma):+ insns.append(insn)+ if insn.mnemonic in ("ret", "retab"):+ break+ return insns+++def _find_gate(insns):+ """Locate the conditional branch that gates the entitled result: the+ `cbz`/`cbnz` on w0 whose fall-through instruction is `mov w<reg>,#1`+ (the YES value later moved to x0). Returns (insn, result_reg) or None."""+ for i in range(len(insns) - 1):+ ins = insns[i]+ if ins.mnemonic not in ("cbz", "cbnz"):+ continue+ ops = ins.operands+ if not ops or ops[0].type != ARM64_OP_REG or ins.reg_name(ops[0].reg) != "w0":+ continue+ nxt = _mov_reg_imm(insns[i + 1])+ if nxt is not None and nxt[1] == 1 and nxt[0].startswith("w"):+ return ins, nxt[0]+ return None+++def patch_lsd_embedded_reg(chunks_dir, *, dry_run=False):+ chunks = DSCChunks(chunks_dir)+ print(f" [.] {chunks!r}")++ # Self-gating: the gate method only exists on iOS 27+ LaunchServices. On+ # older userlands (26.x/18.x) it is absent, so this is a no-op there.+ try:+ fn_vma = _resolve_local_symbol(chunks_dir, METHOD)+ except RuntimeError:+ print(f" [=] {METHOD} not present (pre-iOS-27 userland); nothing to patch")+ return 0+ print(f" [.] {METHOD} @ 0x{fn_vma:X}")++ insns = _disasm_function(chunks, fn_vma)+ found = _find_gate(insns)+ if found is None:+ raise ValueError(+ f"{METHOD}: entitled-result gate (cbz/cbnz w0 -> mov w<reg>,#1) not found"+ )+ gate, result_reg = found+ insn_vma = gate.address+ print(f" [.] gate: {gate.mnemonic} {gate.op_str} @ 0x{insn_vma:X} "+ f"(fall-through sets {result_reg}=1)")++ nop = asm("nop")+ if len(nop) != 4:+ raise RuntimeError(f"expected 4 nop bytes, got {len(nop)}")++ cur = chunks.bytes_at_vma(insn_vma, 4)+ if cur == nop:+ print(f" [=] already NOP at 0x{insn_vma:X}; re-attesting page only")+ else:+ action = "would NOP" if dry_run else "NOP'd"+ print(f" [+] {action} gate {gate.mnemonic} -> nop at 0x{insn_vma:X} "+ f"(bytes {cur.hex()} -> {nop.hex()})")+ if not dry_run:+ chunks.write_at_vma(insn_vma, nop)++ if not dry_run:+ print(f" [.] re-attesting modified page...")+ reattest_modified_pages(chunks, [insn_vma], dry_run=False)+ if chunks.bytes_at_vma(insn_vma, 4) != nop:+ raise RuntimeError(f"post-write verify failed at 0x{insn_vma:X}")+ else:+ print(f" [.] dry-run: would re-attest page for 0x{insn_vma:X}")++ print(f" [+] lsd embedded-registration gate patch complete")+ return 1+++if __name__ == "__main__":+ import sys+ dry = "--apply" not in sys.argv+ args = [a for a in sys.argv[1:] if not a.startswith("--")]+ d = args[0] if args else "/private/tmp/cryptex27/System/Library/Caches/com.apple.dyld"+ patch_lsd_embedded_reg(d, dry_run=dry)diff --git a/scripts/vphoned/vphoned_install.m b/scripts/vphoned/vphoned_install.mindex d5caa33e..0f715a21 100644--- a/scripts/vphoned/vphoned_install.m+++ b/scripts/vphoned/vphoned_install.m@@ -39,6 +39,11 @@ extern CFStringRef kSecCodeInfoEntitlementsDict;@interface LSApplicationWorkspace : NSObject+ (instancetype)defaultWorkspace;- (BOOL)registerApplicationDictionary:(NSDictionary *)dict;+- (BOOL)registerContainerizedApplicationWithInfoDictionaries:(NSArray *)infos+ operationUUID:(NSUUID *)uuid+ requestContext:(id)context+ saveObserver:(id)observer+ registrationError:(NSError **)error;- (BOOL)unregisterApplication:(id)arg1;@end@@ -624,10 +629,27 @@ static BOOL vp_register_path(NSString *path, BOOL unregister, BOOL forceSystem)}dictToRegister[@"_LSBundlePlugins"] = bundlePlugins;- if (![workspace registerApplicationDictionary:dictToRegister]) {- return NO;+ if ([workspace registerApplicationDictionary:dictToRegister]) {+ return YES;}- return YES;+ // iOS 27+: the plain registerApplicationDictionary path is gated off in lsd+ // (returns NO). Fall back to the containerized registration path, which+ // works once lsd's clientIsEntitledForEmbeddedRegistrationOperations gate+ // is patched (cfw_patch_lsd_embedded_reg). It returns NO even on success,+ // so treat a nil registrationError as success.+ SEL containerizedSel = @selector(registerContainerizedApplicationWithInfoDictionaries:operationUUID:requestContext:saveObserver:registrationError:);+ if ([workspace respondsToSelector:containerizedSel]) {+ NSError *regError = nil;+ [workspace registerContainerizedApplicationWithInfoDictionaries:@[dictToRegister]+ operationUUID:[NSUUID UUID]+ requestContext:nil+ saveObserver:nil+ registrationError:®Error];+ if (regError == nil) {+ return YES;+ }+ }+ return NO;}NSURL *url = [NSURL fileURLWithPath:path];