dex2oat/README.md
VectorDex2Oat is a specialized wrapper and instrumentation suite for the Android dex2oat (Ahead-of-Time compiler) binary. It is designed to intercept the compilation process, force specific compiler behaviors (specifically disabling method inlining), and transparently spoof the resulting OAT metadata to hide the presence of the wrapper.
In the Android Runtime (ART), dex2oat compiles DEX files into OAT files. Modern ART optimizations often inline methods, making it difficult for instrumentation tools to hook specific function calls.
This project consists of two primary components:
dex2oat process via LD_PRELOAD that utilizes PLT hooking to sanitize the OAT header's command-line metadata.--inline-max-code-units=0 to the compiler arguments, ensuring all methods remain discrete and hookable.dex2oat via the system linker using /proc/self/fd/ paths, avoiding direct execution of files on the disk.art::OatHeader::ComputeChecksum or art::OatHeader::GetKeyValueStore to remove traces of the wrapper and its injected flags from the final .oat file.The wrapper acts as a "man-in-the-middle" for the compiler. When called by the system, it
5291374ceda0... will be replaced during installation of Vector);dex2oat binary and the oat_hook library;LD_LIBRARY_PATH and sets LD_PRELOAD to the hooker library's FD;linker64) to execute the compiler.The hooker library is preloaded into the compiler's address space. It uses the LSPlt library to:
dex2oat binary.