diff options
author | 2023-10-11 12:56:19 +0100 | |
---|---|---|
committer | 2023-10-25 14:17:55 +0000 | |
commit | 876085b17f2bc5efe6b64eee4ddc1be4e967a4f1 (patch) | |
tree | 68c201c1990d300cba2324988c43ce7cfa80f4d4 /libartbase/base/mem_map.cc | |
parent | c13ae9cfc8883372637fb43d2c16b527cd2a5d2a (diff) |
Extend memory range of DexFileContainer passed to Dex loader.
Pass the whole relevant memory range (possibly including some
surrounding non-dex data).
If dex file shares data with other dex files, this will make
it possible to verify that all referred data is within bounds
of valid memory.
Test: ./art/test.py -b --host 001
Change-Id: I5e0058411db4baa3dbe74bfbd7c99d75c9afd694
Diffstat (limited to 'libartbase/base/mem_map.cc')
-rw-r--r-- | libartbase/base/mem_map.cc | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/libartbase/base/mem_map.cc b/libartbase/base/mem_map.cc index 4c14af132c..5c88b7ee14 100644 --- a/libartbase/base/mem_map.cc +++ b/libartbase/base/mem_map.cc @@ -655,9 +655,12 @@ void MemMap::Invalidate() { DCHECK(IsValid()); // Remove it from gMaps. - std::lock_guard<std::mutex> mu(*mem_maps_lock_); - auto it = GetGMapsEntry(*this); - gMaps->erase(it); + // TODO(b/307704260) Move MemMap::Init MemMap::Shutdown out of Runtime init/shutdown. + if (mem_maps_lock_ != nullptr) { // Runtime was shutdown. + std::lock_guard<std::mutex> mu(*mem_maps_lock_); + auto it = GetGMapsEntry(*this); + gMaps->erase(it); + } // Mark it as invalid. base_size_ = 0u; |