Repository navigation
Conversation
The daemon shadows /data/resource-cache so its root app_process does not write the boot's framework idmaps into the cache every other process shares. The shadow is only safe while service.sh actually puts it in a private mount namespace: when that isolation is not available (toybox unshare lacking the flags, busybox and toybox disagreeing, or the SELinux domain refusing unshare outright), the bind mount used to land in the global namespace and hide the idmaps behind the framework-res overlay redirects from every process launched afterwards. A system_server booting behind a leaked shadow then reads the un-overlaid config_servicesExtensionPackage value. On GMS builds that names android.ext.services, which does not exist on the system image, and PMS init throws from getRequiredServicesExtensionPackageLPr every cycle - the system_server boot loop of JingMatrix#1101. service.sh now degrades gracefully instead: when a private namespace cannot be established the daemon starts unshadowed (an idmap2 write at most) rather than leaking a shadow or not starting at all, and the daemon script mounts its shadow only when service.sh confirms the namespace is private (VECTOR_SHADOW_OK). Fixes the boot-loop half of JingMatrix#1101.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Standalone half of the investigation behind #1101 (see also the boot-loop escalation comment there and discussion #1042); the scope-spelling half is in #1103.
What breaks
The daemon shadows
/data/resource-cacheso its root app_process does not write the boot's framework idmaps into the cache every other process shares (service.shunshares first, deliberately). That is only safe while the isolation actually holds, and in the wild it does not reliably hold:unsharetakes no--propagationflag (the 3080-eraservice.shused it), so the daemon script never ran under isolation there;unshare -mis not guaranteed either — we measured intermittentEPERMfrom the same root SELinux domain seconds apart on the device, and the old code's|| echofell through to starting the daemon regardless, leaving the shadow in a shared namespace;A shadow leaked into the global namespace hides the idmap files behind the framework-res overlay redirects from every process launched afterwards. A freshly booting system_server then reads the un-overlaid
config_servicesExtensionPackagevalue: on the GMS build we reproduced on, the base value isandroid.ext.services(verified in framework-res), the only ExtServices on the image iscom.google.android.ext.services(APEX, redirect carried by the enabledcom.google.android.overlay.modules.ext.services.cnoverlay), soPackageManagerService.getRequiredServicesExtensionPackageLPrthrows on every cycle — the system_server boot loop reported in #1101.umount /data/resource-cacheis what ended the loop on that device; the leaked tmpfs from the earlier build was still present in the global namespace then.The change
service.shdegrades gracefully instead: when a private mount namespace cannot be established, the daemon starts unshadowed (an early idmap2 write at most) instead of leaking a shadow — or, in the pre-HEAD form, not starting at all. The daemon script mounts its shadow only whenservice.shconfirms the namespace around it is private (VECTOR_SHADOW_OK), so a leaked shadow cannot happen by construction.Verification (HyperOS 2.0 / Android 15, beryl, KernelSU + Zygisk Next)
Built from this branch (debug) and deployed over the previously disabled module:
ksud services: vectord starts, the shadow lands in the daemon's own mount namespace, and init's namespace stays clean (grep resource-cache /proc/1/mountinfo= 0) across the whole boot and a followingksud soft-reboot.