diff options
author | Christopher Ferris <cferris@google.com> | 2018-10-30 16:16:45 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2018-10-30 16:16:45 +0000 |
commit | b31badf70f7734d1ef6d1a95ee73dc57ebd2b19d (patch) | |
tree | b150ea58a97519c38abf33f0654eb709d0c9846f /libunwindstack/MapInfo.cpp | |
parent | 1d0ee36de7af27ee43e5075b99e9427130a1f0f1 (diff) | |
parent | 4568f4bc0f116f097a13b1d931de93cf525ae204 (diff) |
Merge "Verify that the elf matches the expected arch."
Diffstat (limited to 'libunwindstack/MapInfo.cpp')
-rw-r--r-- | libunwindstack/MapInfo.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/libunwindstack/MapInfo.cpp b/libunwindstack/MapInfo.cpp index 8527797d2..fe32b5e34 100644 --- a/libunwindstack/MapInfo.cpp +++ b/libunwindstack/MapInfo.cpp @@ -146,7 +146,7 @@ Memory* MapInfo::CreateMemory(const std::shared_ptr<Memory>& process_memory) { return nullptr; } -Elf* MapInfo::GetElf(const std::shared_ptr<Memory>& process_memory) { +Elf* MapInfo::GetElf(const std::shared_ptr<Memory>& process_memory, ArchEnum expected_arch) { // Make sure no other thread is trying to add the elf to this map. std::lock_guard<std::mutex> guard(mutex_); @@ -176,6 +176,10 @@ Elf* MapInfo::GetElf(const std::shared_ptr<Memory>& process_memory) { // If the init fails, keep the elf around as an invalid object so we // don't try to reinit the object. elf->Init(); + if (elf->valid() && expected_arch != elf->arch()) { + // Make the elf invalid, mismatch between arch and expected arch. + elf->Invalidate(); + } if (locked) { Elf::CacheAdd(this); |