summaryrefslogtreecommitdiff
path: root/lib/sanitizer_common/sanitizer_symbolizer_libcdep.cc
AgeCommit message (Collapse)Author
2017-10-02Add support for custom loaders to the sanitizer symbolizerFrancis Ricci
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
2017-10-02Revert "Add support for custom loaders to the sanitizer symbolizer"Francis Ricci
This reverts commit r314671, which hangs on the gcc sanitizer buildbot. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@314684 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-02Add support for custom loaders to the sanitizer symbolizerFrancis Ricci
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@314671 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-29Remove recursion from FindModuleForAddress. NFC.Francis Ricci
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@314520 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-28Revert "Add support for custom loaders to the sanitizer symbolizer"Francis Ricci
This causes the gcc sanitizer buildbot to timeout. This reverts commit 81f388fe570e5b6460dd5bc9b9a36b72714eeb68. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@314453 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-28Add support for custom loaders to the sanitizer symbolizerFrancis Ricci
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@314431 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-27Revert "Add support for custom loaders to symbolizer"Francis Ricci
This broke the windows buildbots, revert for now. This reverts commit 24050b5ddef42f6f3306aa94d4a1f42a7893a9a7. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@314347 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-27Add support for custom loaders to symbolizerFrancis Ricci
Change-Id: I5594bd6b216deca2c73cf0a7001f9aec1e803c60 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@314342 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-26Invalidate symbolizer module list from dlopen/dlclose interceptorsFrancis Ricci
Summary: The module list should only be invalidated by dlopen and dlclose, so the symbolizer should only re-generate it when we've hit one of those functions. Reviewers: kubamracek, rnk, vitalybuka Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D37268 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@314219 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-04[compiler-rt] Check for empty buffer in Addr2LineProcess::ReadFromSymbolizerAlex Shlyapnikov
This fixes a bug in the ReadFromSymbolizer method of the Addr2LineProcess class; if the input is too large, the returned buffer will be null and will consequently fail the CHECK. The proposed fix is to simply check if the buffer consists of only a null-terminator and return if so (in effect skipping that frame). I tested by running one of the unit tests both before and after my change. Submitted on behalf of david-y-lam. Reviewers: eugenis, alekseyshl, kcc Reviewed By: alekseyshl Differential Revision: https://reviews.llvm.org/D36207 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@310089 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-01[sanitizer_common] Fuchsia-specific symbolizerVitaly Buka
Summary: Fuchsia doesn't support built-in symbolization per se at all. Instead, it always emits a Fuchsia-standard "symbolizer markup" format that makes it possible for a post-processing filter to massage the logs into symbolized format. Hence, it does not support user-specified formatting options for backtraces or other symbolization. Reviewers: vitalybuka, alekseyshl, kcc Subscribers: kubamracek, mgorny, phosek, filcab, llvm-commits Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D36032 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@309760 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-21[compiler-rt] Prevent symbolizer from starting itself.Vitaly Buka
Summary: If symbolizer was instrumented with sanitizer and crash, it may try to call itself again causing infinite recursion of crashing processes. Reviewers: eugenis Subscribers: kubamracek, llvm-commits, dberris Differential Revision: https://reviews.llvm.org/D30222 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@295771 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-02[compiler-rt] Fix incorrect use of snprintfVitaly Buka
Summary: snprintf returns buffer size needed for printing. If buffer was small, calling code receives incorrectly symbolized buffer and fail. Reviewers: eugenis Subscribers: kubamracek, dberris, kcc Differential Revision: https://reviews.llvm.org/D29440 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@293930 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-06[sanitizer] Use architecture/slice information when symbolizing fat Mach-O ↵Kuba Mracek
files on Darwin This patch starts passing architecture information about a module to llvm-symbolizer and into text reports. This fixes the longstanding x86_64/x86_64h mismatch issue on Darwin. Differential Revision: https://reviews.llvm.org/D27390 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@291287 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-08[sanitizer] Add workaround for empty stringsVitaly Buka
Summary: I see crashes on this check when some reports are being generated. Reviewers: eugenis Subscribers: kubabrecka, llvm-commits Differential Revision: https://reviews.llvm.org/D27574 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@289145 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26[sanitizer] [SystemZ] Add ptrace support bits.Marcin Koscielnicki
Differential Revision: http://reviews.llvm.org/D19134 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@267548 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-09sanitizer: Fix endianness checks for gccAlexey Samsonov
Summary: __BIG_ENDIAN__ and __LITTLE_ENDIAN__ are not supported by gcc, which eg. for ubsan Value::getFloatValue will silently fall through to the little endian branch, breaking display of float values by ubsan. Use __BYTE_ORDER__ == __ORDER_BIG/LITTLE_ENDIAN__ as the condition instead, which is supported by both clang and gcc. Noticed while porting ubsan to s390x. Patch by Marcin Kościelnicki! Differential Revision: http://reviews.llvm.org/D17660 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@263077 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-22[Sanitizer] Introduce ListOfModules object and use it to replace ↵Alexey Samsonov
GetListOfModules(). Summary: This removes the hard limit on the number of loaded modules (used to be 16K), and makes it easier to use LoadedModules w/o causing a memory leak: ListOfModules owns the modules, and makes sure to properly clean them in destructor. Remove filtering functionality that is only needed in one place (LSan). Reviewers: aizatsky Subscribers: llvm-commits, kcc Differential Revision: http://reviews.llvm.org/D17470 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@261554 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-02[asan] Add iOS support.Anna Zaks
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@259451 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-15sanitizer_common: C++ify the IntrusiveList iterator interface.Peter Collingbourne
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@257858 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-11[Windows] Use llvm-symbolizer before using dbghelpReid Kleckner
Summary: llvm-symbolizer understands both PDBs and DWARF, so it's a better bet if it's available. It prints out the function parameter types and column numbers, so I needed to churn the expected test output a bit. This makes most of the llvm-symbolizer subprocessing code target-independent. Pipes on all platforms use fd_t, and we can use the portable ReadFromFile / WriteToFile wrappers in symbolizer_sanitizer.cc. Only the pipe creation and process spawning is Windows-specific. Please check that the libcdep layering is still correct. I don't know how to reproduce the build configuration that relies on that. Reviewers: samsonov Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D11791 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@244616 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-09[Sanitizer] Get rid of PlatformGetListOfModulesKuba Brecka
Moving the implementation of several functions from sanitizer_symbolizer.cc into sanitizer_symbolizer_libcdep.cc. Reviewed at http://reviews.llvm.org/D8858 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@234472 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-12Adding the implementation of atos and dladdr symbolizers for OS X.Kuba Brecka
They are currently still *not* used, "llvm-symbolizer" is still the default symbolizer on OS X. Reviewed at http://reviews.llvm.org/D6588 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@232026 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-09Symbolizer refactoring: Merge common parts of POSIXSymbolizer and WinSymbolizerKuba Brecka
Reviewed at http://reviews.llvm.org/D8105 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@231680 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-02Symbolizer refactoring: ExtractToken and friendsKuba Brecka
Reviewed at http://reviews.llvm.org/D7867 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@231027 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-02Symbolizer refactoring: Move internals to separate filesKuba Brecka
Reviewed at http://reviews.llvm.org/D7972 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@231014 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-26Satisfy -Wparentheses.Nick Lewycky
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@214017 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-26[Sanitizer] Simplify Symbolizer creation interface.Alexey Samsonov
Get rid of Symbolizer::Init(path_to_external) in favor of thread-safe Symbolizer::GetOrInit(), and use the latter version everywhere. Implicitly depend on the value of external_symbolizer_path runtime flag instead of passing it around manually. No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@214005 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-30[Sanitizer] Use SpinMutex for Symbolizer initialization (per dvyukov's ↵Alexey Samsonov
suggestion) git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@193697 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-28[Sanitizer] Revert r193501 and properly fix r193448Alexey Samsonov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@193522 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-25Overhaul the symbolizer interface.Peter Collingbourne
This moves away from creating the symbolizer object and initializing the external symbolizer as separate steps. Those steps now always take place together. Sanitizers with a legacy requirement to specify their own symbolizer path should use InitSymbolizer to initialize the symbolizer with the desired path, and GetSymbolizer to access the symbolizer. Sanitizers with no such requirement (e.g. UBSan) can use GetOrInitSymbolizer with no need for initialization. The symbolizer interface has been made thread-safe (as far as I can tell) by protecting its member functions with mutexes. Finally, the symbolizer interface no longer relies on weak externals, the introduction of which was probably a mistake on my part. Differential Revision: http://llvm-reviews.chandlerc.com/D1985 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@193448 91177308-0d34-0410-b5e6-96231b3b80d8
2013-09-10[Sanitizer] Refactor symbolization interface: use class instead of several ↵Alexey Samsonov
functions. Move some code around to get rid of extra source files git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@190410 91177308-0d34-0410-b5e6-96231b3b80d8
2013-09-03ASan, LSan, MSan: try to find llvm-symbolizer binary in PATH if it is not ↵Alexey Samsonov
provided. Now we don't need to explicitly set the location of llvm-symbolizer in lit test configs. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@189801 91177308-0d34-0410-b5e6-96231b3b80d8
2013-08-13Define SANITIZER_INTERFACE_ATTRIBUTE on Windows and fix all the places where ↵Timur Iskhodzhanov
SANITIZER_INTERFACE_ATTRIBUTE or SANITIZER_ATTRIBUTE_WEAK are used git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@188261 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-01Change __sanitizer_symbolize_demangle hook return type to 'int'Alexey Samsonov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@185326 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-28Demangle names using pluggable internal symbolizer if possibleAlexey Samsonov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@185146 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-29Make InternalAlloc/InternalFree in sanitizer runtimes libc-free by switching ↵Alexey Samsonov
to a custom allocator. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@182836 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-21[nolibc] Move symbolizer to RTSanitizerCommonLibc, and make it optional ↵Peter Collingbourne
using a weak symbol. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@182372 91177308-0d34-0410-b5e6-96231b3b80d8