summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/sanitizer_common
Commit message (Collapse)AuthorAgeFilesLines
* Fix problem with ar_to_bc.sh script introduced by r357450.Peter Collingbourne2019-04-021-2/+2
| | | | | | | The new code wasn't matching absolute paths correctly. Should unbreak sanitizer-x86_64-linux bot. llvm-svn: 357502
* ar_to_bc.sh: replace readlink -f with custom relative path resolutionFangrui Song2019-04-021-2/+2
| | | | | | | | | | llvm-ar is a crunchgen-style executable dispatching to dlltool,ranlib,lib,ar based on argv[0]. In our content-addressable storage, readlink -f resolves paths to some digest and thus lost the original "llvm-ar" filename. Replace it with a custom path resolution to fix the problem. llvm-svn: 357450
* [Sanitizer] Add interceptor for wctombPavel Labath2019-03-292-0/+26
| | | | | | | | | | | | | | | | | Summary: This is required to avoid msan false positives for code using this function (although generally one should avoid using this function in favor of wcrtomb). Reviewers: eugenis, EricWF, vitalybuka Subscribers: srhines, kubamracek, fedor.sergeev, delcypher, llvm-commits, #sanitizers Tags: #llvm, #sanitizers Differential Revision: https://reviews.llvm.org/D59548 llvm-svn: 357240
* SanitizerCommon: 64-bit SPARC/Linux portVitaly Buka2019-03-123-0/+20
| | | | | | | | | | | | | | | | | | | Summary: This patch contains the bits required to make the common 32-bit allocator work on SPARC64/Linux. Patch by Eric Botcazou. Reviewers: #sanitizers, vitalybuka Reviewed By: #sanitizers, vitalybuka Subscribers: krytarowski, vitalybuka, ro, jyknight, kubamracek, fedor.sergeev, jdoerfert, llvm-commits, #sanitizers Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D58432 llvm-svn: 355978
* SanitizerCommon: fixes for unwinding & backtrace on SPARCVitaly Buka2019-03-125-35/+75
| | | | | | | | | | | | | | | | | | | Summary: This patch contains various fixes for the unwinding and backtrace machinery on the SPARC, which doesn't work correctly in various cases. It was tested with GCC on SPARC/Solaris and SPARC/Linux. Patch by Eric Botcazou. Reviewers: #sanitizers, vitalybuka Reviewed By: #sanitizers, vitalybuka Subscribers: jrtc27, delcypher, vitalybuka, ro, jyknight, kubamracek, fedor.sergeev, jdoerfert, llvm-commits, #sanitizers Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D58431 llvm-svn: 355965
* Remove esan.Nico Weber2019-03-118-104/+0
| | | | | | | | | | | It hasn't seen active development in years, and it hasn't reached a state where it was useful. Remove the code until someone is interested in working on it again. Differential Revision: https://reviews.llvm.org/D59133 llvm-svn: 355862
* [sanitizer] Update global_symbols.txtClement Courbet2019-03-081-0/+1
| | | | | | Add `bcmp` after r355672. llvm-svn: 355692
* Always compare C++ typeinfo (based on libstdc++ implementation).Martin Liska2019-03-061-3/+3
| | | | | | Differential Revision: https://reviews.llvm.org/D58028 llvm-svn: 355488
* [sanitizers] Don't use Windows Trace Logging with Clang in MSVC mode eitherMartin Storsjo2019-03-051-1/+1
| | | | | | | | | | | | | | | The TraceLoggingProvider.h header does work with clang-cl in general these days with Win SDK 10.0.17763.0, but when compiled in 32 bit x86 mode, with the -Z7 flag, compilation fails with the following error: fatal error: error in backend: assembler label '' can not be undefined With older Win SDKs, there are other build failures (regardless of architecture or the -Z7 flag). Differential Revision: https://reviews.llvm.org/D58958 llvm-svn: 355397
* Revert "[NFC][Sanitizer] Cleanup ASan's GetStackTrace implementation"Vitaly Buka2019-03-051-5/+0
| | | | | | | | 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-0/+5
| | | | | | | | | | | | | | | | | | | | | 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
* [sanitizer] Intercept bzero.Evgeniy Stepanov2019-03-042-2/+13
| | | | | | | | | | | | | | | | Summary: Intercept bzero and enable existing __bzero interceptor in Linux. bzero is deprecated but still used occasionally. Reviewers: vitalybuka Subscribers: srhines, kubamracek, #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D58850 llvm-svn: 355347
* Revert "[sanitizer] Fix return type of __bzero and __aeabi_mem* interceptors."Evgeniy Stepanov2019-03-021-35/+27
| | | | | | | | | 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
* Revert "Revert "[sanitizers] Don't use Windows Trace Logging on MinGW""Vlad Tsyrklevich2019-03-022-3/+15
| | | | | | | This reverts my orignal revert in r355250, I misread the buildbot logs. Volodymyr's commit in r355244 fixed the build. llvm-svn: 355251
* Revert "[sanitizers] Don't use Windows Trace Logging on MinGW"Vlad Tsyrklevich2019-03-022-15/+3
| | | | | | | This reverts commits r355236 and r355244, they broke the Linux sanitizer build. llvm-svn: 355250
* [sanitizers] Fix build on macOS with LogFullErrorReport redefinition error.Volodymyr Sapsai2019-03-021-1/+1
| | | | | | | | | | | | | | | | macOS has implementation of LogFullErrorReport and INLINE void LogFullErrorReport(const char *buffer) {} was causing > compiler-rt/lib/sanitizer_common/sanitizer_mac.cc:658:6: error: redefinition of 'LogFullErrorReport' Fixup for r355236. rdar://problem/48526020 llvm-svn: 355244
* [NFC][Sanitizer] Replace last uses of old Unwind APIJulian Lettner2019-03-012-25/+24
| | | | | | | | | | | | | Replace remaining uses of old Unwind API in unit tests. Allows us to remove the old API and WillUseFastUnwind can be made private. Reviewed By: vitalybuka Differential Revision: https://reviews.llvm.org/D58754 llvm-svn: 355242
* [sanitizers] Don't use Windows Trace Logging on MinGWMartin Storsjo2019-03-012-3/+15
| | | | | | | | | | | | | | | | | | | mingw-w64 currently is lacking the headers for this feature. Make the include lowercase at the same time. We consistently use lowercase for windows header includes, as windows itself is case insensitive, the SDK headers (in general, not necessarily considering this particular header) aren't consistent among themselves about what the proper canonical capitalization for headers are, and MinGW uses all lowercase names for the headers (as it is often used on case sensitive filesystems). In case mingw-w64 later gets this header, we can revert this (but keep the include lowercased). Differential Revision: https://reviews.llvm.org/D58765 llvm-svn: 355236
* [NFC][Sanitizer] Make GetStackTrace a private method of BufferedStackTraceJulian Lettner2019-03-011-6/+10
| | | | | | | | | | 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-011-27/+35
| | | | llvm-svn: 355231
* Revert "[sanitizer] Fix return type of __bzero and __aeabi_mem* interceptors."Evgeniy Stepanov2019-03-011-16/+13
| | | | | | This change is incomplete. llvm-svn: 355230
* [sanitizer] Fix return type of __bzero and __aeabi_mem* interceptors.Evgeniy Stepanov2019-03-011-13/+16
| | | | | | They return void, unlike memset/memcpy/memmove. llvm-svn: 355225
* [msan] Add an interceptor for ttyname().Evgeniy Stepanov2019-03-012-0/+16
| | | | llvm-svn: 355214
* Reland "[compiler-rt] Intercept the bcmp() function."Clement Courbet2019-03-012-7/+31
| | | | | | | 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
* [sanitizers] Explicitly use GetModuleFileNameW with wchar_tMartin Storsjo2019-03-011-1/+1
| | | | | | | | Alternatively we could define the string as TCHAR. Differential Revision: https://reviews.llvm.org/D58766 llvm-svn: 355180
* [NFC][Sanitizer] Add new BufferedStackTrace::Unwind APIJulian Lettner2019-03-011-14/+31
| | | | | | | | | | | | | | | | | | | | | 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-34/+24
| | | | | | This reverts commit 6112f37e758ebf2405955e091a745f5003c1f562. llvm-svn: 355171
* [NFC][Sanitizer] Add new BufferedStackTrace::Unwind APIJulian Lettner2019-03-012-24/+34
| | | | | | | | | | | | | | | | 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
* Revert "Revert "[sanitizers] Restore internal_readlink for x32""H.J. Lu2019-02-282-1/+9
| | | | | | | | | This reverts revision 354601 and disables ReadBinaryNameCached check on Windows since Windows has no working ReadBinaryName. Differential Revision: https://reviews.llvm.org/D58788 llvm-svn: 355129
* [sanitizer] Fix vfork interceptor on i386 w/ dynamic runtime.Evgeniy Stepanov2019-02-281-2/+16
| | | | | | | | PLT calls on i386 expect GOT base address in %ebx. This call does not need to go through PLT strictly speaking, but I'd rather avoid future surprises and implement the most general case. llvm-svn: 355125
* [sanitizer] Got rid of text relocations in i386 vfork interceptor.Evgeniy Stepanov2019-02-281-2/+6
| | | | llvm-svn: 355064
* Add username to TODO comment in sanitizer to satisfy sanitizer lint check. NFCDouglas Yung2019-02-281-1/+1
| | | | llvm-svn: 355062
* [compiler-rt] Windows Trace Logging for error reports.Matthew G McGovern2019-02-272-2/+36
| | | | | | | | Adds option for collecting sanitixer dumps via trace logging. - Set log_to_syslog=1 to enable this output. - Consult https://aka.ms/windowstracelogging for details on use. llvm-svn: 355045
* [sanitizer] Fix compilation errors in r355030.Evgeniy Stepanov2019-02-272-2/+2
| | | | | | | | 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-271-0/+6
| | | | | | | | | | | | | | | | | | | | 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
* Fixup compilation/test failures after r354960 and r355013.James Y Knight2019-02-271-4/+6
| | | | llvm-svn: 355034
* [hwasan, asan] Intercept vfork.Evgeniy Stepanov2019-02-276-1/+182
| | | | | | | | | | | | | | | 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
* [NFC][Sanitizer] Hard-code fast/slow unwinder at call siteJulian Lettner2019-02-272-2/+6
| | | | | | | | | | | | | Also assert that the caller always gets what it requested. This purely mechanical change simplifies future refactorings and eventual removal of BufferedStackTrace::Unwind. Reviewers: vitalybuka Differential Revision: https://reviews.llvm.org/D58557 llvm-svn: 355022
* Attempt to fix buildbot after r354972 [#1]. NFCI.Alexey Lapshin2019-02-271-2/+6
| | | | llvm-svn: 355013
* [NFC][Sanitizer] Add TODO commentsJulian Lettner2019-02-272-4/+2
| | | | llvm-svn: 354947
* Revert "[compiler-rt] Intercept the bcmp() function."Vlad Tsyrklevich2019-02-262-31/+7
| | | | | | | This reverts commits r354851, 354852, 354853 and r354888. They were causing build failures on the android sanitizer bot. llvm-svn: 354906
* [Sanitizer] Add interceptor for pthread_sigmaskPavel Labath2019-02-262-0/+21
| | | | | | | | | | | | | | | | | | | | | | Summary: pthread_sigmask is just like sigprocmask, except that its behavior in multithreaded programs is explicitly specified. Sanitizers were lacking a common interceptor for pthread_sigmask (although some specific sanitizers defined custom version), which lead to false positives (at least in msan) when using this function. The interceptor implementation, and its test are based on the equivalent code for sigprocmask. Reviewers: eugenis, vitalybuka Subscribers: kubamracek, delcypher, jfb, jdoerfert, llvm-commits, #sanitizers Tags: #llvm, #sanitizers Differential Revision: https://reviews.llvm.org/D58382 llvm-svn: 354874
* [compiler-rt] Intercept the bcmp() function.Clement Courbet2019-02-262-7/+31
| | | | | | | | | | | | | | | | | | | | | Summary: I have not introduced a separate hook for `bcmp()` as I don't think there should be any reason for a sanitizer to treat it differently from `memcmp()`. This is only enabled when building on POSIX with GNU extensions. Context: this is to avoid losing coverage when emitting `bcmp() == 0` instead of `memcmp() == 0` in llvm, see https://reviews.llvm.org/D56593. Reviewers: mgorny, krytarowski, vitalybuka, dvyukov Subscribers: kubamracek, dberris, delcypher, jdoerfert, #sanitizers, llvm-commits, jyknight Tags: #llvm, #sanitizers Differential Revision: https://reviews.llvm.org/D58379 llvm-svn: 354851
* Remove overly broad assert from r354717.Richard Trieu2019-02-231-2/+0
| | | | llvm-svn: 354720
* [NFC][Sanitizer] Comment out argument checksJulian Lettner2019-02-232-4/+4
| | | | | | These break clang-ppc64 bots. llvm-svn: 354718
* [NFC][Sanitizer] Add argument checks to BufferedStackTrace::Unwind* functionsJulian Lettner2019-02-236-10/+17
| | | | | | | | Reviewers: vitalybuka Differential Revision: https://reviews.llvm.org/D58555 llvm-svn: 354717
* [NFC][Sanitizer] Rename BufferedStackTrace::FastUnwindStackJulian Lettner2019-02-228-22/+21
| | | | | | | | | | | | | | | | FastUnwindStack -> UnwindFast SlowUnwindStack -> UnwindSlow Stack is redundant, verb should come first. SlowUnwindStackWithContext(uptr pc, void *context, u32 max_depth) -> SlowUnwindStack WithContext is redundant, since it is a required parameter. Reviewers: vitalybuka Differential Revision: https://reviews.llvm.org/D58551 llvm-svn: 354696
* [Sanitizer] Fix uses of stack->Unwind(..., fast)Julian Lettner2019-02-221-1/+1
| | | | | | | | | | | Apply StackTrace::WillUseFastUnwind(fast) in a few more places missed by my previous patch (https://reviews.llvm.org/D58156). Reviewers: vitalybuka Differential Revision: https://reviews.llvm.org/D58550 llvm-svn: 354695
* [sanitizer] Common macro for .note.GNU-stack directives (NFC)Evgeniy Stepanov2019-02-213-6/+13
| | | | llvm-svn: 354632
* Revert "[asan] Fix vfork handling.", +1Evgeniy Stepanov2019-02-212-44/+0
| | | | | | Revert r354625, r354627 - multiple build failures. llvm-svn: 354629
OpenPOWER on IntegriCloud