Repository navigation
Conversation
Owner
|
Thanks for the PR! This is a neat idea. However, it's pretty unlikely that I'll change how the daemon authentication works. I generally don't play the cat and mouse game to try to accommodate root (or root-related) hiding mechanisms in any of my projects. The daemon was originally set up to use SELinux for access control since the implementation is simple and is how many other AOSP daemons, like |
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.
Issue
On the tested KernelSU Next setup, enabling SELinux Hide prevents MSD from launching because Android rejects its injected
msd_appcontext.Fix
Referenced the authentication mechanism used by KernelSU to ensure that the MSD daemon can authenticate clients securely even when SELinux Hide is enabled, use the existing
untrusted_appdomain for the UI.The daemon obtains the peer UID with SO_PEERCRED. A root
app_processsupervisor checks that UID against Package Manager and requires the exact MSD package, matching full UID and Android user, no shared UID, and one current signer matching a certificate pin generated from the module's signing configuration. Queries use private inherited pipes; the client cannot supply its own identity or verification result.Authenticate before the protocol handshake and worker creation, then revalidate before each request. Pipe errors, malformed responses, and timeouts fail closed, including protection against accepting a late response for another request. Keep the daemon's restricted SELinux domain, system UID, CAP_CHOWN, and existing SELinux checks.
This changes the access-control boundary: other apps in
untrusted_appcan reach the socket, but must pass authentication. It also adds a root supervisor and a Package Manager dependency. UID 0 retains CLI access; shell and UID 1000 do not bypass authentication, including when--allow-adbgrants SELinux connectivity. Certificate rotation requires an updated pin.Test environment
Validation
untrusted_appwere rejected.CI
./gradlew --no-daemon build zipDebug -x assembleRelease).NO-SOURCE; CI did not execute device tests or the native authentication tests.CI ran on
ci/selinux-hide-authata1726d3. Its source matchespr/selinux-hide-authat7a40ce1; only the two workflow push triggers differ. Release builds are excluded by the existing workflow.