summaryrefslogtreecommitdiff
path: root/lib/sanitizer_common/sanitizer_symbolizer.cc
Commit message (Collapse)AuthorAgeFilesLines
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@351636 91177308-0d34-0410-b5e6-96231b3b80d8
* Invalidate symbolizer module list from dlopen/dlclose interceptorsFrancis Ricci2017-09-261-0/+4
| | | | | | | | | | | | | | 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
* [sanitizer] Use architecture/slice information when symbolizing fat Mach-O ↵Kuba Mracek2017-01-061-1/+3
| | | | | | | | | | | | 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
* tsan: describe heap/data locations in GoDmitry Vyukov2016-03-011-0/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@262343 91177308-0d34-0410-b5e6-96231b3b80d8
* [Sanitizer] Introduce ListOfModules object and use it to replace ↵Alexey Samsonov2016-02-221-1/+1
| | | | | | | | | | | | | | | | | | | | 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
* [Sanitizer] Get rid of PlatformGetListOfModulesKuba Brecka2015-04-091-114/+0
| | | | | | | | | | 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
* [ASan] Unify handling of loaded modules between POSIX and WindowsTimur Iskhodzhanov2015-04-061-7/+44
| | | | | | 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
* [Sanitizer RT] Put the Symbolizer module name string ownership in orderTimur Iskhodzhanov2015-03-311-4/+30
| | | | | | | | 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
* Symbolizer refactoring: Merge common parts of POSIXSymbolizer and WinSymbolizerKuba Brecka2015-03-091-9/+75
| | | | | | | | 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
* Symbolizer refactoring: Turn FillAddressAndModuleInfo into FillModuleInfoKuba Brecka2015-03-031-3/+1
| | | | | | | | 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
* Simplify Symbolizer::SymbolizePC() interface.Alexey Samsonov2014-12-021-0/+48
| | | | | | | | | | | 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
* [Sanitizer] Get rid of Symbolizer::Get() and Symbolizer::GetOrNull().Alexey Samsonov2014-09-101-11/+0
| | | | | | | | | | 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
* [Sanitizer] Add Symbolizer::AddHooks() and use it in TSan and MSan.Alexey Samsonov2013-10-311-0/+20
| | | | | | | | | | | | | | | | | | | | | 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
* [Sanitizer] Use SpinMutex for Symbolizer initialization (per dvyukov's ↵Alexey Samsonov2013-10-301-11/+11
| | | | | | suggestion) git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@193697 91177308-0d34-0410-b5e6-96231b3b80d8
* [Sanitizer] Revert r193501 and properly fix r193448Alexey Samsonov2013-10-281-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@193522 91177308-0d34-0410-b5e6-96231b3b80d8
* Overhaul the symbolizer interface.Peter Collingbourne2013-10-251-0/+43
| | | | | | | | | | | | | | | | | | | | | | 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
* [nolibc] Move symbolizer to RTSanitizerCommonLibc, and make it optional ↵Peter Collingbourne2013-05-211-453/+0
| | | | | | using a weak symbol. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@182372 91177308-0d34-0410-b5e6-96231b3b80d8
* [sanitizer] Filtering in GetListOfModules.Sergey Matveev2013-05-141-1/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@181791 91177308-0d34-0410-b5e6-96231b3b80d8
* [Sanitizer] fix TSan tests: remove global ctor from sanitizer_common, run ↵Alexey Samsonov2013-04-091-1/+2
| | | | | | 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
* [asan] relax Linux/zero-base-shadow.cc to make it pass on newer Ubuntu; fix lintKostya Serebryany2013-04-091-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@179088 91177308-0d34-0410-b5e6-96231b3b80d8
* [libsymbolized] If we can't find an address in the list of shared libraries, ↵Alexander Potapenko2013-04-081-1/+16
| | | | | | | | | | | | | 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
* [Sanitizer] enquote the module name when passing it to external symbolizerAlexey Samsonov2013-04-051-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@178864 91177308-0d34-0410-b5e6-96231b3b80d8
* tsan: fix buildDmitry Vyukov2013-03-191-0/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@177395 91177308-0d34-0410-b5e6-96231b3b80d8
* tsan: symbolizer "flush caches" functinalityDmitry Vyukov2013-03-191-0/+23
| | | | git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@177388 91177308-0d34-0410-b5e6-96231b3b80d8
* [Sanitizer] Don't die if external symbolizer is used on Mac, where it's not ↵Alexey Samsonov2013-02-261-3/+4
| | | | | | implemented yet git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@176091 91177308-0d34-0410-b5e6-96231b3b80d8
* tsan: add IsSymbolizerAvailable() function for querying for presence of ↵Dmitry Vyukov2013-01-291-0/+10
| | | | | | internal/external symbolizer git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@173783 91177308-0d34-0410-b5e6-96231b3b80d8
* [Sanitizer] use stub InternalSymbolizer on platforms where we don't have ↵Alexey Samsonov2013-01-241-5/+11
| | | | | | weak hooks git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@173347 91177308-0d34-0410-b5e6-96231b3b80d8
* [Sanitizer] Add skeleton for InternalSymbolizer that can be used by ↵Alexey Samsonov2013-01-241-0/+51
| | | | | | providing callbacks __sanitizer_symbolize_{code,data} git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@173344 91177308-0d34-0410-b5e6-96231b3b80d8
* tsan: symbolize global variablesDmitry Vyukov2013-01-111-88/+102
| | | | git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@172181 91177308-0d34-0410-b5e6-96231b3b80d8
* tsan: describe global vars (module+offset for now)Dmitry Vyukov2012-12-031-0/+15
| | | | git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@169122 91177308-0d34-0410-b5e6-96231b3b80d8
* [Sanitizer] symbolizer: increase the maximal number of shared libraries to 16KAlexey Samsonov2012-10-171-1/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@166098 91177308-0d34-0410-b5e6-96231b3b80d8
* [Sanitizer] remove unused fieldAlexey Samsonov2012-09-061-6/+0
| | | | git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@163296 91177308-0d34-0410-b5e6-96231b3b80d8
* [Sanitizer] Remove implicit conversion of InternalScopedBuffer<T> to T*Alexey Samsonov2012-09-051-5/+6
| | | | git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@163197 91177308-0d34-0410-b5e6-96231b3b80d8
* [Sanitizer] Support for reading inlined frames from llvm-symbolizerAlexey Samsonov2012-09-041-45/+89
| | | | git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@163140 91177308-0d34-0410-b5e6-96231b3b80d8
* [Sanitizer] fix overloaded operator errorAlexey Samsonov2012-08-311-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@162990 91177308-0d34-0410-b5e6-96231b3b80d8
* [Sanitizer] Remove some calls to libc malloc from symbolizerAlexey Samsonov2012-08-311-7/+7
| | | | git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@162987 91177308-0d34-0410-b5e6-96231b3b80d8
* [Sanitizer] Switch the symbolization strategy that would be used by ↵Alexey Samsonov2012-08-231-46/+181
| | | | | | 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
* [Sanitizer] Wrapper around llvm::DIContext from LLVM DebugInfo library. If a ↵Alexey Samsonov2012-07-311-14/+9
| | | | | | 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
* [Sanitizer] When obtaining the data for loaded modules, add address ranges ↵Alexey Samsonov2012-07-191-4/+3
| | | | | | 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
* [Sanitizer] Extend a symbolizer code. Implemented for Linux only. Use ↵Alexey Samsonov2012-07-031-71/+91
| | | | | | 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
* [Sanitizer] Use ProcessMaps in symbolizer to get module name and offset for ↵Alexey Samsonov2012-06-151-20/+95
| | | | | | instruction address git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@158522 91177308-0d34-0410-b5e6-96231b3b80d8
* [Sanitizer] Allocator for internal runtime purposes. Currently it calls ↵Alexey Samsonov2012-06-071-9/+7
| | | | | | 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
* Remove file-type tags in .cc files in tsan/ and sanitizer_common/Alexey Samsonov2012-06-041-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@157928 91177308-0d34-0410-b5e6-96231b3b80d8
* [Sanitizer_common] fix filenames in commentsAlexey Samsonov2012-06-041-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@157919 91177308-0d34-0410-b5e6-96231b3b80d8
* temporary include stdlib.h in symbolizer to fix Mac/Win buildAlexey Samsonov2012-06-011-5/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@157808 91177308-0d34-0410-b5e6-96231b3b80d8
* Stub files for common symbolizer for AddressSanitizer and ThreadSanitizer tools.Alexey Samsonov2012-06-011-0/+56
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