Fix dex2oat crash on Android 10 due to architecture mismatch#521
Merged
JingMatrix merged 1 commit intomasterfrom Jan 28, 2026
Merged
Fix dex2oat crash on Android 10 due to architecture mismatch#521JingMatrix merged 1 commit intomasterfrom
JingMatrix merged 1 commit intomasterfrom
Conversation
Previously, the daemon determined the architecture of the target `dex2oat` binary based on its own process architecture (`Process.is64Bit()`). On Android 10, `/apex/com.android.runtime/bin/dex2oat` is frequently a 32-bit binary, even on 64-bit devices. This caused the daemon to incorrectly treat the target as 64-bit and mount the 64-bit wrapper (`bin/dex2oat64`). Consequently, the wrapper attempted to execute the 32-bit binary using `linker64`, resulting in a crash: `error: "/apex/.../dex2oat" is 32-bit instead of 64-bit` This commit changes the logic to inspect the ELF header of the target binary. We now explicitly check `e_ident[EI_CLASS]` to determine if the file is 32-bit or 64-bit and assign it to the correct mounting slot. This ensures the 32-bit wrapper is mounted over 32-bit targets, preventing the linker mismatch.
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.
Previously, the daemon determined the architecture of the target
dex2oatbinary based on its own process architecture (Process.is64Bit()). On Android 10,/apex/com.android.runtime/bin/dex2oatis frequently a 32-bit binary, even on 64-bit devices.This caused the daemon to incorrectly treat the target as 64-bit and mount the 64-bit wrapper (
bin/dex2oat64). Consequently, the wrapper attempted to execute the 32-bit binary usinglinker64, resulting in a crash:error: "/apex/.../dex2oat" is 32-bit instead of 64-bitThis commit changes the logic to inspect the ELF header of the target binary. We now explicitly check
e_ident[EI_CLASS]to determine if the file is 32-bit or 64-bit and assign it to the correct mounting slot. This ensures the 32-bit wrapper is mounted over 32-bit targets, preventing the linker mismatch.