Skip to content

Run a virtual iPhone on an Apple Silicon Mac.

Swift

Ship libdevicename with the guest environment

Jacky8b31d00f9fda
diff --git a/VPhoneDaemon/Daemon/GuestAPI+Environment.swift b/VPhoneDaemon/Daemon/GuestAPI+Environment.swift
index bee7ea57..ffac3b9b 100644
--- a/VPhoneDaemon/Daemon/GuestAPI+Environment.swift
+++ b/VPhoneDaemon/Daemon/GuestAPI+Environment.swift
@@ -18,6 +18,7 @@ extension GuestAPI {
"libhapticsfix.dylib",
"libbatteryhealthfix.dylib",
"libdevicehubfix.dylib",
+ "libdevicename.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.swift
index 27113f56..264d9cc6 100644
--- a/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/PatchSets/FirmwareGuestSystemPatchSet.swift
+++ b/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/PatchSets/FirmwareGuestSystemPatchSet.swift
@@ -197,7 +197,10 @@ public enum FirmwareGuestSystemPatchSet {
the virtual battery the health record Battery Health waits for, and \
libdevicehubfix.dylib, inserted into cryptexd, which then stages the iOS 27 \
developer disk image, and into the image's dtremotedisplayd, which then reports \
- the media stream features Xcode's DeviceHub needs to show the screen.
+ the media stream features Xcode's DeviceHub needs to show the screen. \
+ libdevicename.dylib, inserted into configd and lockdownd, does nothing unless the \
+ host writes a device name to NVRAM; then configd publishes that name and lockdownd \
+ refuses to rename the device.
""",
target: .guestFile(path: "/Library/LaunchDaemons"),
bootEssential: true,
diff --git a/VPhoneExecutable/VPhoneVirtualization/Build/StageBundle.sh b/VPhoneExecutable/VPhoneVirtualization/Build/StageBundle.sh
index ad3b04a4..4b880122 100755
--- a/VPhoneExecutable/VPhoneVirtualization/Build/StageBundle.sh
+++ b/VPhoneExecutable/VPhoneVirtualization/Build/StageBundle.sh
@@ -76,6 +76,7 @@ fi
/bin/cp "$guest_products/hapticsfix/libhapticsfix.dylib" "$guest/libhapticsfix.dylib"
/bin/cp "$guest_products/batteryhealthfix/libbatteryhealthfix.dylib" "$guest/libbatteryhealthfix.dylib"
/bin/cp "$guest_products/devicehubfix/libdevicehubfix.dylib" "$guest/libdevicehubfix.dylib"
+/bin/cp "$guest_products/devicename/libdevicename.dylib" "$guest/libdevicename.dylib"
/bin/cp "$guest_products/gpu/libAppleParavirtCompilerPluginIOGPUFamily.dylib" \
"$guest/libAppleParavirtCompilerPluginIOGPUFamily.dylib"
# The HAL plugin is a bundle, signed whole by the Makefile; copied as a tree so
diff --git a/VPhoneExecutable/VPhoneVirtualization/Build/ValidateBundle.sh b/VPhoneExecutable/VPhoneVirtualization/Build/ValidateBundle.sh
index d34f369f..fa6b7845 100755
--- a/VPhoneExecutable/VPhoneVirtualization/Build/ValidateBundle.sh
+++ b/VPhoneExecutable/VPhoneVirtualization/Build/ValidateBundle.sh
@@ -88,7 +88,7 @@ for preset in "$resources/patches_presets/"*.plist; do
done
for name in vphoned launchdhook-vphone.dylib SystemHook-vphone.dylib libcamfix.dylib \
- libvcamcaptured.dylib libmisfix.dylib libhapticsfix.dylib libbatteryhealthfix.dylib libdevicehubfix.dylib \
+ libvcamcaptured.dylib libmisfix.dylib libhapticsfix.dylib libbatteryhealthfix.dylib libdevicehubfix.dylib libdevicename.dylib \
libAppleParavirtCompilerPluginIOGPUFamily.dylib; do
require_signed_macho "$guest/$name"
done
diff --git a/VPhoneGuestComponents/README.md b/VPhoneGuestComponents/README.md
index 260fdfe2..b4620087 100644
--- a/VPhoneGuestComponents/README.md
+++ b/VPhoneGuestComponents/README.md
@@ -10,6 +10,8 @@ tweak filter plists, and the GPU provenance note:
| Camera daemon hook | `vcamcaptured/libvcamcaptured.dylib`, `vcamcaptured/libvcamcaptured.plist` |
| Haptics fix | `hapticsfix/libhapticsfix.dylib` |
| Battery health fix | `batteryhealthfix/libbatteryhealthfix.dylib` |
+| DeviceHub fix | `devicehubfix/libdevicehubfix.dylib` |
+| Device name pin | `devicename/libdevicename.dylib` |
| Launchd hook | `launchhook/launchdhook-vphone.dylib` |
| Process injection bridge | `systemhook/SystemHook-vphone.dylib` |
| iOS 27 app registrar | `vpregister/vpregister` |
@@ -27,7 +29,12 @@ VM has. Both spawn hooks insert `libbatteryhealthfix.dylib` into Settings beside
SystemHook; it completes the internal battery's power source description with
the health keys a real battery has and answers the two questions only battery
hardware can, so Battery Health shows a healthy battery instead of loading
-forever.
+forever. Both also insert `libdevicename.dylib` into configd and lockdownd
+(lockdownd takes it after `libmisfix.dylib`). It acts only when the host has
+written the NVRAM variable `vphone-device-name`: configd then publishes that
+name as the device name and lockdownd refuses renames, while
+`preferences.plist` keeps the guest's own name. See
+`Research/Guest/device_name_pinning.md`.
After a bootstrap installs ElleKit, the launchd hook
inserts SystemHook into `xpcproxy`, bootstrap executables, and apps started
directly by launchd. Inside `xpcproxy`, SystemHook carries itself into the
diff --git a/VPhoneKit/VPhoneCoreKit/VirtualMachine/VPhoneGuestEnvironment.swift b/VPhoneKit/VPhoneCoreKit/VirtualMachine/VPhoneGuestEnvironment.swift
index fcbc115f..55391383 100644
--- a/VPhoneKit/VPhoneCoreKit/VirtualMachine/VPhoneGuestEnvironment.swift
+++ b/VPhoneKit/VPhoneCoreKit/VirtualMachine/VPhoneGuestEnvironment.swift
@@ -15,5 +15,6 @@ public enum VPhoneGuestEnvironment {
"libhapticsfix.dylib",
"libbatteryhealthfix.dylib",
"libdevicehubfix.dylib",
+ "libdevicename.dylib",
]
}