diff options
author | Christopher Ferris <cferris@google.com> | 2017-03-22 13:18:31 -0700 |
---|---|---|
committer | Christopher Ferris <cferris@google.com> | 2017-03-22 14:55:05 -0700 |
commit | f5e568e653d0dd6bccc86d1a60db5a2573f75f0e (patch) | |
tree | 15b6eb5ebf107abc74ee75703867b38a36daaf17 /libbacktrace/Backtrace.cpp | |
parent | 435fc451031a6a186284d43a340f6e35be4aa170 (diff) | |
download | system_core-f5e568e653d0dd6bccc86d1a60db5a2573f75f0e.tar.gz system_core-f5e568e653d0dd6bccc86d1a60db5a2573f75f0e.tar.bz2 system_core-f5e568e653d0dd6bccc86d1a60db5a2573f75f0e.zip |
Do not access device maps.
It's possible that a device map has memory controlled by a single entry
device driver. Thus, you can deadlock if a process is touching that
device memory and we try to unwind it and also touch that device memory.
Simply skip any attempts to step through, or get function names from
device memory maps.
Bug: 36130325
Test: Ran new unit tests, ran bionic unit tests, ran art ThreadStress.
Change-Id: Ibc62d7ec8106c619ee08968f05e04aea55d7cbfa
Diffstat (limited to 'libbacktrace/Backtrace.cpp')
-rw-r--r-- | libbacktrace/Backtrace.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/libbacktrace/Backtrace.cpp b/libbacktrace/Backtrace.cpp index 0d2e11bdf..4354f0b5a 100644 --- a/libbacktrace/Backtrace.cpp +++ b/libbacktrace/Backtrace.cpp @@ -52,7 +52,16 @@ Backtrace::~Backtrace() { } } -std::string Backtrace::GetFunctionName(uintptr_t pc, uintptr_t* offset) { +std::string Backtrace::GetFunctionName(uintptr_t pc, uintptr_t* offset, const backtrace_map_t* map) { + backtrace_map_t map_value; + if (map == nullptr) { + FillInMap(pc, &map_value); + map = &map_value; + } + // If no map is found, or this map is backed by a device, then return nothing. + if (map->start == 0 || (map->flags & PROT_DEVICE_MAP)) { + return ""; + } std::string func_name = GetFunctionNameRaw(pc, offset); return func_name; } |