summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Ferris2017-03-22 15:18:31 -0500
committerChristopher Ferris2017-03-22 16:55:05 -0500
commitf5e568e653d0dd6bccc86d1a60db5a2573f75f0e (patch)
tree15b6eb5ebf107abc74ee75703867b38a36daaf17 /include
parent435fc451031a6a186284d43a340f6e35be4aa170 (diff)
downloadplatform-system-core-f5e568e653d0dd6bccc86d1a60db5a2573f75f0e.tar.gz
platform-system-core-f5e568e653d0dd6bccc86d1a60db5a2573f75f0e.tar.xz
platform-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 'include')
-rw-r--r--include/backtrace/Backtrace.h6
-rw-r--r--include/backtrace/BacktraceMap.h4
2 files changed, 8 insertions, 2 deletions
diff --git a/include/backtrace/Backtrace.h b/include/backtrace/Backtrace.h
index c896ab806..4f73a658c 100644
--- a/include/backtrace/Backtrace.h
+++ b/include/backtrace/Backtrace.h
@@ -104,8 +104,10 @@ public:
104 virtual bool Unwind(size_t num_ignore_frames, ucontext_t* context = NULL) = 0; 104 virtual bool Unwind(size_t num_ignore_frames, ucontext_t* context = NULL) = 0;
105 105
106 // Get the function name and offset into the function given the pc. 106 // Get the function name and offset into the function given the pc.
107 // If the string is empty, then no valid function name was found. 107 // If the string is empty, then no valid function name was found,
108 virtual std::string GetFunctionName(uintptr_t pc, uintptr_t* offset); 108 // or the pc is not in any valid map.
109 virtual std::string GetFunctionName(uintptr_t pc, uintptr_t* offset,
110 const backtrace_map_t* map = NULL);
109 111
110 // Fill in the map data associated with the given pc. 112 // Fill in the map data associated with the given pc.
111 virtual void FillInMap(uintptr_t pc, backtrace_map_t* map); 113 virtual void FillInMap(uintptr_t pc, backtrace_map_t* map);
diff --git a/include/backtrace/BacktraceMap.h b/include/backtrace/BacktraceMap.h
index df48dfe2b..8ab0dfabb 100644
--- a/include/backtrace/BacktraceMap.h
+++ b/include/backtrace/BacktraceMap.h
@@ -33,6 +33,10 @@
33#include <string> 33#include <string>
34#include <vector> 34#include <vector>
35 35
36// Special flag to indicate a map is in /dev/. However, a map in
37// /dev/ashmem/... does not set this flag.
38static constexpr int PROT_DEVICE_MAP = 0x8000;
39
36struct backtrace_map_t { 40struct backtrace_map_t {
37 uintptr_t start = 0; 41 uintptr_t start = 0;
38 uintptr_t end = 0; 42 uintptr_t end = 0;