summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_internal.h
Commit message (Collapse)AuthorAgeFilesLines
* [sanitizer_common] Replace forkpty with posix_spawn on DarwinJulian Lettner2019-08-151-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | On Darwin, we currently use forkpty to communicate with the "atos" symbolizer. There are several problems that fork[pty] 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 on Darwin. Since posix_spawn doesn't fork (at least on Darwin), the interceptors are not a problem. Another benefit is that we'll handle post-fork failures (e.g. sandbox disallows "exec") gracefully now. Related revisions and previous attempts that were blocked by or had to be revered due to test failures: https://reviews.llvm.org/D48451 https://reviews.llvm.org/D40032 Reviewed By: kubamracek Differential Revision: https://reviews.llvm.org/D65253 llvm-svn: 368947
* [sanitizer_common] Allow customization of StartSymbolizerSubprocessJulian Lettner2019-07-251-7/+8
| | | | | | | | | | | | | | Summary: Make SymbolizerProcess::StartSymbolizerSubprocess virtual and protected to allow subclasses to customize it via "override and call". Subscribers: kubamracek, #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D65252 llvm-svn: 366967
* hwasan: Teach the runtime to identify the local variable being accessed in ↵Peter Collingbourne2019-06-271-3/+9
| | | | | | | | | | | | | | 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
* 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
* [sanitizer_common] Move filesystem-related code out of sanitizer_common.ccVitaly Buka2017-07-221-0/+1
| | | | | | | | | | | | | | | | | | | | | | Summary: This is a pure refactoring change. It just moves code that is related to filesystem operations from sanitizer_common.{cc,h} to sanitizer_file.{cc,h}. This makes it cleaner to disable the filesystem-related code for a new port that doesn't want it. Submitted on behalf of Roland McGrath. Reviewers: kcc, eugenis, alekseyshl Reviewed By: alekseyshl Subscribers: vitalybuka, llvm-commits, kubamracek, mgorny, phosek Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D35591 llvm-svn: 308819
* Revert "[sanitizer_common] Move filesystem-related code out of ↵Vitaly Buka2017-07-201-1/+0
| | | | | | | | | | sanitizer_common.cc" Breaks Windows build. This reverts commit r308640. llvm-svn: 308648
* [sanitizer_common] Move filesystem-related code out of sanitizer_common.ccAlex Shlyapnikov2017-07-201-0/+1
| | | | | | | | | | | | | | | | | This is a pure refactoring change. It just moves code that is related to filesystem operations from sanitizer_common.{cc,h} to sanitizer_file.{cc,h}. This makes it cleaner to disable the filesystem-related code for a new port that doesn't want it. Commiting for mcgrathr. Reviewers: alekseyshl Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D35591 llvm-svn: 308640
* [sanitizer] Use architecture/slice information when symbolizing fat Mach-O ↵Kuba Mracek2017-01-061-2/+2
| | | | | | | | | | 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
* [sanitizers] Teach the internal demangler about Swift namesAnna Zaks2016-04-151-1/+1
| | | | | | | | | Add support for Swift names when symbolicating sanitizer traces. This is now relevant since TSan and ASan support have been added to Swift on OS X. Differential Revision: http://reviews.llvm.org/D19135 llvm-svn: 266494
* Support inline functions symbolization in Addr2Line symbolizer.Alexey Samsonov2015-09-141-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Patch by Maxim Ostapenko! Summary: Right now, Addr2Line symbolizer in asan_symbolize.py doesn't support inline functions symbolization. This might be a useful feature for using ASan on embedded systems. Test results: $ cat test.c static inline void FooBarBaz() { __sanitizer_print_stack_trace(); } int main() { FooBarBaz(); return 0; } $ clang test.c -fsanitize=address -g -O2 -o test.x && ./test.x &> /tmp/test.log $ ./projects/compiler-rt/lib/asan/scripts/asan_symbolize.py -l /tmp/test.log #0 0x42095e in __sanitizer_print_stack_trace _asan_rtl_ #1 0x4cec07 in FooBarBaz /home/max/build/llvm/asan/test.c:4 #2 0x4cec07 in main /home/max/build/llvm/asan/test.c:8 #3 0x7f89f0891ec4 in __libc_start_main /build/buildd/eglibc-2.19/csu/libc-start.c:287 Reviewers: glider, samsonov Subscribers: jevinskie, llvm-commits, ygribov Differential Revision: http://reviews.llvm.org/D12153 llvm-svn: 247642
* [Windows] Use llvm-symbolizer before using dbghelpReid Kleckner2015-08-111-8/+49
| | | | | | | | | | | | | | | | | | | | | | | 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
* [sanitizers] Use portable file read/write wrappers on process pipesReid Kleckner2015-08-111-2/+2
| | | | | | | This fixes a minor error checking bug around calling internal_read/write, and makes the code more portable for D11791. llvm-svn: 244546
* Demangling for DlAddrSymbolizerKuba Brecka2015-03-221-0/+2
| | | | | | | | | On OS X, dladdr() provides mangled names only, so we need need to demangle in DlAddrSymbolizer::SymbolizePC. Reviewed at http://reviews.llvm.org/D8291 llvm-svn: 232910
* Adding the implementation of atos and dladdr symbolizers for OS X.Kuba Brecka2015-03-121-1/+4
| | | | | | | | 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-4/+4
| | | | | | Reviewed at http://reviews.llvm.org/D8105 llvm-svn: 231680
* Symbolizer refactoring: Make WinSymbolizer use SymbolizerTool interfaceKuba Brecka2015-03-061-0/+3
| | | | | | Reviewed at http://reviews.llvm.org/D8089 llvm-svn: 231478
* Symbolizer refactoring: Link symbolizer tools into a fallback chainKuba Brecka2015-03-051-0/+7
| | | | | | Reviewed at http://reviews.llvm.org/D8049 llvm-svn: 231361
* Symbolizer refactoring: Unify access to symbolizer tools from POSIXSymbolizerKuba Brecka2015-03-031-1/+2
| | | | | | Reviewed at http://reviews.llvm.org/D8029 llvm-svn: 231162
* Symbolizer refactoring: ExtractToken and friendsKuba Brecka2015-03-021-0/+8
| | | | | | Reviewed at http://reviews.llvm.org/D7867 llvm-svn: 231027
* Symbolizer refactoring: Move internals to separate filesKuba Brecka2015-03-021-0/+85
Reviewed at http://reviews.llvm.org/D7972 llvm-svn: 231014
OpenPOWER on IntegriCloud