Fix dex2oat wrapper SELinux check on Android 14+#785
Conversation
|
@pbzin Please upload your logs in Redmi Note 13 4G for me to better understand what you described. |
avc: denied { execute } LSPosedService: failed to change feature flags No IPC binder obtained ... Skipping injection |
|
@pbzin Please upload the original logs, not the filtered one. |
I'm trying to reproduce it again and for some reason it doesn't give me the error, I messed around a lot with my crdroid rom so it could be that or magisk, I don't know, so the only explanation and log I can find is the previous one with codex and below with gemini, maybe it will help Technical Context: On Android 14+ (SDK 34+), AOSP refactored dex2oat invocations to go through the artd daemon, establishing the domain transition artd -> dex2oat_exec -> dex2oat. In the legacy code, canUseDex2OatExec() checks: kotlin SELinux.checkSELinuxAccess("u:r:dex2oat:s0", "u:object_r:dex2oat_exec:s0", "file", "execute_no_trans") kotlin SELinux.setFileContext(WRAPPER, xposedFile) Why it might pass on some devices/custom setups: If a custom ROM or root solution (Magisk/KernelSU sepolicy patches) injects permissive rules or relaxes legacy dex2oat access, checkSELinuxAccess may evaluate to true, hiding the bug. However, on pure AOSP or strict OEM policies (Android 14–16), it consistently breaks. Solution in this PR: Check the current AOSP-defined domain transition for Android 14+ (u:r:artd:s0 -> u:object_r:dex2oat_exec:s0 with execute), ensuring the wrapper is always labeled with dex2oat_exec without relying on legacy fallback rules. |
Summary
artdtodex2oat_exectransition when selecting the wrapper file contextdex2oatexecute_no_transcheck for Android versions before 14Root cause
Android 14 introduced the
artdservice path for dex2oat. The previous check querieddex2oatwithexecute_no_trans; on Android 16 this check fails because the supported path is theartd->dex2oat_exec->dex2oatdomain transition. Vector therefore selected thexposed_filefallback for its bind-mounted wrapper.artdthen failed to execute the wrapper because the module policy only grantsxposed_fileaccess to the older domains.The fix uses the platform transition already defined by AOSP, so it does not broaden the module policy with an
artdaccess rule forxposed_file.Validation
dex2oat64withxposed_file, andartdloggedPermission denied.domain_auto_trans(artd, dex2oat_exec, dex2oat).git diff --checkpasses.