summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer.h
Commit message (Collapse)AuthorAgeFilesLines
* hwasan: Teach the runtime to identify the local variable being accessed in ↵Peter Collingbourne2019-06-271-0/+28
| | | | | | | | | | | | | | UAR reports. Each function's PC is recorded in the ring buffer. From there we can access the function's local variables and reconstruct the tag of each one with the help of the information printed by llvm-symbolizer's new FRAME command. We can then find the variable that was likely being accessed by matching the pointer's tag against the reconstructed tag. Differential Revision: https://reviews.llvm.org/D63469 llvm-svn: 364607
* 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. llvm-svn: 351636
* [sanitizer] Remove reserving constructor from InternalMmapVectorVitaly Buka2018-05-071-2/+3
| | | | llvm-svn: 331617
* [sanitizer] Remove empty Symbolizer PrepareForSandboxingKostya Kortchinsky2018-04-031-2/+0
| | | | | | | | | | | | | | | | | | | | | | | Summary: `Symbolizer::PrepareForSandboxing` is empty for all platforms and apparently has been for a while (D10213). Remove it, and shuffle things around so that the platform specific code is now in `PlatformPrepareForSandboxing`. This allows to have one less symbolizer dependency in a common file, which helps for the upcoming split. Also remove `SymbolizerPrepareForSandboxing` in tsan_go which appears to not be used anywhere. Reviewers: alekseyshl, eugenis, dvyukov, mcgrathr Reviewed By: alekseyshl Subscribers: kubamracek, delcypher, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D44953 llvm-svn: 329094
* Add support for custom loaders to the sanitizer symbolizerFrancis Ricci2017-10-021-0/+1
| | | | | | | | | | | | | | | | | 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 llvm-svn: 314713
* Revert "Add support for custom loaders to the sanitizer symbolizer"Francis Ricci2017-10-021-1/+0
| | | | | | This reverts commit r314671, which hangs on the gcc sanitizer buildbot. llvm-svn: 314684
* Add support for custom loaders to the sanitizer symbolizerFrancis Ricci2017-10-021-0/+1
| | | | | | | | | | | | | | | | | 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 llvm-svn: 314671
* Add missing header definitionFrancis Ricci2017-09-291-0/+1
| | | | llvm-svn: 314521
* Revert "Add support for custom loaders to the sanitizer symbolizer"Francis Ricci2017-09-281-2/+0
| | | | | | | | This causes the gcc sanitizer buildbot to timeout. This reverts commit 81f388fe570e5b6460dd5bc9b9a36b72714eeb68. llvm-svn: 314453
* Add support for custom loaders to the sanitizer symbolizerFrancis Ricci2017-09-281-0/+2
| | | | | | | | | | | | | | | | | 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 llvm-svn: 314431
* Revert "Add support for custom loaders to symbolizer"Francis Ricci2017-09-271-2/+0
| | | | | | | | This broke the windows buildbots, revert for now. This reverts commit 24050b5ddef42f6f3306aa94d4a1f42a7893a9a7. llvm-svn: 314347
* Add support for custom loaders to symbolizerFrancis Ricci2017-09-271-0/+2
| | | | | Change-Id: I5594bd6b216deca2c73cf0a7001f9aec1e803c60 llvm-svn: 314342
* Invalidate symbolizer module list from dlopen/dlclose interceptorsFrancis Ricci2017-09-261-0/+2
| | | | | | | | | | | | | | 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 llvm-svn: 314219
* [sanitizer] Use architecture/slice information when symbolizing fat Mach-O ↵Kuba Mracek2017-01-061-2/+6
| | | | | | | | | | 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 llvm-svn: 291287
* TestCase null_deref was failing in Win64:Etienne Bergeron2016-07-151-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | c:\lipo\work\asan\b_llvm>c:\lipo\work\asan\b_llvm\projects\compiler-rt\test\asan\X86_64WindowsConfig\TestCases\Output\null_deref.cc.tmp ================================================================= ==5488==ERROR: AddressSanitizer: access-violation on unknown address 0x000000000028 (pc 0x7ff701f91067 bp 0x000c8cf8fbf0 sp 0x000c8cf8fbb0 T0) ==5488==The signal is caused by a READ memory access. ==5488==Hint: address points to the zero page. #0 0x7ff701f91066 in NullDeref(int *) C:\lipo\work\asan\llvm\projects\compiler-rt\test\asan\TestCases\null_deref.cc:15:10 #1 0x8a0388830a67 (<unknown module>) The reason was symbols was not initilized. In fact, it was first inited with a call to stack.Print(), which calls WinSymbolizerTool::SymbolizePC, then InitializeDbgHelpIfNeeded(). Since the StackWalk was performed before the stack.Print(), stack frames where not gathered correctly. There should be a better place to initialize symbols. For now, this patch makes the test happy. Patch by Wei Wang Differential Revision: https://reviews.llvm.org/D22410 llvm-svn: 275580
* [sanitizer] Fix a crash when demangling Swift symbols, take 2Kuba Brecka2016-05-121-0/+1
| | | | | | | | | | To invoke the Swift demangler, we use dlsym to locate swift_demangle. However, dlsym malloc's storage and stores it in thread-local storage. Since allocations from the symbolizer are done with the system allocator (at least in TSan, interceptors are skipped when inside the symbolizer), we will crash when we try to deallocate later using the sanitizer allocator again. To fix this, let's just not call dlsym from the demangler, and call it during initialization. The dlsym function calls malloc, so it needs to be only used after our allocator is initialized. Adding a Symbolizer::LateInitialize call that is only invoked after all other initializations. Differential Revision: http://reviews.llvm.org/D20015 llvm-svn: 269291
* tsan: describe heap/data locations in GoDmitry Vyukov2016-03-011-0/+2
| | | | llvm-svn: 262343
* [Sanitizer] Introduce ListOfModules object and use it to replace ↵Alexey Samsonov2016-02-221-3/+2
| | | | | | | | | | | | | | | | | | | | 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 llvm-svn: 261554
* Introduce stats and stats_client libraries.Peter Collingbourne2016-01-161-1/+2
| | | | | | | | | This is part of a new statistics gathering feature for the sanitizers. See clang/docs/SanitizerStats.rst for further info and docs. Differential Revision: http://reviews.llvm.org/D16176 llvm-svn: 257972
* sanitizer_common: C++ify the IntrusiveList iterator interface.Peter Collingbourne2016-01-151-1/+0
| | | | llvm-svn: 257858
* [Sanitizer] Merge POSIXSymbolizer and WinSymbolizerKuba Brecka2015-04-111-4/+3
| | | | | | | | The two subclasses of Symbolizer now only define two virtual functions, PlatformDemangle and PlatformPrepareForSandboxing. Let's make these non-virtual and directly defined by individual platforms. Reviewed at http://reviews.llvm.org/D8912 llvm-svn: 234690
* [Sanitizer] Get rid of PlatformGetListOfModulesKuba Brecka2015-04-091-7/+0
| | | | | | | | Moving the implementation of several functions from sanitizer_symbolizer.cc into sanitizer_symbolizer_libcdep.cc. Reviewed at http://reviews.llvm.org/D8858 llvm-svn: 234472
* [ASan] Unify handling of loaded modules between POSIX and WindowsTimur Iskhodzhanov2015-04-061-2/+13
| | | | | | Reviewed at http://reviews.llvm.org/D8805 llvm-svn: 234150
* [Sanitizer RT] Put the Symbolizer module name string ownership in orderTimur Iskhodzhanov2015-03-311-1/+25
| | | | | | Reviewed at http://reviews.llvm.org/D8666 llvm-svn: 233687
* Improve SUMMARY reporting in sanitizers.Alexey Samsonov2015-03-171-1/+0
| | | | | | | | | Make sure SUMMARY is always reported unless print_summary flag is set to false, even if symbolizer is unavailable or report stack trace is empty. If file/line info for PC can't be evaluated, print module name/offset like we do in stack trace. llvm-svn: 232567
* Symbolizer refactoring: Merge common parts of POSIXSymbolizer and WinSymbolizerKuba Brecka2015-03-091-21/+27
| | | | | | Reviewed at http://reviews.llvm.org/D8105 llvm-svn: 231680
* [sanitizer] when dumping coverage bitset, dump seperate file for every ↵Kostya Serebryany2015-03-041-0/+7
| | | | | | module, instead of dumping a single combined bitset llvm-svn: 231319
* Symbolizer refactoring: Turn FillAddressAndModuleInfo into FillModuleInfoKuba Brecka2015-03-031-2/+1
| | | | | | Reviewed at http://reviews.llvm.org/D8020 llvm-svn: 231061
* Symbolizer refactoring: Move internals to separate filesKuba Brecka2015-03-021-62/+0
| | | | | | Reviewed at http://reviews.llvm.org/D7972 llvm-svn: 231014
* Symbolizer refactoring: SymbolizerTool and better interfaceKuba Brecka2015-02-281-3/+18
| | | | | | Reviewed at: http://reviews.llvm.org/D7936 llvm-svn: 230842
* [compiler-rt] Symbolizer refactoring: Abstract SymbolizerProcess betterKuba Brecka2015-02-271-13/+5
| | | | | | Reviewed at http://reviews.llvm.org/D7889 llvm-svn: 230749
* [compiler-rt] Symbolizer refactoring: Move SymbolizerProcess interface to headerKuba Brecka2015-02-251-0/+55
| | | | | | Reviewed at http://reviews.llvm.org/D7868 llvm-svn: 230530
* Simplify Symbolizer::SymbolizePC() interface.Alexey Samsonov2014-12-021-35/+28
| | | | | | | | | | | 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. llvm-svn: 223145
* Correct the usage of DataInfo structure in TSanAlexey Samsonov2014-11-041-1/+11
| | | | llvm-svn: 221297
* [Sanitizer] Get rid of Symbolizer::Get() and Symbolizer::GetOrNull().Alexey Samsonov2014-09-101-6/+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. llvm-svn: 217558
* [Sanitizer] Simplify Symbolizer creation interface.Alexey Samsonov2014-07-261-11/+3
| | | | | | | | | | | 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. llvm-svn: 214005
* [Sanitizer] Add Symbolizer::GetModuleNameAndOffsetForPC() and use it in LSan ↵Alexey Samsonov2013-12-251-0/+4
| | | | | | | | suppression matching. This allows us to avoid retrieving file/line info for suppressed modules. llvm-svn: 198025
* [Sanitizer] Replace Symbolizer::IsAvailable and ↵Alexey Samsonov2013-12-251-4/+1
| | | | | | | | Symbolizer::IsExternalAvailable with Symbolizer::CanReturnFileLineInfo. Remove now redundant checks in symbolizer initialization in TSan and MSan. llvm-svn: 198000
* [Sanitizer] Implement Symbolizer class on WindowsTimur Iskhodzhanov2013-12-181-1/+8
| | | | llvm-svn: 197571
* [Sanitizers] Rename Symbolizer::SymbolizeCode to Symbolizer::SymbolizePCTimur Iskhodzhanov2013-12-181-2/+1
| | | | llvm-svn: 197569
* [Sanitizer] Always initialize a Symbolizer (even if 'symbolize' is false).Alexey Samsonov2013-12-171-2/+2
| | | | | | | | | If 'symbolize' flag is not set, we still want to transform virtual address to module+offset pair in the call to Symbolizer::SymbolizeCode(). See https://code.google.com/p/address-sanitizer/issues/detail?id=251 for more details. llvm-svn: 197491
* [Sanitizer] Add Symbolizer::AddHooks() and use it in TSan and MSan.Alexey Samsonov2013-10-311-0/+22
| | | | | | | | | | | | | | | | | | | | | 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 llvm-svn: 193807
* [Sanitizer] Update comment in sanitizer_symbolizer.hAlexey Samsonov2013-10-301-13/+7
| | | | llvm-svn: 193700
* [Sanitizer] Use SpinMutex for Symbolizer initialization (per dvyukov's ↵Alexey Samsonov2013-10-301-1/+2
| | | | | | suggestion) llvm-svn: 193697
* Overhaul the symbolizer interface.Peter Collingbourne2013-10-251-11/+32
| | | | | | | | | | | | | | | | | | | | | | 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 llvm-svn: 193448
* Revert r190520 as it wasn't the right fix.Daniel Jasper2013-09-111-2/+0
| | | | llvm-svn: 190524
* Add empty virtual destructor...Daniel Jasper2013-09-111-0/+2
| | | | | | ... as this otherwise triggers -Wnon-virtual-dtor. llvm-svn: 190520
* [Sanitizer] Refactor symbolization interface: use class instead of several ↵Alexey Samsonov2013-09-101-56/+38
| | | | | | functions. Move some code around to get rid of extra source files llvm-svn: 190410
* ASan, LSan, MSan: try to find llvm-symbolizer binary in PATH if it is not ↵Alexey Samsonov2013-09-031-1/+2
| | | | | | provided. Now we don't need to explicitly set the location of llvm-symbolizer in lit test configs. llvm-svn: 189801
* Define SANITIZER_INTERFACE_ATTRIBUTE on Windows and fix all the places where ↵Timur Iskhodzhanov2013-08-131-3/+3
| | | | | | SANITIZER_INTERFACE_ATTRIBUTE or SANITIZER_ATTRIBUTE_WEAK are used llvm-svn: 188261
OpenPOWER on IntegriCloud