summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_libcdep.cc
Commit message (Collapse)AuthorAgeFilesLines
* compiler-rt: Rename .cc file in lib/sanitizer_common to .cppNico Weber2019-07-311-556/+0
| | | | | | | | | | | See https://reviews.llvm.org/D58620 for discussion, and for the commands I ran. In addition I also ran for f in $(svn diff | diffstat | grep .cc | cut -f 2 -d ' '); do rg $f . ; done and manually updated (many) references to renamed files found by that. llvm-svn: 367463
* hwasan: Teach the runtime to identify the local variable being accessed in ↵Peter Collingbourne2019-06-271-8/+71
| | | | | | | | | | | | | | 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] Trivial portion of the port to Myriad RTEMSWalter Lee2018-05-181-3/+3
| | | | | | | | | | | | | | | | | | | | | This commit contains the trivial portion of the port of ASan to Myriad RTEMS. - Whitelist platform in sanitizer_platform.h, ubsan_platform.h - Turn off general interception - Use memset for FastPoisonShadow - Define interception wrappers - Set errno symbol correctly - Enable ASAN_LOW_MEMORY - Enable preinit array - Disable slow unwinding - Use fuchsia offline symbolizer - Disable common code for: InitializeShadowMemory, CreateMainThread, AsanThread::ThreadStart, StartReportDeadlySignal, MaybeReportNonExecRegion. Differential Revision: https://reviews.llvm.org/D46454 llvm-svn: 332681
* [sanitizer] Remove empty Symbolizer PrepareForSandboxingKostya Kortchinsky2018-04-031-5/+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
* Revert r324847, there's bot failures.Kuba Mracek2018-02-111-2/+2
| | | | llvm-svn: 324849
* [compiler-rt] Replace forkpty with posix_spawnKuba Mracek2018-02-111-2/+2
| | | | | | | | | | On Darwin, we currently use forkpty to communicate with the "atos" symbolizer. There are several problems that fork or forkpty has, e.g. that after fork, interceptors are still active and this sometimes causes crashes or hangs. This is especially problematic for TSan, which uses interceptors for OS-provided locks and mutexes, and even Libc functions use those. This patch replaces forkpty with posix_spawn. Since posix_spawn doesn't fork (at least on Darwin), the interceptors are not a problem. Additionally, this also fixes a latent threading problem with ptsname (it's unsafe to use this function in multithreaded programs). Yet another benefit is that we'll handle post-fork failures (e.g. sandbox disallows "exec") gracefully now. Differential Revision: https://reviews.llvm.org/D40032 llvm-svn: 324846
* Add support for custom loaders to the sanitizer symbolizerFrancis Ricci2017-10-021-0/+5
| | | | | | | | | | | | | | | | | 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-5/+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/+5
| | | | | | | | | | | | | | | | | 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
* Remove recursion from FindModuleForAddress. NFC.Francis Ricci2017-09-291-11/+24
| | | | llvm-svn: 314520
* Revert "Add support for custom loaders to the sanitizer symbolizer"Francis Ricci2017-09-281-32/+14
| | | | | | | | 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-14/+32
| | | | | | | | | | | | | | | | | 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-32/+14
| | | | | | | | 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-14/+32
| | | | | Change-Id: I5594bd6b216deca2c73cf0a7001f9aec1e803c60 llvm-svn: 314342
* Invalidate symbolizer module list from dlopen/dlclose interceptorsFrancis Ricci2017-09-261-4/+5
| | | | | | | | | | | | | | 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
* [compiler-rt] Check for empty buffer in Addr2LineProcess::ReadFromSymbolizerAlex Shlyapnikov2017-08-041-1/+1
| | | | | | | | | | | | | | | | | | | 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 llvm-svn: 310089
* [sanitizer_common] Fuchsia-specific symbolizerVitaly Buka2017-08-011-9/+14
| | | | | | | | | | | | | | | | | | | | 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 llvm-svn: 309760
* [compiler-rt] Prevent symbolizer from starting itself.Vitaly Buka2017-02-211-0/+16
| | | | | | | | | | | | | | 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 llvm-svn: 295771
* [compiler-rt] Fix incorrect use of snprintfVitaly Buka2017-02-021-4/+17
| | | | | | | | | | | | | | 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 llvm-svn: 293930
* [sanitizer] Use architecture/slice information when symbolizing fat Mach-O ↵Kuba Mracek2017-01-061-14/+36
| | | | | | | | | | 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
* [sanitizer] Add workaround for empty stringsVitaly Buka2016-12-081-18/+14
| | | | | | | | | | | | 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 llvm-svn: 289145
* [sanitizer] [SystemZ] Add ptrace support bits.Marcin Koscielnicki2016-04-261-0/+4
| | | | | | Differential Revision: http://reviews.llvm.org/D19134 llvm-svn: 267548
* sanitizer: Fix endianness checks for gccAlexey Samsonov2016-03-091-2/+2
| | | | | | | | | | | | | | | | | 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 llvm-svn: 263077
* [Sanitizer] Introduce ListOfModules object and use it to replace ↵Alexey Samsonov2016-02-221-10/+6
| | | | | | | | | | | | | | | | | | | | 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
* [asan] Add iOS support.Anna Zaks2016-02-021-0/+4
| | | | llvm-svn: 259451
* sanitizer_common: C++ify the IntrusiveList iterator interface.Peter Collingbourne2016-01-151-12/+8
| | | | llvm-svn: 257858
* [Windows] Use llvm-symbolizer before using dbghelpReid Kleckner2015-08-111-0/+241
| | | | | | | | | | | | | | | | | | | | | | | 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 llvm-svn: 244616
* [Sanitizer] Get rid of PlatformGetListOfModulesKuba Brecka2015-04-091-0/+115
| | | | | | | | 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
* Adding the implementation of atos and dladdr symbolizers for OS X.Kuba Brecka2015-03-121-0/+13
| | | | | | | | They are currently still *not* used, "llvm-symbolizer" is still the default symbolizer on OS X. Reviewed at http://reviews.llvm.org/D6588 llvm-svn: 232026
* Symbolizer refactoring: Merge common parts of POSIXSymbolizer and WinSymbolizerKuba Brecka2015-03-091-3/+3
| | | | | | Reviewed at http://reviews.llvm.org/D8105 llvm-svn: 231680
* Symbolizer refactoring: ExtractToken and friendsKuba Brecka2015-03-021-0/+31
| | | | | | Reviewed at http://reviews.llvm.org/D7867 llvm-svn: 231027
* Symbolizer refactoring: Move internals to separate filesKuba Brecka2015-03-021-1/+1
| | | | | | Reviewed at http://reviews.llvm.org/D7972 llvm-svn: 231014
* Satisfy -Wparentheses.Nick Lewycky2014-07-261-1/+1
| | | | llvm-svn: 214017
* [Sanitizer] Simplify Symbolizer creation interface.Alexey Samsonov2014-07-261-16/+5
| | | | | | | | | | | 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] Use SpinMutex for Symbolizer initialization (per dvyukov's ↵Alexey Samsonov2013-10-301-15/+6
| | | | | | suggestion) llvm-svn: 193697
* [Sanitizer] Revert r193501 and properly fix r193448Alexey Samsonov2013-10-281-1/+2
| | | | llvm-svn: 193522
* Overhaul the symbolizer interface.Peter Collingbourne2013-10-251-0/+47
| | | | | | | | | | | | | | | | | | | | | | 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
* [Sanitizer] Refactor symbolization interface: use class instead of several ↵Alexey Samsonov2013-09-101-491/+0
| | | | | | 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-0/+5
| | | | | | 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-4/+4
| | | | | | SANITIZER_INTERFACE_ATTRIBUTE or SANITIZER_ATTRIBUTE_WEAK are used llvm-svn: 188261
* Change __sanitizer_symbolize_demangle hook return type to 'int'Alexey Samsonov2013-07-011-6/+14
| | | | llvm-svn: 185326
* Demangle names using pluggable internal symbolizer if possibleAlexey Samsonov2013-06-281-2/+26
| | | | llvm-svn: 185146
* Make InternalAlloc/InternalFree in sanitizer runtimes libc-free by switching ↵Alexey Samsonov2013-05-291-0/+1
| | | | | | to a custom allocator. llvm-svn: 182836
* [nolibc] Move symbolizer to RTSanitizerCommonLibc, and make it optional ↵Peter Collingbourne2013-05-211-0/+453
using a weak symbol. llvm-svn: 182372
OpenPOWER on IntegriCloud