Skip to content

Run a virtual iPhone on an Apple Silicon Mac.

Swift

Keep SystemHook as a process load probe

Lakr0fa79155c0b8
diff --git a/Research/0_binary_patch_comparison.md b/Research/0_binary_patch_comparison.md
index b10dac12..a6ac1b37 100644
--- a/Research/0_binary_patch_comparison.md
+++ b/Research/0_binary_patch_comparison.md
@@ -10,7 +10,7 @@
> not available install modes.
> **Current launchd hook (2026-09-25; isolated VM verification):**
-> `cfw install` now places `launchdhook-vphone.dylib` and an inert
+> `cfw install` now places `launchdhook-vphone.dylib` and a diagnostic
> `SystemHook-vphone.dylib` in `/usr/lib`, links `/vh` to the launchd hook,
> inserts a weak `/vh` load command for the
> launchd hook after `patch-launchd-jetsam`, and re-signs launchd. The hook
@@ -29,8 +29,16 @@
> and `ProgramArguments[0]` paths are translated to physical kernel paths in
> the in-memory XPC plist. The hook also tries to remove PID 1's existing
> jetsam limit and suppresses future fatal task-limit assignments for PID 1.
-> `SystemHook-vphone.dylib` is not injected into processes in this phase; ElleKit
-> chain loading, `DISABLE_TWEAKS`, and tweak filters remain a later step.
+> `SystemHook-vphone.dylib` is not injected into processes in this phase. When
+> loaded for diagnosis, it logs only PID and executable path to
+> `/var/mobile/Library/Caches/vphone-systemhook.log`; it does not load ElleKit.
+> ElleKit chain loading, `DISABLE_TWEAKS`, and tweak filters remain a later step.
+> An isolated experiment patched PID 1's `posix_spawn` with the old baseline
+> ElleKit `MSHookFunction` and inserted the diagnostic SystemHook. The hook
+> reached `xpcproxy` (327 probe log lines), but the launched package daemon
+> had no `DYLD_INSERT_LIBRARIES` and did not load SystemHook. Adding that
+> variable to the daemon plist was also ineffective. The experimental spawn
+> patch is therefore excluded from the installed launchd hook.
> The cloned `vphone-launchdhook-lab-26.6.2` booted with the weak dylib and
> retained a healthy vphoned API. Rootless and RootHide probes, each tested
> after reboot, were imported and spawned by launchd. The RootHide probe's
diff --git a/VPhoneGuestComponents/README.md b/VPhoneGuestComponents/README.md
index 975e6959..4a49dd98 100644
--- a/VPhoneGuestComponents/README.md
+++ b/VPhoneGuestComponents/README.md
@@ -9,16 +9,19 @@ 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` |
| Launchd hook | `launchhook/launchdhook-vphone.dylib` |
-| Reserved process hook | `systemhook/SystemHook-vphone.dylib` |
+| Process-load probe | `systemhook/SystemHook-vphone.dylib` |
+| iOS 27 app registrar | `vpregister/vpregister` |
| PCC GPU driver | `gpu/README.md` (source and extraction flow; no Apple binary) |
The archive is a local build artifact, not a VM bootstrap. The launchd hook is
installed by `cfw install` to discover package daemons after reboot; the process
-hook is staged but has no injection or chain-load behavior yet. Irisin installs
-ElleKit's own `TweakLoader.dylib` in the selected bootstrap. The required GPU bundle is
-instead extracted from the selected PCC firmware by `vphone-cli fw prepare`
-and copied into the VM during JB installation. No Apple GPU binary is stored
-in this directory, the archive, or the shipped app.
+hook is staged but is not injected automatically. If loaded for diagnosis, its
+constructor appends the PID and executable path to
+`/var/mobile/Library/Caches/vphone-systemhook.log`; it does not load ElleKit.
+Irisin installs ElleKit's own `TweakLoader.dylib` in the selected bootstrap.
+The required GPU bundle is extracted from the selected PCC firmware by
+`vphone-cli fw prepare` and copied into the VM during JB installation. No
+Apple GPU binary is stored in this directory, the archive, or the shipped app.
See `Research/Guest/virtual_camera_transport.md` for the camera transport
validation and the hook installation prerequisites.
diff --git a/VPhoneGuestComponents/SystemHook/SystemHook-vphone.c b/VPhoneGuestComponents/SystemHook/SystemHook-vphone.c
index 967ae6f2..a86826d4 100644
--- a/VPhoneGuestComponents/SystemHook/SystemHook-vphone.c
+++ b/VPhoneGuestComponents/SystemHook/SystemHook-vphone.c
@@ -1,3 +1,21 @@
-// Reserved for a later, explicitly gated ElleKit chain load.
-// This first version does not inject SystemHook into any process.
+#include <fcntl.h>
+#include <limits.h>
+#include <mach-o/dyld.h>
+#include <stdio.h>
+#include <unistd.h>
+
+// Diagnostic only: confirm which processes actually load SystemHook.
+__attribute__((constructor))
+static void vpLogProcess(void) {
+ char path[PATH_MAX];
+ uint32_t length = sizeof(path);
+ if (_NSGetExecutablePath(path, &length) != 0) return;
+
+ int fd = open("/var/mobile/Library/Caches/vphone-systemhook.log",
+ O_WRONLY | O_CREAT | O_APPEND | O_CLOEXEC, 0644);
+ if (fd < 0) return;
+ dprintf(fd, "pid=%d path=%s\n", getpid(), path);
+ close(fd);
+}
+
int vphone_systemhook_version(void) { return 1; }