diff options
author | Francis Ricci <francisjricci@gmail.com> | 2017-10-02 20:22:16 +0000 |
---|---|---|
committer | Francis Ricci <francisjricci@gmail.com> | 2017-10-02 20:22:16 +0000 |
commit | 3ce56013ccfd444b11b2d5b4769c006fc9517682 (patch) | |
tree | 4eca0369d283370908be12b6c92a01b955ee7919 /lib/sanitizer_common/sanitizer_linux_libcdep.cc | |
parent | 6b550d45f492bb21069c2ccdc8561379176def56 (diff) |
Add support for custom loaders to the sanitizer symbolizer
Summary:
Adds a fallback mode to procmaps when the symbolizer
fails to locate a module for a given address by using
dl_iterate_phdr.
Reviewers: kubamracek, rnk, vitalybuka, eugenis
Reviewed By: eugenis
Subscribers: srhines, llvm-commits
Differential Revision: https://reviews.llvm.org/D37269
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@314713 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/sanitizer_common/sanitizer_linux_libcdep.cc')
-rw-r--r-- | lib/sanitizer_common/sanitizer_linux_libcdep.cc | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/sanitizer_common/sanitizer_linux_libcdep.cc b/lib/sanitizer_common/sanitizer_linux_libcdep.cc index 0f420875d..0dc437585 100644 --- a/lib/sanitizer_common/sanitizer_linux_libcdep.cc +++ b/lib/sanitizer_common/sanitizer_linux_libcdep.cc @@ -474,7 +474,7 @@ static bool requiresProcmaps() { } static void procmapsInit(InternalMmapVectorNoCtor<LoadedModule> *modules) { - MemoryMappingLayout memory_mapping(false); + MemoryMappingLayout memory_mapping(/*cache_enabled*/true); memory_mapping.DumpListOfModules(modules); } @@ -488,6 +488,17 @@ void ListOfModules::init() { } } +// When a custom loader is used, dl_iterate_phdr may not contain the full +// list of modules. Allow callers to fall back to using procmaps. +void ListOfModules::fallbackInit() { + if (!requiresProcmaps()) { + clearOrInit(); + procmapsInit(&modules_); + } else { + clear(); + } +} + // getrusage does not give us the current RSS, only the max RSS. // Still, this is better than nothing if /proc/self/statm is not available // for some reason, e.g. due to a sandbox. |