diff options
author | 2023-07-20 13:21:46 +0000 | |
---|---|---|
committer | 2023-07-27 00:14:10 +0000 | |
commit | 5945a7f87d9fc36b3f8cede0b857f7967d56f702 (patch) | |
tree | 3e601e038e18d849959151d9212475c85573cba0 /runtime/class_linker.cc | |
parent | 9805a6802c5a0376edf140b0a638fe4d770e1879 (diff) |
Revert^2 "Add DEX SHA1 to oat files."
This reverts commit 0d59061cfaf5e60a4fe21f9031492b2a808bb37d.
Add SHA1 since it is much more reliable then CRC32/Adler.
CHECK that it matches with location checksum comparison.
We sill rely on the location checksum, this just ensures
that in the very unlikely case of CRC collision we crash,
rather than accept the DEX and later mysteriously fail.
Test: ./art/test.py -b --host --64
Test: UNSAFE_DISABLE_HIDDENAPI_FLAGS=true m
Change-Id: Idf2d9368205771169d577b1ba7ea1bce28b6b22e
Diffstat (limited to 'runtime/class_linker.cc')
-rw-r--r-- | runtime/class_linker.cc | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc index 0ba63ad0c4..a476ed67cc 100644 --- a/runtime/class_linker.cc +++ b/runtime/class_linker.cc @@ -1824,7 +1824,7 @@ static std::unique_ptr<const DexFile> OpenOatDexFile(const OatFile* oat_file, REQUIRES_SHARED(Locks::mutator_lock_) { DCHECK(error_msg != nullptr); std::unique_ptr<const DexFile> dex_file; - const OatDexFile* oat_dex_file = oat_file->GetOatDexFile(location, nullptr, error_msg); + const OatDexFile* oat_dex_file = oat_file->GetOatDexFile(location, error_msg); if (oat_dex_file == nullptr) { return std::unique_ptr<const DexFile>(); } @@ -1839,12 +1839,14 @@ static std::unique_ptr<const DexFile> OpenOatDexFile(const OatFile* oat_file, } if (dex_file->GetLocationChecksum() != oat_dex_file->GetDexFileLocationChecksum()) { + CHECK(dex_file->GetSha1() != oat_dex_file->GetSha1()); *error_msg = StringPrintf("Checksums do not match for %s: %x vs %x", location, dex_file->GetLocationChecksum(), oat_dex_file->GetDexFileLocationChecksum()); return std::unique_ptr<const DexFile>(); } + CHECK(dex_file->GetSha1() == oat_dex_file->GetSha1()); return dex_file; } |