Skip to content

Run a virtual iPhone on an Apple Silicon Mac.

Swift

HomePod Xcode app installation persona patch

Guilherme Rambobf8c6c0e913c
diff --git a/Research/0_binary_patch_comparison.md b/Research/0_binary_patch_comparison.md
index 7993a3b4..ab6b09ba 100644
--- a/Research/0_binary_patch_comparison.md
+++ b/Research/0_binary_patch_comparison.md
@@ -1,5 +1,18 @@
# Patch Comparison: Regular / Development / Jailbreak / Experimental
+> **HomePod Xcode installation persona (2026-10-23).**
+> The existing `system-installcoordination_proxy-cfw-persona_lookup` now has a
+> HomePod 27 deployment, selected by `homepod-mini`. TempPod reproduced the
+> iPhone's Protobox denial of the installation proxy's UserManager lookup.
+> HomePod loads a dedicated TVOS arm64e `libvphoneinstallpersona.dylib` in
+> launchd via the short `/vp` alias. It reuses the existing root-owned marker,
+> exact service/path/signing-identity and kernel-validated audit-token checks.
+> Other sandbox calls retain their arguments and native result. No spawn,
+> jetsam or iPhone environment hooks are included. Opt-out restores launchd
+> from its original backup before removing the marker, alias and library.
+> Live Xcode install/launch validation is in progress; see
+> `Research/Guest/ios27_xcode_persona_lookup.md`.
+
> **HomePod cryptex DDI staging (2026-10-23).**
> `system-cryptexd-exp-homepod_staging` is a selectable HomePod 27 guest patch,
> enabled by `homepod-mini` and excluded from the iOS/Apple TV presets. It
diff --git a/Research/Guest/ios27_xcode_persona_lookup.md b/Research/Guest/ios27_xcode_persona_lookup.md
index 4a7927b8..0a8a7b18 100644
--- a/Research/Guest/ios27_xcode_persona_lookup.md
+++ b/Research/Guest/ios27_xcode_persona_lookup.md
@@ -1,5 +1,34 @@
# Xcode installation and UserManager on the iOS 27 hybrid guest
+## HomePod port (2026-10-23)
+
+TempPod (UDID `0000FE01-EEC843C8BD20F085`, HomePod mini 27.2/24K120 over
+cloudOS 26.4, Xcode 27.2/27B48) reproduced the same failure with HomePodApp:
+CoreDevice 3002, MIInstallerErrorDomain 4, NSCocoaErrorDomain 4099. usermanagerd
+was running as root and its plist registered the expected service. A live kernel
+capture at 15:06:08 UTC confirmed:
+
+```text
+Protobox: installcoordination_proxy(251) deny(1) mach-lookup com.apple.mobile.usermanagerd.xpc
+```
+
+The HomePod preset previously excluded the persona patch along with the iPhone
+environment that supplied its launchd hook. The existing persona declaration
+now admits HomePod 27 and installs a dedicated TVOS arm64e library in launchd,
+via `/vp`, retaining the daemon's entitlements and original `.bak`. It shares
+`InstallCoordinationPersona.h`'s marker/path/signing-identity/audit-token policy.
+The arm64 entry shim preserves the indirectly passed 32-byte audit token and
+tail-forwards rejected calls with their original registers and variadic stack.
+Its harness checks zero, one and multiple arguments, plus the existing caller
+and marker rejection cases. No iPhone spawn/display/jetsam hooks are loaded.
+The marker, alias and library are removed after restoring launchd on opt-out;
+an unrelated `/vp` is refused instead of replaced or removed.
+
+Live installation/launch validation is in progress. Evidence captures:
+`/tmp/temppod-persona-proxy-log.json` and `/tmp/temppod-persona-kernel-log.json`.
+
+## Original iPhone investigation
+
Environment: pcc-research-01; iOS 27.0.1 (24A446), cloudOS 26.4 (23E5207q);
Xcode 27.0 (27A266a). Investigated 2026-10-07.
diff --git a/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/PatchSets/FirmwareGuestPatchResolution.swift b/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/PatchSets/FirmwareGuestPatchResolution.swift
index 423320dd..decd3775 100644
--- a/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/PatchSets/FirmwareGuestPatchResolution.swift
+++ b/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/PatchSets/FirmwareGuestPatchResolution.swift
@@ -56,6 +56,7 @@ public enum FirmwareGuestPatchResolution {
FirmwareGuestSystemPatchSet.homePodSiriSpeech,
FirmwareGuestSystemPatchSet.homePodOTAUserland, FirmwareGuestSystemPatchSet.homePodSoundGlow,
FirmwareGuestSystemPatchSet.homePodCryptexStaging, FirmwareGuestSystemPatchSet.homePodCryptexClass,
+ FirmwareGuestSystemPatchSet.installCoordinationPersona,
FirmwareGuestSystemPatchSet.virtioSoundDriver])
.union(FirmwarePatchSetCatalog.tvOS27UserlandPatches)
diff --git a/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/PatchSets/FirmwareGuestSystemPatchSet.swift b/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/PatchSets/FirmwareGuestSystemPatchSet.swift
index 7e490e78..3a175135 100644
--- a/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/PatchSets/FirmwareGuestSystemPatchSet.swift
+++ b/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/PatchSets/FirmwareGuestSystemPatchSet.swift
@@ -21,6 +21,7 @@ public enum FirmwareGuestSystemPatchSet {
public static let installCoordinationPersona = "system-installcoordination_proxy-cfw-persona_lookup"
public static let installCoordinationPersonaMarker = "/usr/lib/vphone-installcoordination-persona-lookup"
+ public static let homePodInstallPersonaLibrary = "/usr/lib/libvphoneinstallpersona.dylib"
public static let metalCacheReuse = "system-systemhook-cfw-metal_cache_reuse"
public static let metalCacheReuseMarker = "/usr/lib/vphone-metal-cache-reuse"
public static let gyroscope = "system-backboardd-cfw-gyroscope"
@@ -310,7 +311,7 @@ public enum FirmwareGuestSystemPatchSet {
VPhonePatchDeclaration(
identifier: installCoordinationPersona,
title: "Xcode installation persona lookup",
- summary: "Allows only the CoreDevice installation proxy to look up UserManager through the launchd hook on the hybrid guest.",
+ summary: "Allows only the CoreDevice installation proxy to look up UserManager through launchd on the hybrid guest. HomePod uses a dedicated tvOS adapter with the same audit-token checks, independently of the iPhone environment.",
target: .guestFile(path: installCoordinationPersonaMarker),
applicability: ios27,
),
diff --git a/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/PatchSets/FirmwarePatchSetCatalog.swift b/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/PatchSets/FirmwarePatchSetCatalog.swift
index 293124e4..4ee9e496 100644
--- a/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/PatchSets/FirmwarePatchSetCatalog.swift
+++ b/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/PatchSets/FirmwarePatchSetCatalog.swift
@@ -335,7 +335,7 @@ public enum FirmwarePatchSetCatalog {
patchSets: bundledReferences,
selection: .block(
manualOnlyPatches.subtracting([FirmwareGuestSystemPatchSet.homePodTopCap, FirmwareGuestSystemPatchSet.homePodSetupBypass, FirmwareGuestSystemPatchSet.homePodWelcome, FirmwareGuestSystemPatchSet.homePodSiriSpeech, FirmwareGuestSystemPatchSet.homePodOTAUserland, FirmwareGuestSystemPatchSet.homePodSoundGlow, FirmwareGuestSystemPatchSet.homePodCryptexStaging, FirmwareGuestSystemPatchSet.homePodCryptexClass])
- .union(tvOSBlockedPatches.subtracting(tvOS27UserlandPatches).subtracting([FirmwareGuestSystemPatchSet.virtioSoundDriver])),
+ .union(tvOSBlockedPatches.subtracting(tvOS27UserlandPatches).subtracting([FirmwareGuestSystemPatchSet.virtioSoundDriver, FirmwareGuestSystemPatchSet.installCoordinationPersona])),
),
)
diff --git a/VPhoneExecutable/VPhoneCommand/FirmwarePatcherTests/PatchSets/FirmwareGuestPatchResolutionTests.swift b/VPhoneExecutable/VPhoneCommand/FirmwarePatcherTests/PatchSets/FirmwareGuestPatchResolutionTests.swift
index 8f30236b..5b885fc2 100644
--- a/VPhoneExecutable/VPhoneCommand/FirmwarePatcherTests/PatchSets/FirmwareGuestPatchResolutionTests.swift
+++ b/VPhoneExecutable/VPhoneCommand/FirmwarePatcherTests/PatchSets/FirmwareGuestPatchResolutionTests.swift
@@ -12,6 +12,28 @@ import VPhonePatchKit
@Suite("Guest patch resolution")
struct FirmwareGuestPatchResolutionTests {
+ @Test func `HomePod persona lookup uses isolated tvOS deployment and follows selection`() throws {
+ let identifier = FirmwareGuestSystemPatchSet.installCoordinationPersona
+ for base in ["26.4", "27.0", "27.2", "28.0"] {
+ let plan = try VPhonePatchPlan.resolve(
+ preset: FirmwarePatchSetCatalog.homePodMiniPreset, patchSets: FirmwarePatchSetCatalog.bundled,
+ iOSBase: VPhoneVersion(base), cloudOS: VPhoneVersion("26.4"),
+ )
+ #expect(plan.isEnabled(identifier) == base.hasPrefix("27."))
+ #expect(!plan.isEnabled("system-launchdaemons-boot-environment"))
+ #expect(!plan.isEnabled(FirmwareGuestSystemPatchSet.arm64eX1LaunchdBootstrap))
+ #expect(!plan.isEnabled("system-launchd-boot-jetsam_panic_guard_bypass"))
+ }
+ let disabled = try VPhonePatchPlan.resolve(
+ preset: FirmwarePatchSetCatalog.homePodMiniPreset, patchSets: FirmwarePatchSetCatalog.bundled,
+ iOSBase: VPhoneVersion("27.2"), cloudOS: VPhoneVersion("26.4"), blocked: [identifier],
+ )
+ #expect(!disabled.isEnabled(identifier))
+ #expect(FirmwareGuestPatchResolution.guestPatchesOff(selectionEnabled: disabled.enabled).contains(identifier))
+ #expect(FirmwareGuestPatchResolution.unvalidatedHomePodGuestPatches(enabled: [identifier]).isEmpty)
+ #expect(FirmwareGuestPatchResolution.unvalidatedTVGuestPatches(enabled: [identifier], arm64eUserland: true) == [identifier])
+ }
+
@Test(arguments: [FirmwareGuestSystemPatchSet.homePodCryptexStaging, FirmwareGuestSystemPatchSet.homePodCryptexClass])
func `HomePod cryptex staging is independent of the iPhone environment and reversible in selection`(identifier: String) throws {
for base in ["26.4", "27.0", "27.2", "28.0"] {
diff --git a/VPhoneExecutable/VPhoneCommand/VPhoneCommand/Firmware/VPhoneCustomFirmwareInstaller.swift b/VPhoneExecutable/VPhoneCommand/VPhoneCommand/Firmware/VPhoneCustomFirmwareInstaller.swift
index 529f54ef..78edf05a 100644
--- a/VPhoneExecutable/VPhoneCommand/VPhoneCommand/Firmware/VPhoneCustomFirmwareInstaller.swift
+++ b/VPhoneExecutable/VPhoneCommand/VPhoneCommand/Firmware/VPhoneCustomFirmwareInstaller.swift
@@ -1863,7 +1863,42 @@ struct VPhoneCustomFirmwareInstaller {
let launchdJetsam = "system-launchd-boot-jetsam_panic_guard_bypass"
let launchdX1 = FirmwareGuestSystemPatchSet.arm64eX1LaunchdBootstrap
- isolate([launchdJetsam, launchdX1]) {
+ let personaPatch = FirmwareGuestSystemPatchSet.installCoordinationPersona
+ let personaMarker = String(FirmwareGuestSystemPatchSet.installCoordinationPersonaMarker.dropFirst())
+ let isHomePod = guestDevice.family == .homePod
+ isolate([launchdJetsam, launchdX1] + (isHomePod ? [personaPatch] : [])) {
+ if isHomePod {
+ let library = FirmwareGuestSystemPatchSet.homePodInstallPersonaLibrary
+ let path = String(library.dropFirst())
+ if on(personaPatch) {
+ let payload = try VPhoneGuestBinaries.resolve((library as NSString).lastPathComponent)
+ try system.replaceFile(path, fromFileAt: payload, mode: 0o755, owner: Self.guestOwner)
+ // launchd needs a short load command; this alias is owned
+ // only by HomePod's isolated installation compatibility.
+ try installLibraryAlias(system: system, alias: "vp", target: library)
+ try patchMachO(system: system, work: work, path: "sbin/launchd",
+ preserveEntitlements: true, injectedDylibPath: "/vp")
+ try system.writeFile(personaMarker, contents: Data("1\n".utf8), mode: 0o644, owner: Self.guestOwner)
+ live.insert(personaPatch)
+ print(" [+] \(personaPatch): installed scoped HomePod UserManager adapter")
+ } else {
+ if try revertMachO(system: system, work: work, path: "sbin/launchd") {
+ print(" [+] \(personaPatch): restored HomePod launchd from backup")
+ } else if priorGuest.contains(personaPatch) {
+ live.insert(personaPatch)
+ throw ValidationError("HomePod persona compatibility has no launchd backup; cannot safely remove its library.")
+ }
+ try system.removeItem(personaMarker)
+ if try system.exists("vp") {
+ guard try system.readLink("vp") == library else {
+ throw ValidationError("Another file uses /vp; leaving it intact.")
+ }
+ try system.removeItem("vp")
+ }
+ try system.removeItem(path)
+ }
+ return
+ }
let enabled = [launchdJetsam, launchdX1].filter(on)
if !enabled.isEmpty {
var verbs: [String] = []
@@ -1918,9 +1953,7 @@ struct VPhoneCustomFirmwareInstaller {
}
}
- let personaPatch = FirmwareGuestSystemPatchSet.installCoordinationPersona
- let personaMarker = String(FirmwareGuestSystemPatchSet.installCoordinationPersonaMarker.dropFirst())
- isolate([personaPatch]) {
+ if !isHomePod { isolate([personaPatch]) {
// Undo the experimental entitlement-only patch if this machine
// received it. Platform Protobox profiles ignore that exception.
let proxy = "System/Library/PrivateFrameworks/InstallCoordination.framework/Support/installcoordination_proxy"
@@ -1934,7 +1967,7 @@ struct VPhoneCustomFirmwareInstaller {
} else {
try system.removeItem(personaMarker)
}
- }
+ } }
// SystemHook sets FS_CACHE_REUSE_ON_REBOOT while this marker exists.
let metalCachePatch = FirmwareGuestSystemPatchSet.metalCacheReuse
diff --git a/VPhoneExecutable/VPhoneVirtualization/Build/StageBundle.sh b/VPhoneExecutable/VPhoneVirtualization/Build/StageBundle.sh
index 709cb11c..9e2d0186 100755
--- a/VPhoneExecutable/VPhoneVirtualization/Build/StageBundle.sh
+++ b/VPhoneExecutable/VPhoneVirtualization/Build/StageBundle.sh
@@ -92,6 +92,7 @@ daemon_sdk="$(/usr/bin/otool -l "$guest/vphoned" | /usr/bin/awk '/LC_BUILD_VERSI
/bin/cp "$guest_products/accelerometer/libvphoneaccelerometer.dylib" "$guest/libvphoneaccelerometer.dylib"
/bin/cp "$guest_products/attitude/libvphoneattitude.dylib" "$guest/libvphoneattitude.dylib"
/bin/cp "$guest_products/cryptexstaging/libvphonecryptexstaging.dylib" "$guest/libvphonecryptexstaging.dylib"
+/bin/cp "$guest_products/homepodpersona/libvphoneinstallpersona.dylib" "$guest/libvphoneinstallpersona.dylib"
/bin/cp "$guest_products/homepoddisplay/libvphonehomepoddisplay.dylib" "$guest/libvphonehomepoddisplay.dylib"
/bin/cp "$guest_products/homepodsetup/vphone-homepod-setup" "$guest/vphone-homepod-setup"
/bin/cp "$guest_products/homepodsetup/com.vphone.homepod-setup.plist" "$guest/com.vphone.homepod-setup.plist"
diff --git a/VPhoneExecutable/VPhoneVirtualization/Build/ValidateBundle.sh b/VPhoneExecutable/VPhoneVirtualization/Build/ValidateBundle.sh
index cdb1ad8f..2dfc57bb 100755
--- a/VPhoneExecutable/VPhoneVirtualization/Build/ValidateBundle.sh
+++ b/VPhoneExecutable/VPhoneVirtualization/Build/ValidateBundle.sh
@@ -146,7 +146,7 @@ fi
for name in vphoned vphoned-tvos vphoned-watchos launchdhook-vphone.dylib SystemHook-vphone.dylib libcamfix.dylib \
libvcamcaptured.dylib libmisfix.dylib libhapticsfix.dylib libbatteryhealthfix.dylib libdevicehubfix.dylib libdevicename.dylib \
- libprefsfix.dylib libsigninfix.dylib libvphonegyro.dylib libvphoneaccelerometer.dylib libvphoneattitude.dylib libvphonehomepoddisplay.dylib libvphonecryptexstaging.dylib vphone-homepod-setup libAppleParavirtCompilerPluginIOGPUFamily.dylib; do
+ libprefsfix.dylib libsigninfix.dylib libvphonegyro.dylib libvphoneaccelerometer.dylib libvphoneattitude.dylib libvphonehomepoddisplay.dylib libvphonecryptexstaging.dylib libvphoneinstallpersona.dylib vphone-homepod-setup libAppleParavirtCompilerPluginIOGPUFamily.dylib; do
require_signed_macho "$guest/$name"
done
for name in vphoned.plist libcamfix.plist libvcamcaptured.plist libmisfix.plist com.vphone.homepod-setup.plist; do
@@ -200,7 +200,7 @@ while IFS= read -r file; do
"$frameworks/"*)
[[ "$platform" != IOS ]] || { print -u2 "iOS binary in Contents/Frameworks: ${file#$bundle/}"; exit 1; }
;;
- "$guest/vphoned-tvos"|"$guest/libvphonehomepoddisplay.dylib"|"$guest/libvphonecryptexstaging.dylib"|"$guest/vphone-homepod-setup")
+ "$guest/vphoned-tvos"|"$guest/libvphonehomepoddisplay.dylib"|"$guest/libvphonecryptexstaging.dylib"|"$guest/libvphoneinstallpersona.dylib"|"$guest/vphone-homepod-setup")
# tvOS dyld refuses an iOS-platform daemon on an Apple TV guest.
[[ "$platform" == TVOS ]] || { print -u2 "Non-tvOS binary: ${file#$bundle/}"; exit 1; }
;;
diff --git a/VPhoneExecutable/VPhoneVirtualization/Resources/patches_presets/homepod-mini.plist b/VPhoneExecutable/VPhoneVirtualization/Resources/patches_presets/homepod-mini.plist
index f12453c9..812bc346 100644
--- a/VPhoneExecutable/VPhoneVirtualization/Resources/patches_presets/homepod-mini.plist
+++ b/VPhoneExecutable/VPhoneVirtualization/Resources/patches_presets/homepod-mini.plist
@@ -115,7 +115,6 @@
<string>system-extensions-boot-gpu_bundle</string>
<string>system-tv-exp-ota_userland</string>
<string>system-fsck-boot-arm64e_x1_bootstrap</string>
- <string>system-installcoordination_proxy-cfw-persona_lookup</string>
<string>system-jetsamproperties-cfw-disable_allowed</string>
<string>system-launchd-boot-arm64e_x1_bootstrap</string>
<string>system-launchd-boot-jetsam_panic_guard_bypass</string>
diff --git a/VPhoneGuestComponents/HomePodInstallPersona/libvphoneinstallpersona.c b/VPhoneGuestComponents/HomePodInstallPersona/libvphoneinstallpersona.c
new file mode 100644
index 00000000..5453ad1a
--- /dev/null
+++ b/VPhoneGuestComponents/HomePodInstallPersona/libvphoneinstallpersona.c
@@ -0,0 +1,72 @@
+// HomePod port of the existing installation-proxy UserManager exception.
+// This image has no spawn, jetsam, display, or iPhone environment hooks.
+#include <errno.h>
+#include <fcntl.h>
+#include <limits.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+#ifndef VP_HOMEPOD_PERSONA_TESTING
+typedef struct { unsigned int val[8]; } vp_audit_token_t;
+#endif
+#include "../LaunchHook/InstallCoordinationPersona.h"
+
+#ifdef VP_HOMEPOD_PERSONA_TESTING
+#define VP_SANDBOX_SYMBOL "_vpTestSandboxCheck"
+#else
+#define VP_SANDBOX_SYMBOL "_sandbox_check_by_audit_token"
+extern int sandbox_check_by_audit_token(vp_audit_token_t token, const char *operation,
+ unsigned int filter, ...);
+#endif
+
+__attribute__((used, noinline)) static int vpHomePodPersonaAllowed(
+ const vp_audit_token_t *token, const char *operation, unsigned int filter, const void *name) {
+ int saved = errno;
+#ifdef VP_HOMEPOD_PERSONA_TESTING
+ int allowed = vpInstallProxyPersonaAllowed(*token, operation, filter, name);
+#else
+ int allowed = getpid() == 1 && vpInstallProxyPersonaAllowed(*token, operation, filter, name);
+ if (allowed) {
+ int fd = open("/var/mobile/Library/Caches/vphone-homepod-persona.log",
+ O_WRONLY | O_CREAT | O_APPEND | O_CLOEXEC, 0644);
+ if (fd >= 0) {
+ dprintf(fd, "allow pid=%u mach-lookup %s\n", token->val[5], VP_PERSONA_SERVICE);
+ close(fd);
+ }
+ }
+#endif
+ errno = saved;
+ return allowed;
+}
+
+// Apple's arm64 ABI passes the 32-byte token indirectly in x0, the remaining
+// fixed arguments in x1/x2, and variadic arguments on the stack. Inspect only
+// the first stack slot, and tail-forward rejected calls with their original
+// stack and registers. In particular, no va_arg is read for no-argument calls.
+__attribute__((naked)) static int vpHomePodSandboxCheck(vp_audit_token_t token,
+ const char *operation, unsigned int filter, ...) {
+ __asm__("stp x29, x30, [sp, #-48]!\n"
+ "mov x29, sp\n"
+ "stp x0, x1, [sp, #16]\n"
+ "str x2, [sp, #32]\n"
+ "ldr x3, [sp, #48]\n"
+ "bl _vpHomePodPersonaAllowed\n"
+ "cmp w0, #0\n"
+ "ldp x0, x1, [sp, #16]\n"
+ "ldr x2, [sp, #32]\n"
+ "ldp x29, x30, [sp], #48\n"
+ "b.eq 1f\n"
+ "mov w0, #0\n"
+ "ret\n"
+ "1: b " VP_SANDBOX_SYMBOL "\n");
+}
+
+#ifndef VP_HOMEPOD_PERSONA_TESTING
+__attribute__((used, section("__DATA,__interpose"))) static const struct {
+ const void *replacement;
+ const void *original;
+} vpInterpose = { (const void *)&vpHomePodSandboxCheck, (const void *)&sandbox_check_by_audit_token };
+#endif
diff --git a/VPhoneGuestComponents/Makefile b/VPhoneGuestComponents/Makefile
index 844d34fe..69f3c78c 100644
--- a/VPhoneGuestComponents/Makefile
+++ b/VPhoneGuestComponents/Makefile
@@ -100,6 +100,8 @@ HOMEPODDISPLAY_SOURCES := $(call find_sources,HomePodDisplay)
HOMEPODDISPLAY_INPUTS := $(call find_headers,HomePodDisplay) $(call find_folders,HomePodDisplay)
CRYPTEXSTAGING := $(STAGE)/cryptexstaging/libvphonecryptexstaging.dylib
CRYPTEXSTAGING_SOURCE := CryptexStagingFix/libvphonecryptexstaging.c
+HOMEPODPERSONA := $(STAGE)/homepodpersona/libvphoneinstallpersona.dylib
+HOMEPODPERSONA_INPUTS := HomePodInstallPersona/libvphoneinstallpersona.c LaunchHook/InstallCoordinationPersona.h
HOMEPODSETUP := $(STAGE)/homepodsetup/vphone-homepod-setup
HOMEPODSETUP_SOURCES := $(call find_sources,HomePodSetup)
HOMEPODSETUP_INPUTS := $(call find_headers,HomePodSetup) HomePodSetup/com.vphone.homepod-setup.plist
@@ -136,7 +138,7 @@ GPU_DYNAMIC_LOOKUP_SYMS := \
VIRTIOSOUND := $(STAGE)/virtiosound/VPhoneVirtIOSound.driver
VIRTIOSOUND_SOURCES := $(wildcard VirtIOSound/*.m VirtIOSound/*.c)
VIRTIOSOUND_INCLUDES := $(wildcard VirtIOSound/*.h) VirtIOSound/Info.plist VirtIOSound/AudioServerDriver.tbd
-ARTIFACTS := $(CAMFIX) $(VCAMCAPTURED) $(LAUNCHHOOK) $(SYSTEMHOOK) $(MISFIX) $(HAPTICSFIX) $(BATTERYHEALTHFIX) $(DEVICEHUBFIX) $(DEVICENAME) $(PREFSFIX) $(SIGNINFIX) $(GYROSCOPE) $(ACCELEROMETER) $(ATTITUDE) $(HOMEPODDISPLAY) $(CRYPTEXSTAGING) $(HOMEPODSETUP) $(GPU_PLUGIN) $(VIRTIOSOUND)
+ARTIFACTS := $(CAMFIX) $(VCAMCAPTURED) $(LAUNCHHOOK) $(SYSTEMHOOK) $(MISFIX) $(HAPTICSFIX) $(BATTERYHEALTHFIX) $(DEVICEHUBFIX) $(DEVICENAME) $(PREFSFIX) $(SIGNINFIX) $(GYROSCOPE) $(ACCELEROMETER) $(ATTITUDE) $(HOMEPODDISPLAY) $(CRYPTEXSTAGING) $(HOMEPODPERSONA) $(HOMEPODSETUP) $(GPU_PLUGIN) $(VIRTIOSOUND)
PLISTS := $(STAGE)/camfix/libcamfix.plist $(STAGE)/vcamcaptured/libvcamcaptured.plist \
$(STAGE)/misfix/libmisfix.plist
GPU_PROVENANCE := $(STAGE)/gpu/README.md
@@ -182,7 +184,7 @@ gpu: $(GPU_PLUGIN)
package: all
@rm -f $(ARCHIVE)
- @/usr/bin/tar -cf $(ARCHIVE) -C $(STAGE) camfix vcamcaptured launchhook systemhook misfix hapticsfix batteryhealthfix devicehubfix devicename prefsfix signinfix gyroscope accelerometer attitude homepoddisplay cryptexstaging homepodsetup gpu virtiosound
+ @/usr/bin/tar -cf $(ARCHIVE) -C $(STAGE) camfix vcamcaptured launchhook systemhook misfix hapticsfix batteryhealthfix devicehubfix devicename prefsfix signinfix gyroscope accelerometer attitude homepoddisplay cryptexstaging homepodpersona homepodsetup gpu virtiosound
@echo "Packaged $(ARCHIVE)"
test-loader-links:
@@ -382,6 +384,14 @@ $(HOMEPODDISPLAY): $(HOMEPODDISPLAY_SOURCES) $(HOMEPODDISPLAY_INPUTS)
-o $@ $(HOMEPODDISPLAY_SOURCES) -framework Foundation -Wl,-not_for_dyld_shared_cache
@codesign --force --sign - $@
+$(HOMEPODPERSONA): $(HOMEPODPERSONA_INPUTS)
+ @mkdir -p $(STAGE)/homepodpersona
+ xcrun --sdk appletvos clang -arch arm64e -mtvos-version-min=27.0 -Os \
+ -Wall -Wextra -Werror -Wno-unused-parameter -dynamiclib \
+ -install_name /usr/lib/libvphoneinstallpersona.dylib \
+ -o $@ $< -Wl,-not_for_dyld_shared_cache
+ @codesign --force --sign - $@
+
$(CRYPTEXSTAGING): $(CRYPTEXSTAGING_SOURCE)
@mkdir -p $(STAGE)/cryptexstaging
xcrun --sdk appletvos clang -arch arm64e -mtvos-version-min=27.0 -Os \
@@ -512,7 +522,7 @@ test-camfix-geometry:
.PHONY: test-installcoordination-persona
test-installcoordination-persona:
@mkdir -p $(OUT)
- xcrun --sdk macosx clang -Wall -Wextra -Werror \
+ xcrun --sdk macosx clang -arch arm64 -O1 -Wall -Wextra -Werror -Wno-unused-parameter \
-o $(OUT)/InstallCoordinationPersonaTests Tests/InstallCoordinationPersonaTests.c
@$(OUT)/InstallCoordinationPersonaTests
diff --git a/VPhoneGuestComponents/Tests/InstallCoordinationPersonaTests.c b/VPhoneGuestComponents/Tests/InstallCoordinationPersonaTests.c
index ee764398..f89d7167 100644
--- a/VPhoneGuestComponents/Tests/InstallCoordinationPersonaTests.c
+++ b/VPhoneGuestComponents/Tests/InstallCoordinationPersonaTests.c
@@ -1,6 +1,8 @@
#include <assert.h>
#include <limits.h>
#include <stdint.h>
+#include <stdarg.h>
+#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <sys/stat.h>
@@ -31,6 +33,22 @@ int test_csops(pid_t pid, unsigned int op, void *buffer, size_t size, vp_audit_t
snprintf((char *)buffer + 8, size - 8, "%s", wrongIdentity ? "other" : "com.apple.installcoordination_proxy");
return 0;
}
+#define VP_HOMEPOD_PERSONA_TESTING
+#include "../HomePodInstallPersona/libvphoneinstallpersona.c"
+
+int vpTestSandboxCheck(vp_audit_token_t token, const char *operation, unsigned int filter, ...) {
+ assert(token.val[5] == 404 && token.val[7] == 42);
+ if (filter == 99) {
+ va_list arguments;
+ va_start(arguments, filter);
+ assert(va_arg(arguments, const char *) == operation);
+ assert(va_arg(arguments, int) == 567);
+ assert(va_arg(arguments, void *) == &markerMode);
+ va_end(arguments);
+ }
+ errno = EACCES;
+ return 73;
+}
int main(void) {
vp_audit_token_t token = {{0}};
token.val[5] = 404;
@@ -55,5 +73,13 @@ int main(void) {
markerMode = S_IFREG | 0644;
markerOwner = 501;
assert(!vpInstallProxyPersonaAllowed(token, "mach-lookup", 2, VP_PERSONA_SERVICE));
+ markerOwner = 0;
+ errno = EDOM;
+ assert(vpHomePodSandboxCheck(token, "mach-lookup", 2, VP_PERSONA_SERVICE) == 0);
+ assert(errno == EDOM);
+ assert(vpHomePodSandboxCheck(token, NULL, 0) == 73 && errno == EACCES);
+ assert(vpHomePodSandboxCheck(token, "mach-lookup", 2, "com.apple.other") == 73);
+ const char *op = "other-operation";
+ assert(vpHomePodSandboxCheck(token, op, 99, op, 567, &markerMode) == 73);
puts("InstallCoordination persona lookup scope tests passed");
}