summaryrefslogtreecommitdiff
path: root/lib/sanitizer_common/sanitizer_procmaps.h
diff options
context:
space:
mode:
authorKuba Mracek <mracek@apple.com>2016-12-02 21:27:14 +0000
committerKuba Mracek <mracek@apple.com>2016-12-02 21:27:14 +0000
commit74c8f498fa128f0cd4eb97d603c017f250dd3694 (patch)
treea568579c59198d668eb06237a8483c0cf9cbd2d0 /lib/sanitizer_common/sanitizer_procmaps.h
parent4ca6e75ef3a392468b39bd7d99238580859228ce (diff)
downloadcompiler-rt-74c8f498fa128f0cd4eb97d603c017f250dd3694.tar.gz
[sanitizer] Track architecture and UUID of modules in LoadedModule
When we enumerate loaded modules, we only track the module name and base address, which then has several problems on macOS. Dylibs and executables often have several architecture slices and not storing which architecture/UUID is actually loaded creates problems with symbolication: A file path + offset isn't enough to correctly symbolicate, since the offset can be valid in multiple slices. This is especially common for Haswell+ X86_64 machines, where x86_64h slices are preferred, but if one is not available, a regular x86_64 is loaded instead. But the same issue exists for i386 vs. x86_64 as well. This patch adds tracking of arch and UUID for each LoadedModule. At this point, this information isn't used in reports, but this is the first step. The goal is to correctly identify which slice is loaded in symbolication, and also to output this information in reports so that we can tell which exact slices were loaded in post-mortem analysis. Differential Revision: https://reviews.llvm.org/D26632 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@288537 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/sanitizer_common/sanitizer_procmaps.h')
-rw-r--r--lib/sanitizer_common/sanitizer_procmaps.h13
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/sanitizer_common/sanitizer_procmaps.h b/lib/sanitizer_common/sanitizer_procmaps.h
index 1fe59ab89..5c26fb77e 100644
--- a/lib/sanitizer_common/sanitizer_procmaps.h
+++ b/lib/sanitizer_common/sanitizer_procmaps.h
@@ -35,8 +35,9 @@ class MemoryMappingLayout {
public:
explicit MemoryMappingLayout(bool cache_enabled);
~MemoryMappingLayout();
- bool Next(uptr *start, uptr *end, uptr *offset,
- char filename[], uptr filename_size, uptr *protection);
+ bool Next(uptr *start, uptr *end, uptr *offset, char filename[],
+ uptr filename_size, uptr *protection, ModuleArch *arch = nullptr,
+ u8 *uuid = nullptr);
void Reset();
// In some cases, e.g. when running under a sandbox on Linux, ASan is unable
// to obtain the memory mappings. It should fall back to pre-cached data
@@ -65,13 +66,15 @@ class MemoryMappingLayout {
static ProcSelfMapsBuff cached_proc_self_maps_;
static StaticSpinMutex cache_lock_; // protects cached_proc_self_maps_.
# elif SANITIZER_MAC
- template<u32 kLCSegment, typename SegmentCommand>
- bool NextSegmentLoad(uptr *start, uptr *end, uptr *offset,
- char filename[], uptr filename_size,
+ template <u32 kLCSegment, typename SegmentCommand>
+ bool NextSegmentLoad(uptr *start, uptr *end, uptr *offset, char filename[],
+ uptr filename_size, ModuleArch *arch, u8 *uuid,
uptr *protection);
int current_image_;
u32 current_magic_;
u32 current_filetype_;
+ ModuleArch current_arch_;
+ u8 current_uuid_[kModuleUUIDSize];
int current_load_cmd_count_;
char *current_load_cmd_addr_;
# endif