summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/asan
Commit message (Collapse)AuthorAgeFilesLines
...
* [asan] Avoid two compiler-synthesized calls to memset & memcpyReid Kleckner2019-06-211-5/+2
| | | | | | | | | | Otherwise the tests hang on Windows attempting to report nested errors. Reviewed By: vitalybuka Differential Revision: https://reviews.llvm.org/D63627 llvm-svn: 364070
* [asan_symbolize] Teach `asan_symbolize.py` to symbolicate partially ↵Dan Liew2019-06-181-2/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | symbolicated ASan reports. Summary: The use case here is to be able symbolicate ASan reports that might be partially symbolicated, in particular where the function name is known but no source location is available. This can be caused by missing debug info. Previously we would only try to symbolicate completely unsymbolicated reports. The code currently contains an unfortunate quirk to handle a darwin specific bug (rdar://problem/49784442) in the way partially symbolicated reports are emitted when the source location is missing. rdar://problem/49476995 Reviewers: kubamracek, yln, samsonov, dvyukov, vitalybuka Subscribers: aprantl, #sanitizers, llvm-commits Tags: #llvm, #sanitizers Differential Revision: https://reviews.llvm.org/D60533 llvm-svn: 363639
* Improve error message when '=' is missing in {ASAN,...}_OPTIONS.Vitaly Buka2019-06-151-3/+3
| | | | | | | | | | | | | | | | | | Summary: It's handling isses as described here: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89832 Patch by Martin Liška. Reviewers: kcc, vitalybuka Reviewed By: vitalybuka Subscribers: cryptoad, kubamracek Differential Revision: https://reviews.llvm.org/D59876 llvm-svn: 363480
* [asan] Fix debug asan build link errorReid Kleckner2019-05-222-26/+29
| | | | | | | | | | | | Reviewers: dmajor, vitalybuka, waltl Subscribers: kubamracek, #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D61871 llvm-svn: 361427
* [asan] clang-format parent patchVitaly Buka2019-05-211-3/+3
| | | | llvm-svn: 361305
* [asan] Replace assignments with internal_memcpy ErrorDescriptionVitaly Buka2019-05-212-3/+5
| | | | | | For consistency with nearby code and to avoid interceptors during reports. llvm-svn: 361304
* [sanitizer] Don't generate "failed to intercept" constants for each functionVitaly Buka2019-05-161-9/+9
| | | | llvm-svn: 360958
* Fix some gcc warnings in compiler-rtNico Weber2019-05-101-2/+2
| | | | | | | | - Several "warning: extra ';' [-Wpedantic]" - One "C++ style comments are not allowed in ISO C90 [enabled by default]" in a file that uses C style comments everywhere but in one place llvm-svn: 360430
* [Sanitizer] Reland "Cleanup INTERCEPT_FUNCTION macro"Julian Lettner2019-05-011-2/+2
| | | | | | | | | | | | | | | | | | | | | | On Linux both version of the INTERCEPT_FUNCTION macro now return true when interception was successful. Adapt and cleanup some usages. Also note that `&(func) == &WRAP(func)` is a link-time property, but we do a runtime check. Tested on Linux and macOS. Previous attempt reverted by: 5642c3feb03d020dc06a62e3dc54f3206a97a391 This attempt to bring order to the interceptor macro goes the other direction and aligns the Linux implementation with the way things are done on Windows. Reviewed By: vitalybuka, rnk Differential Revision: https://reviews.llvm.org/D61358 llvm-svn: 359725
* [sanitizer][NFC] Set LargeMmapAllocator type from PrimaryAllocatorVitaly Buka2019-05-011-7/+1
| | | | | | | | | | | | | | They need to have same AddressSpaceView and MapUnmapCallback. Reviewers: eugenis Subscribers: kubamracek, #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D61168 llvm-svn: 359719
* [sanitizer][NFC] Get type of AllocatorCache from CombinedAllocatorVitaly Buka2019-05-011-5/+1
| | | | | | | | | | | | | | Reviewers: eugenis, cryptoad, kcc Reviewed By: kcc Subscribers: kcc, kubamracek, #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D61155 llvm-svn: 359715
* [sanitizer] Implement reallocarray.Evgeniy Stepanov2019-05-017-0/+59
| | | | | | | | | | | | | | | | Summary: It's a cross of calloc and realloc. Sanitizers implement calloc-like check for size overflow. Reviewers: vitalybuka, kcc Subscribers: kubamracek, #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D61108 llvm-svn: 359708
* Revert r359325 "[NFC][Sanitizer] Change "return type" of INTERCEPT_FUNCTION ↵Reid Kleckner2019-04-301-4/+2
| | | | | | | | | | | | | | | to void" Changing INTERCEPT_FUNCTION to return void is not functionally correct. IMO the best way to communicate failure or success of interception is with a return value, not some external address comparison. This change was also creating link errors for _except_handler4_common, which is exported from ucrtbase.dll in 32-bit Windows. Also revert dependent changes r359362 and r359466. llvm-svn: 359611
* Fix FIXME added in r359339Reid Kleckner2019-04-292-15/+12
| | | | | | | | | We have windows.h in asan_win.cc, so we can just use the correct prototypes for these EH-related interceptors without worrying. Also fix an unused variable warning while I'm here. llvm-svn: 359500
* Pacify sanitizer lint script after r359498Reid Kleckner2019-04-291-1/+0
| | | | llvm-svn: 359499
* [AddressSanitizer] [Windows] Fix HeapReAlloc and _recalloc bugs in ↵Matthew G McGovern2019-04-291-14/+43
| | | | | | | | | | | asan_malloc_win.cc HeapReAlloc should allow for 0 sized reallocations without freeing the memory block provided by the user. _recalloc previously did not zero new memory after reallocation. https://reviews.llvm.org/D61268 llvm-svn: 359498
* [Sanitizer] Cleanup {ASAN, MSAN}_INTERCEPT_FUNC[_VER] macroJulian Lettner2019-04-291-4/+2
| | | | | | | | | | | | Note that this change is not strictly NFC since we add the `(&(name) != &WRAP(name)` part to the conditional for the `_VER` variant of the macro. Reviewers: vitalybuka Differential Revision: https://reviews.llvm.org/D61204 llvm-svn: 359466
* [sanitizer] Calculate SizeClassAllocator32::ByteMap type from ↵Vitaly Buka2019-04-271-12/+1
| | | | | | | | | | | | | | Params::kSpaceSize and Params::kRegionSizeLog Reviewers: eugenis Subscribers: kubamracek, cryptoad, #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D61206 llvm-svn: 359374
* [Sanitizer][Windows] Speculative fix for broken build on WindowsJulian Lettner2019-04-261-2/+7
| | | | llvm-svn: 359339
* [NFC][Sanitizer] Change "return type" of INTERCEPT_FUNCTION to voidJulian Lettner2019-04-261-2/+6
| | | | | | | | | | | | This temporary change tells us about all the places where the return value of the INTERCEPT_FUNCTION macro is actually used. In the next patch I will cleanup the macro and remove GetRealFuncAddress. Reviewed By: vitalybuka Differential Revision: https://reviews.llvm.org/D61145 llvm-svn: 359325
* [asan_symbolize] Teach `asan_symbolize.py` to symbolicate using a module mapDan Liew2019-04-261-0/+243
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The use case here is to be able get the UUIDs of the modules that need to be symbolicated so that external plugins can see them. This information can be extracted from ASan reports if the `print_module_map` ASan option is enabled. Currently printing of the module map is only implemented on Darwin and so this is effectively a Darwin only feature right now. The module map hooks into symbolization using the new plugin infrastructure. A new hook in `AsanSymbolizerPlugInProxy` (and in `AsanSymbolizerPlugIn`) is also provided to allow external plugins to hook into the module look up process. This will allow external plugins to look up modules with knowledge of their UUID. The new plug-in is currently stored in the `asan_symbolize.py` script. We could potentially move this into a separate file in the future (to reduce clutter) if we can come up with a policy for where to search for plugins that should always get loaded. rdar://problem/49476995 Reviewers: kubamracek, yln, samsonov, dvyukov, vitalybuka Subscribers: #sanitizers, llvm-commits Tags: #llvm, #sanitizers Differential Revision: https://reviews.llvm.org/D60531 llvm-svn: 359322
* [asan_symbolize] Workaround bug in old Python 2 versions.Dan Liew2019-04-181-2/+7
| | | | | | | | | | | | | | | | | | | | | The change landed in r358657 broke some of the buildbots because they use an older version of Python 2 that raises this error. ``` File "/Volumes/data/dev/llvm/upstream/master/src/projects/compiler-rt/lib/asan/scripts/asan_symbolize.py", line 509 exec(f.read(), globals_space, None) SyntaxError: unqualified exec is not allowed in function 'load_plugin_from_file' it contains a nested function with free variables ``` I can reproduce this problem when using Python 2.7.6. To workaround this some indirection has been added to prevent the broken (the line at fault would never be executed) SyntaxError error in old Python versions from being raised. rdar://problem/49476995 llvm-svn: 358682
* [asan_symbolize] Add a simple plugin architectureDan Liew2019-04-181-48/+235
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This change adds a simple plugin architecture to `asan_symbolize.py`. The motivation here is that sometimes it's necessary to perform extra work to figure out where binaries with debug symbols can actually be found. For example it might be the case that a remote service needs to be queried for binaries and then copied to the local system. This "extra work" can be extremely site-specific such that adding the code directly into the `asan_symbolize.py` would just clutter the code for a very niche use case. To avoid this, the `asan_symbolize.py` can now load external code via a new `--plugins` command line option. These plugins are loaded before main command line argument parsing so that they can add their own command line options. Right now the only hook into the behaviour of symbolization is the `filter_binary_path()` function which assumes a very similar role to the `binary_name_filter` function that was previously in the code. We can add more hooks as necessary. Code in the `asan_symbolize.py` script does not call plugin code directly. Instead it uses a `AsanSymbolizerPlugInProxy` object. This object * Loads plugins from files. * Manages the lifetime of the plugins. * Provides an interface for calling into plugin functions and handles calling into multiple plugins. To unify the way binary paths are filtered the old `sysroot_path_filter` function (and associated code) has been turned into a simple plugin (`SysRootFilterPlugIn`) that is always loaded. The plugin unloads itself if the `-s` option is not present on the command line. Users should not see any functional change relating to this command line option. Some simple tests are provided to illustrate what plugin code looks like and also to check the functionality continues to work. rdar://problem/49476995 Reviewers: kubamracek, yln, samsonov, dvyukov, vitalybuka Subscribers: srhines, #sanitizers, llvm-commits Tags: #llvm, #sanitizers Differential Revision: https://reviews.llvm.org/D60529 llvm-svn: 358657
* [asan_symbolize] Move argument parser epilog text into script doc comment.Dan Liew2019-04-091-3/+5
| | | | | | | | | | | | | | | | | | Summary: This will make it easier to expand on the documentation in the future that avoids cluttering the code. rdar://problem/49476995 Reviewers: kubamracek, yln, samsonov, dvyukov, vitalybuka Subscribers: #sanitizers, llvm-commits Tags: #llvm, #sanitizers Differential Revision: https://reviews.llvm.org/D60398 llvm-svn: 357978
* [asan_symbolize] Use proper logging infrastructure.Dan Liew2019-04-081-14/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The previous logging infrastructure had several problems: * Debugging output was emitted to standard output which is also where the symbolized output would go. Interleaving these two separate bits of information makes inspecting the output difficult and could potentially break tests. * Enabling debugging output requires modifying the script which is not very conveninent. * When debugging it isn't immediately obvious where the output is coming from. This patch uses the Python standard library logging infrastructure which fixes all of the above problems. Logging is controlled using two new options. * `--log-level` - Sets the logging level, default is `info`. * `--log-dest` - Set the logging destination, default is standard error. Some simple test cases for the feature are included. rdar://problem/49476995 Reviewers: kubamracek, yln, samsonov, dvyukov, vitalybuka Subscribers: #sanitizers, llvm-commits Tags: #llvm, #sanitizers Differential Revision: https://reviews.llvm.org/D60343 llvm-svn: 357951
* AddressSanitizer: 64-bit SPARC/Linux portVitaly Buka2019-03-123-1/+118
| | | | | | | | | | | | | | | | | | | Summary: This patch contains the bits required to make the AddressSanitizer work on SPARC64/Linux (SPARC-T4 and later). Patch by Eric Botcazou. Reviewers: #sanitizers, vitalybuka, krytarowski Reviewed By: #sanitizers, vitalybuka Subscribers: brad, vitalybuka, ro, jyknight, kubamracek, fedor.sergeev, jdoerfert, llvm-commits, #sanitizers Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D58434 llvm-svn: 355980
* AddressSanitizer: fix for SPARC with GCCVitaly Buka2019-03-121-0/+4
| | | | | | | | | | | | | | | | | | | Summary: This patch contains a fixlet for the AddressSanitizer on the SPARC with GCC, which would otherwise generate a problematic call to the intercepted memcpy routine. It was tested with GCC on SPARC/Solaris and SPARC/Linux. Patch by Eric Botcazou. Reviewers: #sanitizers, vitalybuka Reviewed By: #sanitizers, vitalybuka Subscribers: vitalybuka, ro, jyknight, kubamracek, fedor.sergeev, jdoerfert, llvm-commits, #sanitizers Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D58433 llvm-svn: 355979
* Remove ASan asm instrumentation.Evgeniy Stepanov2019-03-112-278/+0
| | | | | | | | | | | | | | Summary: It is incomplete and has no users AFAIK. Reviewers: pcc, vitalybuka Subscribers: srhines, kubamracek, mgorny, krytarowski, eraman, hiraditya, jdoerfert, #sanitizers, llvm-commits, thakis Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D59154 llvm-svn: 355870
* [NFC] Simplify BufferedStackTrace::UnwindImplVitaly Buka2019-03-051-17/+8
| | | | llvm-svn: 355381
* [NFC] Move isUnwinding check into ScopedUnwindingVitaly Buka2019-03-051-6/+19
| | | | llvm-svn: 355380
* [NFC] Move ScopedUnwinding from .h to .ccVitaly Buka2019-03-052-12/+14
| | | | llvm-svn: 355377
* [NFC] Reorder ifs in BufferedStackTrace::UnwindImplVitaly Buka2019-03-051-12/+16
| | | | llvm-svn: 355376
* [NFC] Return on SANITIZER_MIPS && !IsValidFrameVitaly Buka2019-03-051-6/+6
| | | | llvm-svn: 355372
* [NFC] Put bp into Unwind(.. false) for consistencyVitaly Buka2019-03-051-2/+2
| | | | | | It's not used there anyway llvm-svn: 355371
* [NFC] Move asan_inited and size reset on top of ::UnwindImplVitaly Buka2019-03-051-16/+16
| | | | llvm-svn: 355370
* Revert "[NFC][Sanitizer] Cleanup ASan's GetStackTrace implementation"Vitaly Buka2019-03-051-14/+19
| | | | | | | | I've missed that UnwindSlow was removed from ScopedUnwinding. This reverts commit 4ce918e3942f0333ccb7d65d6265f4fc5f5324be. llvm-svn: 355369
* [NFC][Sanitizer] Cleanup ASan's GetStackTrace implementationJulian Lettner2019-03-051-19/+14
| | | | | | | | | | | | | | | | | | | | | Cleanup ASan's __sanitizer::BufferedStackTrace::UnwindImpl (formerly GetStackTrace) implementation. Start with ASan because it is the most complex implementation. GetStackTrace implementations seem to have started out as exact copies of the original implementation in ASan, but have diverged in subtle ways. My goal is to parameterize this algorithm (via templating or callbacks) so we can share the implementation and get rid of the inversed dependency (sanitizer_common depends on concrete implementations in asan, ubsan, etc.). This should also help us to avoid those pesky linker errors caused by undefined, duplicate, and weak symbols on Windows. Reviewed By: vitalybuka Differential Revision: https://reviews.llvm.org/D58861 llvm-svn: 355355
* Revert "[sanitizer] Fix return type of __bzero and __aeabi_mem* interceptors."Evgeniy Stepanov2019-03-022-49/+35
| | | | | | | | | Breaks TSan on Mac, which does return REAL(func)(... in COMMON_INTERCEPTOR_ENTER, which is not OK when REAL(func) has return type of void. llvm-svn: 355256
* [NFC][Sanitizer][Windows] Fix refactoring oversightJulian Lettner2019-03-011-1/+1
| | | | | | Fix mistake in previous commit: 9fe3b4906f351292691cd594b30fe6cf7230b94d llvm-svn: 355234
* [NFC][Sanitizer] Make GetStackTrace a private method of BufferedStackTraceJulian Lettner2019-03-011-9/+8
| | | | | | | | | | GetStackTrace is a implementation detail of BufferedStackTrace. Make it a private method. Reviewed By: vitalybuka Differential-Revision: https://reviews.llvm.org/D58753 llvm-svn: 355232
* [sanitizer] Fix return type of __bzero and __aeabi_mem* interceptors.Evgeniy Stepanov2019-03-012-35/+49
| | | | llvm-svn: 355231
* Revert "[sanitizer] Fix return type of __bzero and __aeabi_mem* interceptors."Evgeniy Stepanov2019-03-012-10/+5
| | | | | | This change is incomplete. llvm-svn: 355230
* [sanitizer] Fix return type of __bzero and __aeabi_mem* interceptors.Evgeniy Stepanov2019-03-012-5/+10
| | | | | | They return void, unlike memset/memcpy/memmove. llvm-svn: 355225
* Reland "[compiler-rt] Intercept the bcmp() function."Clement Courbet2019-03-011-16/+26
| | | | | | | Fix test issues on darwin: The REQUIRES for the test should be the same as the guard for whether we intercept bcmp. llvm-svn: 355204
* [NFC][Sanitizer] Add new BufferedStackTrace::Unwind APIJulian Lettner2019-03-012-7/+7
| | | | | | | | | | | | | | | | | | | | | Retrying without replacing call sites in sanitizer_common (which might not have a symbol definition). Add new Unwind API. This is the final envisioned API with the correct abstraction level. It hides/slow fast unwinder selection from the caller and doesn't take any arguments that would leak that abstraction (i.e., arguments like stack_top/stack_bottom). GetStackTrace will become an implementation detail (private method) of the BufferedStackTrace class. Reviewers: vitalybuka Differential Revision: https://reviews.llvm.org/D58741 > llvm-svn: 355168 llvm-svn: 355172
* Revert "[NFC][Sanitizer] Add new BufferedStackTrace::Unwind API"Julian Lettner2019-03-012-7/+7
| | | | | | This reverts commit 6112f37e758ebf2405955e091a745f5003c1f562. llvm-svn: 355171
* [NFC][Sanitizer] Add new BufferedStackTrace::Unwind APIJulian Lettner2019-03-012-7/+7
| | | | | | | | | | | | | | | | Add new Unwind API. This is the final envisioned API with the correct abstraction level. It hides/slow fast unwinder selection from the caller and doesn't take any arguments that would leak that abstraction (i.e., arguments like stack_top/stack_bottom). GetStackTrace will become an implementation detail (private method) of the BufferedStackTrace class. Reviewers: vitalybuka Differential Revision: https://reviews.llvm.org/D58741 llvm-svn: 355168
* [sanitizer] Fix compilation errors in r355030.Evgeniy Stepanov2019-02-273-3/+10
| | | | | | | | Disable hwasan interceptor on non-linux, non-x86-or-arm platforms. Add @plt to the asm call that clang intergrated-as infers but gcc does not. llvm-svn: 355041
* [NFC][Sanitizer] Pull up GetStackTrace into sanitizer_commonJulian Lettner2019-02-272-31/+28
| | | | | | | | | | | | | | | | | | | | We already independently declare GetStackTrace in all (except TSan) sanitizer runtime headers. Lets move it to sanitizer_stacktrace.h to have one canonical way to fill in a BufferedStackFrame. Also enables us to use it in sanitizer_common itself. This patch defines GetStackTrace for TSan and moves the function from ubsan_diag.cc to ubsan_diag_standalone.cc to avoid duplicate symbols for the UBSan-ASan runtime. Other than that this patch just moves the code out of headers and into the correct namespace. Reviewers: vitalybuka Differential Revision: https://reviews.llvm.org/D58651 llvm-svn: 355039
* [hwasan, asan] Intercept vfork.Evgeniy Stepanov2019-02-277-0/+44
| | | | | | | | | | | | | | | Summary: Intercept vfork on arm, aarch64, i386 and x86_64. Reviewers: pcc, vitalybuka Subscribers: kubamracek, mgorny, javed.absar, krytarowski, kristof.beyls, #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D58533 llvm-svn: 355030
OpenPOWER on IntegriCloud