From 718b0d3abfd16d2932129dfff4ed1bcde5bfe521 Mon Sep 17 00:00:00 2001 From: Christopher Ferris Date: Wed, 17 Oct 2018 10:57:53 -0700 Subject: Fix which maps to search for globals. If multiple threads are unwinding at the same time, new maps that contain the global variables for dex files and jit information are created. This leads to threads creating more new maps that then get searched, then more maps, then more searching until virtual address space exhaustion. Fix this so that we only search maps that have a corresponding rw map that could contain the global memory. Small refactor to combine the code to search for global variables into one class that both classes inherit from. Modify unit tests for the new pattern checking. Bug: 117761427 Test: Ran unit tests for libunwindstack/libbacktrace/simpleperf. Test: Ran art 004-ThreadStress that used to fail. Change-Id: I837ca6b9d0383100079de090bc7d019598e0cdfe --- libunwindstack/include/unwindstack/JitDebug.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'libunwindstack/include/unwindstack/JitDebug.h') diff --git a/libunwindstack/include/unwindstack/JitDebug.h b/libunwindstack/include/unwindstack/JitDebug.h index 0bcd0b0..ccb473f 100644 --- a/libunwindstack/include/unwindstack/JitDebug.h +++ b/libunwindstack/include/unwindstack/JitDebug.h @@ -24,15 +24,17 @@ #include #include +#include +#include + namespace unwindstack { // Forward declarations. class Elf; class Maps; -class Memory; enum ArchEnum : uint8_t; -class JitDebug { +class JitDebug : public Global { public: explicit JitDebug(std::shared_ptr& memory); JitDebug(std::shared_ptr& memory, std::vector& search_libs); @@ -45,11 +47,9 @@ class JitDebug { private: void Init(Maps* maps); - std::shared_ptr memory_; uint64_t entry_addr_ = 0; bool initialized_ = false; std::vector elf_list_; - std::vector search_libs_; std::mutex lock_; @@ -62,6 +62,8 @@ class JitDebug { uint64_t ReadEntry32Pack(uint64_t* start, uint64_t* size); uint64_t ReadEntry32Pad(uint64_t* start, uint64_t* size); uint64_t ReadEntry64(uint64_t* start, uint64_t* size); + + bool ReadVariableData(uint64_t ptr_offset) override; }; } // namespace unwindstack -- cgit v1.2.3