summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/sanitizer_common
Commit message (Collapse)AuthorAgeFilesLines
...
* [sanitizer][NFC] Get type of AllocatorCache from CombinedAllocatorVitaly Buka2019-05-014-31/+15
| | | | | | | | | | | | | | 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-015-1/+30
| | | | | | | | | | | | | | | | 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
* Added test.Mitch Phillips2019-04-301-0/+16
| | | | llvm-svn: 359632
* [sanitizer_common] Added 64-bit signed flag parser.Mitch Phillips2019-04-301-0/+9
| | | | | | | | | | | | | | Summary: Adds a 64-bit signed flag parser for GWP-ASan's use. Reviewers: vlad.tsyrklevich, eugenis Subscribers: kubamracek, #sanitizers, llvm-commits, vitalybuka, morehouse, pcc, kcc Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D61342 llvm-svn: 359631
* [sanitizer] Calculate SizeClassAllocator32::ByteMap type from ↵Vitaly Buka2019-04-273-51/+10
| | | | | | | | | | | | | | 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] NFC: add static_assert to confirm that we use reasonable ByteMap ↵Vitaly Buka2019-04-271-3/+21
| | | | | | | | | | | | | | | | | | | type Summary: If bots work we can replace #ifs with template specialization by TwoLevelByteMapSize1. There is known users of TwoLevelByteMap with TwoLevelByteMapSize1 equal 8, and users of FlatByteMap with TwoLevelByteMapSize1 equal 2. Reviewers: eugenis Subscribers: kubamracek, #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D61200 llvm-svn: 359364
* Revert "[sanitizer] NFC: add static_assert to confirm that we use optimal ↵JF Bastien2019-04-261-7/+3
| | | | | | | | | | | | | | | | | ByteMap type" Fails on bots with: /Users/buildslave/jenkins/workspace/clang-stage1-cmake-RA-expensive/llvm/projects/compiler-rt/lib/sanitizer_common/sanitizer_allocator_primary32.h:69:3: error: static_assert failed due to requirement 'TwoLevelByteMapSize1 > 128' "TwoLevelByteMap should be used" static_assert(TwoLevelByteMapSize1 > 128, "TwoLevelByteMap should be used"); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~ /Users/buildslave/jenkins/workspace/clang-stage1-cmake-RA-expensive/llvm/projects/compiler-rt/lib/sanitizer_common/sanitizer_allocator_combined.h:29:34: note: in instantiation of template class '__sanitizer::SizeClassAllocator32<__sanitizer::AP32>' requested here typename PrimaryAllocator::AddressSpaceView>::value, ^ http://green.lab.llvm.org/green/job/clang-stage1-cmake-RA-expensive/13960/console llvm-svn: 359352
* Implement __sanitizer::conditional<B, T, F>Vitaly Buka2019-04-262-0/+24
| | | | llvm-svn: 359334
* [sanitizer] NFC: add static_assert to confirm that we use optimal ByteMap typeVitaly Buka2019-04-261-3/+7
| | | | | | | | | | | | | | Summary: If bots work we can replace #ifs with template specialization by TwoLevelByteMapSize1. Reviewers: eugenis Subscribers: kubamracek, #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D61200 llvm-svn: 359333
* [NFC] Remove ::kForTest from AP64, it does not use it.Vitaly Buka2019-04-261-7/+7
| | | | llvm-svn: 359323
* [lsan] Use SANITIZER_WORDSIZE when selecting ByteMapVitaly Buka2019-04-263-11/+26
| | | | | | | Originally this code was added for 64-bit platform and it was never update. Add static_assert to validate type of ByteMap. llvm-svn: 359286
* Revert "[lsan] Use SANITIZER_WORDSIZE when selecting ByteMap"Vitaly Buka2019-04-263-26/+11
| | | | | | | | New static_assert fails on a bot. This reverts commit r359269. llvm-svn: 359276
* [lsan] Use SANITIZER_WORDSIZE when selecting ByteMapVitaly Buka2019-04-263-11/+26
| | | | | | | Originally this code as added for 64-bit platform and was never changed. Add static_assert to make sure that we have correct map on all platforms. llvm-svn: 359269
* [sanitizer_common] Remove some old commented-out printf statements, and ↵Mitch Phillips2019-04-241-6/+1
| | | | | | fixed up the order of includes. llvm-svn: 359150
* [compiler-rt] NFC fixed [whitespace/braces] LINT warningVitaly Buka2019-04-241-1/+1
| | | | llvm-svn: 359133
* [compiler-rt] Fix warning about virtual destructor in sanitizer_flag_parser.hVitaly Buka2019-04-241-0/+3
| | | | llvm-svn: 359125
* [llvm-symbolizer] Quick fix for broken sanitizer botMitch Phillips2019-04-241-0/+1
| | | | | | | | | | | | | | | | | | | (sanitizer-x86_64-linux) until I can triage the issue properly. The build has been broken due to the symbolizer build checks failing. As the symbolizer build script relies on the old svn repo layout, it may take a little while longer to find the responsible patch for the breakage. This may be a completely valid fix, but I will need to confirm it. For now, it unbreaks the build. Tracking data: Build where the break first occurred: http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux/builds/21211 Changelist authors: @grimar, @maskray, @whitequark, @spatel, @dpreobra For the authors, no action needed (yet). Will follow up when I can identify the cause. llvm-svn: 359123
* [gn] Support dots in CMake paths in the sync scriptPetr Hosek2019-04-191-1/+0
| | | | | | | | Some file paths use dots to pick up sources from parent directories. Differential Revision: https://reviews.llvm.org/D60734 llvm-svn: 358774
* [NFC] Use clearer naming for local variablesJF Bastien2019-04-101-9/+9
| | | | llvm-svn: 358145
* [Sanitizer] Fix a possible write to freed memory in the wcrtomb interceptorPavel Labath2019-04-081-7/+10
| | | | | | | | | | | | | | | | | | Summary: r357240 added an interceptor for wctomb, which uses a temporary local buffer to make sure we don't write to unallocated memory. This patch applies the same technique to wcrtomb, and adds some additional tests for this function. Reviewers: vitalybuka, eugenis Subscribers: kubamracek, delcypher, llvm-commits, #sanitizers Tags: #llvm, #sanitizers Differential Revision: https://reviews.llvm.org/D59984 llvm-svn: 357889
* [Sanitizers] Provide __internal_dup on SolarisRainer Orth2019-04-051-0/+4
| | | | | | | | | | | | | | | | | | | | Both LLVM 8.0.0 and current trunk fail to link libclang_rt.ubsan.standalone-*.so on Solaris 11/x86 with GCC 8.1.0: Undefined first referenced symbol in file Scanning dependencies of target clang_rt.asan_cxx-x86_64 __sanitizer::internal_dup(int) ../sanitizer_common/CMakeFiles/RTSanitizerCommon.i386.dir/sanitizer_posix.cc.o ld: fatal: symbol referencing errors collect2: error: ld returned 1 exit status make[2]: *** [projects/compiler-rt/lib/ubsan/CMakeFiles/clang_rt.ubsan_standalone-dynamic-i386.dir/build.make:233: lib/clang/9.0.0/lib/sunos/libclang_rt.ubsan_standalone-i386.so] Error 1 Fixed by providing an implementation, which allowed the i386-pc-solaris2.11 build to finish. Differential Revision: https://reviews.llvm.org/D60045 llvm-svn: 357753
* [Sanitizers] Fix sanitizer_linux_libcdep.cc compilation on SolarisRainer Orth2019-04-051-0/+1
| | | | | | | | | | | | | | | | | | | | | Both LLVM 8.0.0 and current trunk fail to compile on Solaris 11/x86 with GCC 8.1.0: /vol/llvm/src/llvm/dist/projects/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cc: In function ‘void __sanitizer::ReExec()’: /vol/llvm/src/llvm/dist/projects/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cc:831:14: error: ‘getexecname’ was not declared in this scope pathname = getexecname(); ^~~~~~~~~~~ /vol/llvm/src/llvm/dist/projects/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cc:831:14: note: suggested alternative: ‘gethostname’ pathname = getexecname(); ^~~~~~~~~~~ gethostname This is easily fixed by including <stdlib.h> which declares that function. With that patch, compilation continues. Differential Revision: https://reviews.llvm.org/D60044 llvm-svn: 357751
* 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
OpenPOWER on IntegriCloud