Fix oat_hook for recent Android versions#387
Merged
JingMatrix merged 2 commits intomasterfrom Aug 9, 2025
Merged
Conversation
We used to hook functions `OatHeader::GetKeyValueStore` and `OatHeader::GetKeyValueStoreSize` to clean the `dex2oat` trace introduced by LSPosed. However, in recent versions of Android, these two functions are no longer exported. Moreover, the `OatHeader` structure has changed, which now sets certain entries to have fixed length by padding zeros. To address these two changes, we hook `OatHeader::ComputeChecksum` as an entrypoint (fallback), and then employ the header file of `OatHeader` copied from AOSP to precisely locate its fields. Using this strategy, we modify `key_value_store` in memory, depending on whether the entry `dex2oat-cmdline` is padded.
1 task
Otherwise, uint32_t is shown as negative numbers in logs.
lshwjgpt25
pushed a commit
to lshwjgpt25/LSPosed
that referenced
this pull request
Sep 3, 2025
This reverts commit 6703b45. r掉
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.
We used to hook functions
OatHeader::GetKeyValueStoreandOatHeader::GetKeyValueStoreSizeto clean thedex2oattrace introduced by LSPosed. However, in recent versions of Android, these two functions are no longer exported. Moreover, theOatHeaderstructure has changed, which now sets certain entries to have fixed length by padding zeros.To address these two changes, we hook
OatHeader::ComputeChecksumas an entrypoint (fallback), and then employ the header file ofOatHeadercopied from AOSP to precisely locate its fields. Using this strategy, we modifykey_value_storein memory, depending on whether the entrydex2oat-cmdlineis padded.