summaryrefslogtreecommitdiff
path: root/lib/sanitizer_common/sanitizer_symbolizer.cc
AgeCommit message (Collapse)Author
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-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-03-01tsan: describe heap/data locations in GoDmitry Vyukov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@262343 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
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-04-06[ASan] Unify handling of loaded modules between POSIX and WindowsTimur Iskhodzhanov
Reviewed at http://reviews.llvm.org/D8805 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@234150 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-31[Sanitizer RT] Put the Symbolizer module name string ownership in orderTimur Iskhodzhanov
Reviewed at http://reviews.llvm.org/D8666 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@233687 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-03Symbolizer refactoring: Turn FillAddressAndModuleInfo into FillModuleInfoKuba Brecka
Reviewed at http://reviews.llvm.org/D8020 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@231061 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-02Simplify Symbolizer::SymbolizePC() interface.Alexey Samsonov
Return a linked list of AddressInfo objects, instead of using an array of these objects as an output parameter. This simplifies the code in callers of this function (especially TSan). Fix a few memory leaks from internal allocator, when the returned AddressInfo objects were not properly cleared. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@223145 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-10[Sanitizer] Get rid of Symbolizer::Get() and Symbolizer::GetOrNull().Alexey Samsonov
We may as well just use Symbolizer::GetOrInit() in all the cases. Don't call Symbolizer::Get() early in tools initialization: these days it doesn't do any important setup work, and we may as well create the symbolizer the first time it's actually needed. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@217558 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-31[Sanitizer] Add Symbolizer::AddHooks() and use it in TSan and MSan.Alexey Samsonov
Summary: TSan and MSan need to know if interceptor was called by the user code or by the symbolizer and use pre- and post-symbolization hooks for that. Make Symbolizer class responsible for calling these hooks instead. This would ensure the hooks are only called when necessary (during in-process symbolization, they are not needed for out-of-process) and save specific sanitizers from tracing all places in the code where symbolization will be performed. Reviewers: eugenis, dvyukov Reviewed By: eugenis CC: llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D2067 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@193807 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-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
2013-05-14[sanitizer] Filtering in GetListOfModules.Sergey Matveev
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@181791 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-09[Sanitizer] fix TSan tests: remove global ctor from sanitizer_common, run ↵Alexey Samsonov
load_shared_lib test only in lit git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@179090 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-09[asan] relax Linux/zero-base-shadow.cc to make it pass on newer Ubuntu; fix lintKostya Serebryany
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@179088 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-08[libsymbolized] If we can't find an address in the list of shared libraries, ↵Alexander Potapenko
try to reload it. Add a regression test for the case where such behavior helps TSan: 1. race is reported in the main module 2. new shared library is loaded 3. race is reported in the shared library git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@179032 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-05[Sanitizer] enquote the module name when passing it to external symbolizerAlexey Samsonov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@178864 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-19tsan: fix buildDmitry Vyukov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@177395 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-19tsan: symbolizer "flush caches" functinalityDmitry Vyukov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@177388 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-26[Sanitizer] Don't die if external symbolizer is used on Mac, where it's not ↵Alexey Samsonov
implemented yet git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@176091 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-29tsan: add IsSymbolizerAvailable() function for querying for presence of ↵Dmitry Vyukov
internal/external symbolizer git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@173783 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-24[Sanitizer] use stub InternalSymbolizer on platforms where we don't have ↵Alexey Samsonov
weak hooks git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@173347 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-24[Sanitizer] Add skeleton for InternalSymbolizer that can be used by ↵Alexey Samsonov
providing callbacks __sanitizer_symbolize_{code,data} git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@173344 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-11tsan: symbolize global variablesDmitry Vyukov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@172181 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-03tsan: describe global vars (module+offset for now)Dmitry Vyukov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@169122 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-17[Sanitizer] symbolizer: increase the maximal number of shared libraries to 16KAlexey Samsonov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@166098 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-06[Sanitizer] remove unused fieldAlexey Samsonov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@163296 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-05[Sanitizer] Remove implicit conversion of InternalScopedBuffer<T> to T*Alexey Samsonov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@163197 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-04[Sanitizer] Support for reading inlined frames from llvm-symbolizerAlexey Samsonov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@163140 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-31[Sanitizer] fix overloaded operator errorAlexey Samsonov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@162990 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-31[Sanitizer] Remove some calls to libc malloc from symbolizerAlexey Samsonov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@162987 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-23[Sanitizer] Switch the symbolization strategy that would be used by ↵Alexey Samsonov
sanitizer tools family: as compiling in-process symbolizer into runtime involves certain difficulties, we may instead launch an external symbolizer program (fork + execl) in a subprocess and communicate with it via pipe. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@162437 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-31[Sanitizer] Wrapper around llvm::DIContext from LLVM DebugInfo library. If a ↵Alexey Samsonov
macro SANITIZER_USES_LLVM_LIBS is defined (by default it is not), then sanitizer runtime includes llvm headers and tries to use LLVM libs for in-process symbolization. To make it functional, we have to link with these LLVM libs - either pass them to linker from Clang driver, or link them into static ASan runtime when we build it. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@161045 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-19[Sanitizer] When obtaining the data for loaded modules, add address ranges ↵Alexey Samsonov
of loadable segments only. Looks like address range of PT_TLS segment may intersect with loadable segments of other modules. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@160498 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-03[Sanitizer] Extend a symbolizer code. Implemented for Linux only. Use ↵Alexey Samsonov
dl_iterate_phdr to get virtual addresses of mapped module sections. To symbolize an address from a module, map this module to memory and obtain pointers to debug info sections. Later these pointers can be passed to constructor of DWARF context-in-memory from LLVM DebugInfo lib. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@159652 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-15[Sanitizer] Use ProcessMaps in symbolizer to get module name and offset for ↵Alexey Samsonov
instruction address git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@158522 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-07[Sanitizer] Allocator for internal runtime purposes. Currently it calls ↵Alexey Samsonov
libcmalloc, but we might have to make it more low-level in future git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@158142 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-04Remove file-type tags in .cc files in tsan/ and sanitizer_common/Alexey Samsonov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@157928 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-04[Sanitizer_common] fix filenames in commentsAlexey Samsonov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@157919 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-01temporary include stdlib.h in symbolizer to fix Mac/Win buildAlexey Samsonov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@157808 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-01Stub files for common symbolizer for AddressSanitizer and ThreadSanitizer tools.Alexey Samsonov
It is an analogue of addr2line utility and should allow to map instruction address to a location in source code at run-time. It should use debug information (in DWARF) in a binary, and hopefully it would be possible to re-use code from llvm/DebugInfo/DIContext.h git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@157806 91177308-0d34-0410-b5e6-96231b3b80d8