Skip to content

Conversation

vanshsantoshi
Copy link
Contributor

@vanshsantoshi vanshsantoshi commented Jan 19, 2025

Deodex and disassembling of odex/vdex files stopped working since A12 due to offset changes

Explanation to the main offset change are present inside commit description, here: 2100ac3

One can test it on termux for quick check:
java -jar baksmali-farJar.jar deodex base.odex -b $BOOTCLASSPATH
java -jar baksmali-farJar.jar dis base.odex

----------------------------------------------------
dex2oat/linker/oat_writer.cc changes
----------------------------------------------------

2020-09-30
Fields added: public_type_bss_mapping_offset_ and package_type_bss_mapping_offset_

Line 4127-4140 on commit 8f63f10:

https://cs.android.com/android/_/android/platform/art/+/842b5cbd6e02232a3c407a98271a525f5e8aaf84:dex2oat/linker/oat_writer.cc;l=3881;bpv=1;bpt=0;drc=8f63f1084b013a129f66cf8a7ed8ab1cae9f02aa;dlc=e6c0f2a75bd969253279580e2e4772e54787034b

Adds two +4 to offset (Present in line 673-676 on OatFile.java)

-------------------

2023-07-20
Field added: dex_file_sha1_

Line 3848-3852 on commit ba2222f:

https://cs.android.com/android/_/android/platform/art/+/842b5cbd6e02232a3c407a98271a525f5e8aaf84:dex2oat/linker/oat_writer.cc;l=3881;dlc=5b65e02b1cdce48da11a972ab6d75a7fb5c859bd;bpv=1;bpt=0;drc=ba2222f1e114603b42dfdb6dd1d11012d32a2739

Adds +20 to offset (Present in line 644 on OatFile.java)

-------------------

2023-07-31
Field added: dex_file_magic_

Line 3846-3850 on commit 195e269:

https://cs.android.com/android/_/android/platform/art/+/842b5cbd6e02232a3c407a98271a525f5e8aaf84:dex2oat/linker/oat_writer.cc;l=3881;dlc=5945a7f87d9fc36b3f8cede0b857f7967d56f702;bpv=1;bpt=0;drc=195e269dd1cd5128ba9d373a84d342a7b0d88cad

Adds +8 to offset (Present in line 638 on OatFile.java)

-------------------

2024-01-03
Fields added: method_type_bss_mapping_offset

Line 4018-4023 on commit 3f0981b:

https://cs.android.com/android/_/android/platform/art/+/842b5cbd6e02232a3c407a98271a525f5e8aaf84:dex2oat/linker/oat_writer.cc;l=3881;dlc=f45b3e396d1a1b4a19a6253bf6ae9b8a59ebeec5;bpv=1;bpt=0;drc=3f0981b56a1b9a415383c552c063b890c840b13e

Adds +4 to offset (Present in line 678 on OatFile.java)

-----------------------------------------------------------------
runtime/oat.h changes (Moved to: runtime/oat/oat.h on 2024-01-03)
-----------------------------------------------------------------

2020-02-19
Field added: jni_dlsym_lookup_critical_trampoline_offset_

Line 129 on commit fa458ac2:-

https://cs.android.com/android/_/android/platform/art/+/master:runtime/oat/oat.h;drf=runtime%2Foat.h;drc=fa458ac21af98b3bdde2c62ed86b9c192b994372;bpv=1;bpt=0;dlc=2925311f957f50bbec2b034c98877d22f702ee76;dlf=runtime%2Foat.h

Adds +4 to offset (Line 262 on OatFile.java)

--------------------

2021-01-27
Field added: nterp_trampoline_offset_

Line 139 on commit c39af94:-

https://cs.android.com/android/_/android/platform/art/+/master:runtime/oat/oat.h;drf=runtime%2Foat.h;drc=c39af9409ed4c8dd711be606f758a9b378cd0ee3;bpv=1;bpt=0;dlc=86d6cd53385eae365f16f45e1a5947cc6595eb63;dlf=runtime%2Foat.h

Adds +4 to offset (Present in line 260 on OatFile.java)

--------------------

2022-03-09
Field added: bcp_bss_info_offset_

Line 135 on commit 69a87e3:

https://cs.android.com/android/_/android/platform/art/+/master:runtime/oat/oat.h;drf=runtime%2Foat.h;drc=69a87e30730d0c6e6e5974fd2bd001f77fffed5e;bpv=1;bpt=0;dlc=1849c3a875aab44d9bff45623ec076b0331302f8;dlf=runtime%2Foat.h

Adds +4 to offset (Present in line 258 on OatFile.java)
@vanshsantoshi
Copy link
Contributor Author

vanshsantoshi commented Mar 29, 2025

@sgjesse @melcz
I just noticed that I cannot add reviewers so I must tag somebody for visibility. If you have a moment, I’d appreciate it if you could take a look at this PR. Thanks!

@sgjesse sgjesse self-requested a review March 31, 2025 10:18
@sgjesse
Copy link
Collaborator

sgjesse commented Mar 31, 2025

Thank you for the PR. I will check with the ART team before approving.

Copy link
Collaborator

@sgjesse sgjesse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feedback from the ART team:

No objection (I have not verified that the CL is correct).
Best effort sounds good to me.
Overall, I don't understand the feature. I am not quite sure why
smali should be trying to understand oat files. My approach would be
that if file does not have the dex header, then scan the file linearly
for valid dex header.

@sgjesse sgjesse merged commit 8be50d7 into google:main Apr 7, 2025
1 check passed
@vanshsantoshi
Copy link
Contributor Author

Thank you for merging! I appreciate the feedback and the opportunity to contribute.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants