Run a virtual iPhone on an Apple Silicon Mac.
Swift
Give SpringBoard the no-haptics answer before CoreHaptics raises
Jacky7c74a8215c45
diff --git a/Research/0_binary_patch_comparison.md b/Research/0_binary_patch_comparison.mdindex 29b5dad9..577cea0a 100644--- a/Research/0_binary_patch_comparison.md+++ b/Research/0_binary_patch_comparison.md@@ -474,6 +474,7 @@ do NOT execute these).| 18 | **Superseded 2026-09-30 — no load command any more; the spawn hooks insert libmisfix, see "One route for libmisfix, SpringBoard included".** `LC_LOAD_WEAK_DYLIB /usr/lib/libmisfix.dylib` injected into `installd`, which interposes `MISValidateSignatureAndCopyInfo` and `MISValidateSignatureAndCopyInfoWithProgress` — **all bases** | `/usr/libexec/installd` (+ new guest dylib `libmisfix.dylib`) | **Xcode-install fix: let the guest install an app it did not get from Apple.** `xcrun devicectl device install app` with a bundle that is ad-hoc signed, fake-signed or signed by anything other than an Apple leaf fails at `0xE8008014`. Measured, not inferred: a probe app linked against `libmis` on `05-mis-test` (`iPhone99,11 26.6.2 (23G90)` + cloudOS 26.4) walked the option matrix over a real `.app` and found that **the whole gate is this one call** — no options → `0xE8008014`; `AllowAdHocSigning = kCFBooleanTrue` → **`0x0` with a complete `info` dictionary** (`CdHash`, `SignerType`, `SigningID`, `TeamID`, `SignatureVersion`, `IsNativeForPlatform`), so the hook has to synthesise nothing and the `info`-out-parameter hazard that rules out rewriting row 17's return value does not arise here; and stripping the signature off entirely is *not* a way through — that stays `0xE800801C` even with the option. Everything behind the call already accepts uncertificated code on a CFW guest (kernel AMFI, `lsd`, SpringBoard), so nothing else needs patching. Two findings cost real time and are recorded so nobody repeats them: **the first argument is a path `CFStringRef`, not a `CFURLRef`** — passing a URL crashes the caller with `-[NSURL length]: unrecognized selector`; and **the option keys are plain `CFString`s, not exported symbols** — `kMISValidationOptionAllowAdHocSigning` is absent from the cache's export trie, so grepping for the symbol says "this option does not exist on 26.6.2", which is wrong. The keys `libmis` parses are `UnauthoritativeLaunch`, `AuthoritativeLaunch`, `ExpectedHash`, `AllowAdHocSigning`, `ValidateSignatureOnly`, `LogResourceErrors`, `UniversalFileOffset`, `UseSoftwareSigningCert`, `OnlineAuthorization`, `OnlineCheckType`, `RespectUppTrustAndAuthorization`, `HonorBlocklist`, `DetachedSignature`, `TrustCacheOnly`, `SkipProfileIdentifierPolicy`, `AllowLaunchWarnings`, `GetLocalLaunchWarningData`, `MainExecutablePath` and `OnlineAuthorizationOnAllMatchingProfiles`. Fix: `vpWidenedOptions` copies the caller's dictionary (or creates one when it is NULL), sets `AllowAdHocSigning = true` and `RespectUppTrustAndAuthorization = false`, and forwards. The second key is row 17's behaviour expressed from the caller's side — same outcome, **no cache page written and no re-attestation**, which is the whole point given that row 17 is what bricks a 27.0 boot (issue #532). Delivery is `dyld` interposition: `__DATA,__interpose` lands in `__AUTH_CONST` on arm64e (signed pointers) and dyld honours it anyway, including for the shared cache's own uses of the interposed symbol — measured on `05-mis-test`, a linked call with no options returns `0x0` hooked against `0xE8008014` unhooked. The dylib is built by `VPhoneGuestComponents/Makefile` against `libmis.tbd` and `libMobileGestalt`, with `-Wl,-not_for_dyld_shared_cache`, and installed as `/usr/lib/libmisfix.dylib`; injection goes through the existing `patchMachO(… injectedDylibPath:)` path, which captures entitlements before the edit and re-signs with `VPhoneSigner` afterwards — verified to preserve `com.apple.installd` and all 31 of installd's entitlements. **Not applied to SpringBoard**, which would close the free-personal-team *launch* gate the same way: SpringBoard's Mach-O has no free header space (`load-command padding at 0x548 is not empty; inserting would overwrite 56 bytes of the first section`), so that path needs the `SystemHook` `posix_spawn` route instead and row 17 remains the only fix for it today. Declared `system-installd-cfw-adhoc_signature` in `com.vphone.patchset.guest.system`; no `applicability`, not `bootEssential`, on in `standard`. **Partially validated (2026-09-30, `06-xcode-27`, `17,3 27.0 (24A435)` + cloudOS 26.4 (23E5207q)):** `cfw install` reports `[+] LC_LOAD_WEAK_DYLIB /usr/lib/libmisfix.dylib -> installd`, the guest boots through Setup Assistant to the home screen, and `installd` is running with the dylib loaded — so the injection breaks neither the daemon nor the boot. The end-to-end install has **not** been demonstrated on that guest: `devicectl` will not complete a session against it on this host (`device info details` hangs with nothing reaching `lockdownd`), which is a host-side CoreDevice problem unrelated to this patch. See `VPhoneGuestComponents/MISFix/MISFixSignature.c` and `Research/Guest/xcode_install_signature_gate.md`. | Y | Y | Y || 19 | **Superseded 2026-09-30, as row 18.** The same `libmisfix.dylib` injected into `misagent`, where it interposes `MGCopyAnswer` / `MGCopyAnswerWithError` and answers `UniqueDeviceID` from a config file — **all bases** | `/usr/libexec/misagent` (+ `/usr/lib/libmisfix.plist`) | **Let a provisioning profile written for a device you already own install on the guest.** `0xE8008012` (`misagent: attempt to install invalid profile`) is the ordinary refusal when the profile's `ProvisionedDevices` does not list this device — correct behaviour, and distinct from row 17's `0xE8008026`. It blocks the case the user actually wants: reusing a paid team's already-registered device rather than burning a registration slot on every VM. The UDID being compared comes from `MGCopyAnswer(kMGUniqueDeviceID)`, and three cheaper routes were ruled out by measurement before any hook was written. (1) **AMFI cannot supply it**: `security.codesigning.config` is a 4-byte flags word (read back as `0x000000CC`), not a string, so `amfi_emulate_device_udid` is dead on this board. (2) **No daemon can write it**: `/private/var/root/Library/Lockdown/data_ark.plist` carries no `UniqueDeviceID` — lockdown derives it each boot. (3) **The real source is out of reach**: TXM composes `UniqueDeviceID` from the device tree's `/chosen/chip-id`, `/chosen/unique-chip-id` and `/product/udid-version` *before the kernel runs*, and `chip-id` is fixed at `0x0000FE01` while `unique-chip-id` is the ECID the SHSH blob is bound to — changing it means the VM no longer restores. So `MGCopyAnswer` is necessarily where this is done. Fix: interpose it in `misagent` only, return a `+1` copy (matching `MGCopyAnswer`'s contract) of the configured string for `UniqueDeviceID`, and fall through untouched for every other property. Configuration is `/var/db/vphone/misfix.plist`, falling back to `/usr/lib/libmisfix.plist`, cached against mtime and size so editing the file takes effect on the next query with no restart — that is the "put it in the plist and it applies" entry point. The shipped plist is **empty**: with no `UniqueDeviceID` key the interpose returns NULL and the patch is inert, so it changes nothing until someone deliberately pastes a real device's UDID in. `installMISFixDefaults` writes the fallback plist **only when it is absent**, so re-running `cfw install` never clobbers a configured value. **Accepted inconsistency, agreed with the user rather than hidden:** only `misagent`'s profile matching sees the borrowed UDID. Xcode, lockdown and `devicectl` keep reporting the VM's own (`0000FE01-…`), because those come from a different process that is not hooked. The two therefore disagree, which is exactly what makes the profile match while the device stays identifiable as itself. Declared `system-misagent-cfw-device_identity` in `com.vphone.patchset.guest.system`; no `applicability`, not `bootEssential`, on in `standard` but inert without a configured UDID. **Partially validated (2026-09-30, `06-xcode-27`):** `cfw install` reports `[+] LC_LOAD_WEAK_DYLIB /usr/lib/libmisfix.dylib -> misagent` and `misagent` runs normally on the booted guest. Installing a real paid-team IPA against a borrowed UDID is **not** yet demonstrated, for the same host-side `devicectl` reason as row 18. See `VPhoneGuestComponents/MISFix/MISFixDeviceIdentity.c`, `MISFixConfig.c` and `Research/Guest/xcode_install_signature_gate.md`. | Y | Y | Y || 20 | No binary change: the launchd hook inserts `libmisfix.dylib` into `SpringBoard` at spawn, beside SystemHook, and both spawn hooks do the same for `installd`, `misagent`, `lockdownd` and `remoted` (the last two for the UDID override only) — **all bases** | none (the guest environment's `launchdhook-vphone.dylib` and `SystemHook-vphone.dylib`) | **Let an installed developer-signed app launch.** SpringBoard validates the app with MIS again before launch and, on a hacktivated guest, fails row 17's `checkTrustAndAuthorization` with `0xE8008026` ("Unable to Verify App"). The hook's `MISValidateSignatureAndCopyInfoWithProgress` detour passes `RespectUppTrustAndAuthorization = false`, so the check is never called — row 17's effect with no shared-cache write, which is what makes it usable on 27.0. launchd starts SpringBoard itself rather than through xpcproxy, so the libraries it gets are the launchd hook's choice; that hook now asks the same `vpIsMISFixTarget` SystemHook does. `MISFixInstallPolicy` stays out of it. No declaration of its own: it ships with `system-launchdaemons-boot-environment`. A load-command version (`/mf` alias, `LC_SOURCE_VERSION` dropped) was committed and reverted the same day. See "One route for libmisfix, SpringBoard included (2026-09-30)" below. | Y | Y | Y |+| 21 | No binary change: SystemHook `dlopen`s `libhapticsfix.dylib` into `SpringBoard` at startup, where it replaces every `CHHapticEngine` initialiser's IMP so the initialiser returns nil — **all bases** | none (new guest dylib `VPhoneGuestComponents/HapticsFix/libhapticsfix.c`, installed at `/usr/lib/libhapticsfix.dylib`) | **Stop SpringBoard dying the first time UIKit plays a haptic.** The VM has no haptic device — Virtualization.framework exposes none on any base — and a real device without one gets nil from `CHHapticEngine`'s initialisers, so UIKit runs with no feedback, as on every non-Pro iPad. A guest reporting an iPad Pro model instead has an OS that *expects* the haptic stack, and CoreHaptics treats its absence as an internal error: measured on `iPad16,1 26.6.2 (23G90)`, 4h14m after launch, the first feedback event ran `-[_UIFeedbackCoreHapticsIgnoreCaptureHapticsOnlyEngine _internal_createCoreHapticsEngine]` → `-[CHHapticEngine initWithAudioSession:sessionIsShared:options:error:]` → `createHapticPlayerWithOptions:` → `Haptic_RaiseException` → `objc_exception_throw`, and the unwind resumed at an address inside a `---/---` Memory Tag 255 COW region next to the commpage — `EXC_BAD_ACCESS (SIGBUS)`, `KERN_PROTECTION_FAILURE`, a dead SpringBoard. The hook restores the no-hardware answer before UIKit can reach an initialiser: the constructor `dlopen`s CoreHaptics (it is not loaded that early, and the class must be in the runtime before UIKit asks), then `method_setImplementation` on every selector that is `init` or `init` + uppercase part — covering `initWithAudioSession:sessionIsShared:options:error:` today and any renamed sibling on other bases — with one IMP that ignores its arguments and returns nil, the framework's own answer on haptic-less hardware. Scope is SpringBoard only (`vpIsSpringBoard` in SystemHook, loaded before the app/bootstrap gate that would otherwise return first): it is the one UIKit process measured creating the haptics-only engine without asking CoreHaptics first, and apps that follow the documented `capabilitiesForHardware` path already answer no on the guest. Loaded like the camera hooks rather than inserted like libmisfix because interposing must be in place at launch while a method swizzle just has to run before first use; `DISABLE_TWEAKS` and safe mode skip it with everything else SystemHook loads. Ships with `system-launchdaemons-boot-environment`; existing guests receive it through the vphoned environment update (a missing file reports no hash, which is what triggers the push) and need a respring, which is deliberately the caller's call. See `VPhoneGuestComponents/HapticsFix/libhapticsfix.c`. | Y | Y | Y |### Swift port status — the eight DSC patchers (2026-09-23)diff --git a/VPhoneDaemon/Daemon/GuestAPI+Environment.swift b/VPhoneDaemon/Daemon/GuestAPI+Environment.swiftindex 4400ca1a..b280f553 100644--- a/VPhoneDaemon/Daemon/GuestAPI+Environment.swift+++ b/VPhoneDaemon/Daemon/GuestAPI+Environment.swift@@ -15,6 +15,7 @@ extension GuestAPI {"libvcamcaptured.dylib","libcamfix.dylib","libmisfix.dylib",+ "libhapticsfix.dylib",]static let environmentStaging = "/var/root/Library/Caches/vphone-environment"diff --git a/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/PatchSets/FirmwareGuestSystemPatchSet.swift b/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/PatchSets/FirmwareGuestSystemPatchSet.swiftindex 0c458f8f..a036fd8c 100644--- a/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/PatchSets/FirmwareGuestSystemPatchSet.swift+++ b/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/PatchSets/FirmwareGuestSystemPatchSet.swift@@ -170,7 +170,10 @@ public enum FirmwareGuestSystemPatchSet {launchd and SystemHook insert at spawn. Among them is libmisfix.dylib, inserted \into installd, misagent and SpringBoard, which lets Xcode install and launch an \app signed for someone else's team, or ad hoc, without writing the shared cache, \- and into lockdownd and remoted, which tell the host a configured UDID.+ and into lockdownd and remoted, which tell the host a configured UDID. It also \+ ships libhapticsfix.dylib, which SystemHook loads into SpringBoard so UIKit's \+ feedback engine takes the no-haptics path instead of crashing on the VM's absent \+ haptic hardware.""",target: .guestFile(path: "/Library/LaunchDaemons"),bootEssential: true,diff --git a/VPhoneExecutable/VPhoneVirtualization/Build/StageBundle.sh b/VPhoneExecutable/VPhoneVirtualization/Build/StageBundle.shindex 1d8ec762..164cb8dd 100755--- a/VPhoneExecutable/VPhoneVirtualization/Build/StageBundle.sh+++ b/VPhoneExecutable/VPhoneVirtualization/Build/StageBundle.sh@@ -73,6 +73,7 @@ fi/bin/cp "$guest_products/vcamcaptured/libvcamcaptured.plist" "$guest/libvcamcaptured.plist"/bin/cp "$guest_products/misfix/libmisfix.dylib" "$guest/libmisfix.dylib"/bin/cp "$guest_products/misfix/libmisfix.plist" "$guest/libmisfix.plist"+/bin/cp "$guest_products/hapticsfix/libhapticsfix.dylib" "$guest/libhapticsfix.dylib"/bin/cp "$guest_products/gpu/libAppleParavirtCompilerPluginIOGPUFamily.dylib" \"$guest/libAppleParavirtCompilerPluginIOGPUFamily.dylib"diff --git a/VPhoneExecutable/VPhoneVirtualization/Build/ValidateBundle.sh b/VPhoneExecutable/VPhoneVirtualization/Build/ValidateBundle.shindex c8666f26..c3f9ef4b 100755--- a/VPhoneExecutable/VPhoneVirtualization/Build/ValidateBundle.sh+++ b/VPhoneExecutable/VPhoneVirtualization/Build/ValidateBundle.sh@@ -75,7 +75,7 @@ for preset in "$resources/patches_presets/"*.plist; dodonefor name in vphoned launchdhook-vphone.dylib SystemHook-vphone.dylib libcamfix.dylib \- libvcamcaptured.dylib libmisfix.dylib libAppleParavirtCompilerPluginIOGPUFamily.dylib; do+ libvcamcaptured.dylib libmisfix.dylib libhapticsfix.dylib libAppleParavirtCompilerPluginIOGPUFamily.dylib; dorequire_signed_macho "$guest/$name"donefor name in vphoned.plist libcamfix.plist libvcamcaptured.plist libmisfix.plist; dodiff --git a/VPhoneGuestComponents/HapticsFix/libhapticsfix.c b/VPhoneGuestComponents/HapticsFix/libhapticsfix.cnew file mode 100644index 00000000..fb3d3332--- /dev/null+++ b/VPhoneGuestComponents/HapticsFix/libhapticsfix.c@@ -0,0 +1,94 @@+// libhapticsfix.c — the haptics hardware the guest's identity promises does+// not exist, and CoreHaptics answers that with an exception instead of nil.+//+// Virtualization.framework exposes no haptic device, on any base. A real+// device without one — every iPad that is not a Pro — gets nil from+// `CHHapticEngine`'s initialisers, UIKit carries on without feedback, and+// that is the whole story. A guest reporting an iPad Pro model inverts it:+// the OS expects the haptic stack to exist, so with the driver missing the+// initialiser does not fail, it *raises* — `Haptic_RaiseException` out of+// `-[CHHapticEngine initWithAudioSession:sessionIsShared:options:error:]` —+// and the unwind out of UIKit's feedback queue ends in SpringBoard dying:+//+// EXC_BAD_ACCESS (SIGBUS), KERN_PROTECTION_FAILURE — iPad16,1 26.6.2+// (23G90), thread com.apple.UIKit.FeedbackCoreHapticsEngineInternal,+// -[_UIFeedbackCoreHapticsIgnoreCaptureHapticsOnlyEngine+// _internal_createCoreHapticsEngine] -> objc_exception_throw ->+// _Unwind_RaiseException, resumed at an address inside a no-access+// Memory Tag 255 region, 4h14m after launch on the first feedback event.+//+// This hook gives the guest the no-hardware answer before CoreHaptics can+// raise: every `CHHapticEngine` initialiser returns nil, which is what the+// same framework answers on a device with no haptics. No UIKit error path+// dereferences past messaging nil, so feedback is simply absent, as on such+// devices.+//+// SystemHook loads this in SpringBoard only (`vpIsSpringBoard`): the one+// UIKit process measured creating the haptics-only engine without first+// asking CoreHaptics whether the hardware exists. Apps follow the documented+// path — `CHHapticEngine.capabilitiesForHardware`, which already answers no+// on the guest — so they never reach an initialiser.++#include <ctype.h>+#include <dlfcn.h>+#include <fcntl.h>+#include <objc/runtime.h>+#include <stdio.h>+#include <stdlib.h>+#include <string.h>+#include <sys/stat.h>+#include <unistd.h>++#define VP_CORE_HAPTICS "/System/Library/Frameworks/CoreHaptics.framework/CoreHaptics"++// Every initialiser funnels here whatever its arguments: they arrive in+// registers this never touches, and IMP is variadic, so a call with extras+// lands the same way it lands in any stub. Only the return matters — nil,+// the framework's own answer on hardware without haptics.+static id vpEngineUnsupported(id self, SEL selector) {+ return nil;+}++// `init`, or `init` followed by an uppercase selector part — the shape of an+// initialiser and not of, say, an `initialise…` helper.+static int vpIsInitializer(const char *name) {+ return strcmp(name, "init") == 0 ||+ (strncmp(name, "init", 4) == 0 && isupper((unsigned char)name[4]) != 0);+}++__attribute__((constructor)) static void vpInstallHapticsFix(void) {+ // CoreHaptics is not loaded when this runs — the spawn hooks start long+ // before UIKit reads anything — and the class must be in the runtime+ // before UIKit asks for an engine. Loading it here is what puts it+ // there; RTLD_LAZY keeps the cost to the framework's own initialisers.+ dlopen(VP_CORE_HAPTICS, RTLD_LAZY | RTLD_LOCAL);+ Class engine = objc_getClass("CHHapticEngine");+ if (!engine)+ return;++ unsigned int count = 0;+ Method *methods = class_copyMethodList(engine, &count);+ if (!methods)+ return;+ unsigned int replaced = 0;+ for (unsigned int index = 0; index < count; index++) {+ if (!vpIsInitializer(sel_getName(method_getName(methods[index]))))+ continue;+ method_setImplementation(methods[index], (IMP)vpEngineUnsupported);+ replaced++;+ }+ free(methods);++ // SpringBoard runs as mobile and owns this directory; the mode keeps a+ // root writer of the same log from silencing later ones, as in SystemHook.+ int fd = open("/var/mobile/Library/Caches/vphone-hapticsfix.log",+ O_WRONLY | O_CREAT | O_APPEND | O_CLOEXEC, 0666);+ if (fd < 0)+ return;+ fchmod(fd, 0666);+ dprintf(fd, "pid=%d CHHapticEngine initialisers returning nil: %u of %u\n",+ getpid(), replaced, count);+ close(fd);+}++int vphone_hapticsfix_version(void) { return 1; }diff --git a/VPhoneGuestComponents/Makefile b/VPhoneGuestComponents/Makefileindex 813597a9..aeffb349 100644--- a/VPhoneGuestComponents/Makefile+++ b/VPhoneGuestComponents/Makefile@@ -46,6 +46,11 @@ SYSTEMHOOK_INCLUDES := $(wildcard SystemHook/*.h SystemHook/*.inc Shared/*.h)MISFIX := $(STAGE)/misfix/libmisfix.dylibMISFIX_SOURCES := $(wildcard MISFix/*.c)MISFIX_INCLUDES := $(wildcard MISFix/*.h)+# CoreHaptics is reached through the ObjC runtime at runtime, so this needs+# nothing but libobjc at link time.+HAPTICSFIX := $(STAGE)/hapticsfix/libhapticsfix.dylib+HAPTICSFIX_SOURCES := $(wildcard HapticsFix/*.c)+HAPTICSFIX_INCLUDES := $(wildcard HapticsFix/*.h)GPU_PLUGIN := $(STAGE)/gpu/libAppleParavirtCompilerPluginIOGPUFamily.dylibGPU_PLUGIN_SOURCES := $(wildcard GraphicLoader/*.mm)GPU_PLUGIN_INCLUDES := $(wildcard GraphicLoader/*.h GraphicLoader/*.hpp GraphicLoader/*.inc)@@ -73,7 +78,7 @@ GPU_DYNAMIC_LOOKUP_SYMS := \-Wl,-U,_MTLMetalFunctionCreate \-Wl,-U,_MTLMetalLibInsertFunction \-Wl,-U,_MTLWriteMetalLibToMemoryBuffer-ARTIFACTS := $(CAMFIX) $(VCAMCAPTURED) $(LAUNCHHOOK) $(SYSTEMHOOK) $(MISFIX) $(GPU_PLUGIN)+ARTIFACTS := $(CAMFIX) $(VCAMCAPTURED) $(LAUNCHHOOK) $(SYSTEMHOOK) $(MISFIX) $(HAPTICSFIX) $(GPU_PLUGIN)PLISTS := $(STAGE)/camfix/libcamfix.plist $(STAGE)/vcamcaptured/libvcamcaptured.plist \$(STAGE)/misfix/libmisfix.plistGPU_PROVENANCE := $(STAGE)/gpu/README.md@@ -88,7 +93,7 @@ gpu: $(GPU_PLUGIN)package: all@rm -f $(ARCHIVE)- @/usr/bin/tar -cf $(ARCHIVE) -C $(STAGE) camfix vcamcaptured launchhook systemhook misfix gpu+ @/usr/bin/tar -cf $(ARCHIVE) -C $(STAGE) camfix vcamcaptured launchhook systemhook misfix hapticsfix gpu@echo "Packaged $(ARCHIVE)"test-loader-links:@@ -114,7 +119,7 @@ test-vcam-dataplane:-framework CoreGraphics@$(OUT)/VCamDataPlaneTests-$(STAGE)/camfix $(STAGE)/vcamcaptured $(STAGE)/launchhook $(STAGE)/systemhook $(STAGE)/misfix $(STAGE)/gpu:+$(STAGE)/camfix $(STAGE)/vcamcaptured $(STAGE)/launchhook $(STAGE)/systemhook $(STAGE)/misfix $(STAGE)/hapticsfix $(STAGE)/gpu:@mkdir -p $@$(CAMFIX): $(CAMFIX_SOURCES) $(CAMFIX_INPUTS) | $(STAGE)/camfix@@ -154,6 +159,13 @@ $(MISFIX): $(MISFIX_SOURCES) $(MISFIX_INCLUDES) MISFix | $(STAGE)/misfix-Wl,-not_for_dyld_shared_cache@codesign --force --sign - $@+$(HAPTICSFIX): $(HAPTICSFIX_SOURCES) $(HAPTICSFIX_INCLUDES) HapticsFix | $(STAGE)/hapticsfix+ $(CLANG) $(GUEST_C_FLAGS) -dynamiclib \+ -install_name /usr/lib/libhapticsfix.dylib \+ -o $@ $(HAPTICSFIX_SOURCES) -lobjc \+ -Wl,-not_for_dyld_shared_cache+ @codesign --force --sign - $@+$(STAGE)/misfix/libmisfix.plist: MISFix/libmisfix.plist | $(STAGE)/misfix@cp $< $@diff --git a/VPhoneGuestComponents/README.md b/VPhoneGuestComponents/README.mdindex 85875929..10f64959 100644--- a/VPhoneGuestComponents/README.md+++ b/VPhoneGuestComponents/README.md@@ -8,6 +8,7 @@ tweak filter plists, and the GPU provenance note:| --- | --- || Camera app hook | `camfix/libcamfix.dylib`, `camfix/libcamfix.plist` || Camera daemon hook | `vcamcaptured/libvcamcaptured.dylib`, `vcamcaptured/libvcamcaptured.plist` |+| Haptics fix | `hapticsfix/libhapticsfix.dylib` || Launchd hook | `launchhook/launchdhook-vphone.dylib` || Process injection bridge | `systemhook/SystemHook-vphone.dylib` || iOS 27 app registrar | `vpregister/vpregister` |@@ -18,7 +19,9 @@ the launchd hook, SystemHook, and camera hooks in `/usr/lib`, and thevphoned environment update replaces changed copies in a running guest. SystemHookloads `libvcamcaptured.dylib` into `/usr/libexec/cameracaptured` and`libcamfix.dylib` into apps that have AVFoundation loaded; neither camera hook-needs ElleKit or a bootstrap. After a bootstrap installs ElleKit, the launchd hook+needs ElleKit or a bootstrap. It loads `libhapticsfix.dylib` into SpringBoard,+where UIKit's feedback engine would otherwise die on the haptics hardware no+VM has. After a bootstrap installs ElleKit, the launchd hookinserts SystemHook into `xpcproxy`, bootstrap executables, and apps starteddirectly by launchd. Inside `xpcproxy`, SystemHook carries itself into thefinal executable through `posix_spawnp`. Injected App and bootstrap processesdiff --git a/VPhoneGuestComponents/SystemHook/SystemHook-vphone.c b/VPhoneGuestComponents/SystemHook/SystemHook-vphone.cindex 3d3080aa..a39673a1 100644--- a/VPhoneGuestComponents/SystemHook/SystemHook-vphone.c+++ b/VPhoneGuestComponents/SystemHook/SystemHook-vphone.c@@ -142,6 +142,17 @@ static int vpExecve(const char *path, char *const argv[], char *const envp[]) {#define VP_CAMERA_DAEMON_HOOK "/usr/lib/libvcamcaptured.dylib"#define VP_CAMERA_APP_HOOK "/usr/lib/libcamfix.dylib"#define VP_AVFOUNDATION "/System/Library/Frameworks/AVFoundation.framework/AVFoundation"+// The haptics fix rides the same route and needs no loader of its own. See+// HapticsFix/libhapticsfix.c for what it answers and why SpringBoard is the+// target.+#define VP_HAPTICS_FIX "/usr/lib/libhapticsfix.dylib"++// The one UIKit process measured creating a CHHapticEngine without first+// asking CoreHaptics whether the hardware exists. Suffix-matched, like the+// MIS targets, so it holds however launchd names the binary.+static int vpIsSpringBoard(const char *path) {+ return vpPathHasSuffix(path, "/SpringBoard.app/SpringBoard");+}// A missing library is expected and stays quiet; anything else is logged.static void vpLoadLibrary(const char *kind, const char *library) {@@ -198,6 +209,11 @@ __attribute__((constructor)) static void vpLogProcess(void) {vpLoadLibrary("camera-hook", VP_CAMERA_DAEMON_HOOK);return;}+ // Loaded before the app gate: SpringBoard is neither an app path nor a+ // bootstrap executable, and the swizzle has to be in place before UIKit+ // first asks CoreHaptics for an engine.+ if (vpIsSpringBoard(path))+ vpLoadLibrary("haptics-fix", VP_HAPTICS_FIX);if (!vpInBootstrap && !vpIsAppPath(path))return;if (vpIsAppPath(path) && dlopen(VP_AVFOUNDATION, RTLD_LAZY | RTLD_NOLOAD))diff --git a/VPhoneKit/VPhoneCoreKit/VirtualMachine/VPhoneGuestEnvironment.swift b/VPhoneKit/VPhoneCoreKit/VirtualMachine/VPhoneGuestEnvironment.swiftindex 37253030..ad92a63b 100644--- a/VPhoneKit/VPhoneCoreKit/VirtualMachine/VPhoneGuestEnvironment.swift+++ b/VPhoneKit/VPhoneCoreKit/VirtualMachine/VPhoneGuestEnvironment.swift@@ -12,5 +12,6 @@ public enum VPhoneGuestEnvironment {"libvcamcaptured.dylib","libcamfix.dylib","libmisfix.dylib",+ "libhapticsfix.dylib",]}