summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/sanitizer_common
Commit message (Collapse)AuthorAgeFilesLines
...
* [sanitizer] Add the flag handle_sigfpe that is default true to handle SIGFPE ↵Kostya Serebryany2015-08-053-0/+5
| | | | | | crashes same as SIGSEV crashes, patch by Karl Skomski llvm-svn: 244136
* [sanitizer] fix the Mac build (hopefully)Kostya Serebryany2015-08-051-1/+1
| | | | llvm-svn: 244099
* [AArch64] Fixes broken bot fue to TSAN patchRenato Golin2015-08-051-0/+4
| | | | | | Patch by Adhemerval Zanella. llvm-svn: 244088
* [libFuzzer] add weak hooks for strcmpKostya Serebryany2015-08-051-0/+5
| | | | llvm-svn: 244083
* Try to fix sanitizer_win.cc compile error on 64-bit after r243895Hans Wennborg2015-08-051-1/+8
| | | | llvm-svn: 244077
* [tsan] Enable tsan for aarch64Adhemerval Zanella2015-08-054-8/+90
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch enabled TSAN for aarch64 with 39-bit VMA layout. As defined by tsan_platform.h the layout used is: 0000 4000 00 - 0200 0000 00: main binary 2000 0000 00 - 4000 0000 00: shadow memory 4000 0000 00 - 5000 0000 00: metainfo 5000 0000 00 - 6000 0000 00: - 6000 0000 00 - 6200 0000 00: traces 6200 0000 00 - 7d00 0000 00: - 7d00 0000 00 - 7e00 0000 00: heap 7e00 0000 00 - 7fff ffff ff: modules and main thread stack Which gives it about 8GB for main binary, 4GB for heap and 8GB for modules and main thread stack. Most of tests are passing, with the exception of: * ignore_lib0, ignore_lib1, ignore_lib3 due a kernel limitation for no support to make mmap page non-executable. * longjmp tests due missing specialized assembly routines. These tests are xfail for now. The only tsan issue still showing is: rtl/TsanRtlTest/Posix.ThreadLocalAccesses Which still required further investigation. The test is disable for aarch64 for now. llvm-svn: 244055
* [asan] Enable asan for aarch64Adhemerval Zanella2015-08-051-1/+1
| | | | | | | | | | | | | | | | This patch enables asan for aarch64/linux. It marks it as 'unstable-release', since some tests are failing due either kernel missing support of non-executable pages in mmap or environment instability (infinite loop in juno reference boards). It sets decorate_proc_maps test to require stable-release, since the test expects the shadow memory to not be executable and the support for aarch64 is only added recently by Linux (da141706aea52c1a9 - 4.0). It also XFAIL static_tls test for aarch64 linker may omit the __tls_get_addr call as a TLS optimization. llvm-svn: 244054
* [asan] Print VAs instead of RVAs for module offsets on WindowsReid Kleckner2015-08-032-10/+94
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This is consistent with binutils and ASan behavior on other platforms, and makes it easier to use llvm-symbolizer with WinASan. The --relative-address flag to llvm-symbolizer is also no longer needed. An RVA is a "relative virtual address", meaning it is the address of something inside the image minus the base of the mapping at runtime. A VA in this context is an RVA plus the "preferred base" of the module, and not a real runtime address. The real runtime address of a symbol will equal the VA iff the module is loaded at its preferred base at runtime. On Windows, the preferred base is stored in the ImageBase field of one of the PE file header, and this change adds the necessary code to extract it. On Linux, this offset is typically included in program and section headers of executables. ELF shared objects typically use a preferred base of zero, meaning the smallest p_vaddr field in the program headers is zero. This makes it so that PIC and PIE module offsets come out looking like RVAs, but they're actually VAs. The difference between them simply happens to be zero. Reviewers: samsonov, majnemer Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D11681 llvm-svn: 243895
* [Sanitizer] Try to fix sanitizer_libc_test on FreeBSD.Alexey Samsonov2015-07-311-8/+3
| | | | llvm-svn: 243797
* [asan] Fix wrong __ANDROID_API__ preprocessor condition.Evgeniy Stepanov2015-07-311-1/+1
| | | | | | | This fixes report symbolization on L devices when building for API level 21 or 22. llvm-svn: 243787
* Re-commit r243686 - [Sanitizers] [Bug 24151] Generalize type of offset in ↵Daniel Sanders2015-07-315-7/+7
| | | | | | | | | internal_mmap The builder remains broken in the same way without this patch so this patch is innocent. llvm-svn: 243744
* Revert r243686 - [Sanitizers] [Bug 24151] Generalize type of offset in ↵Daniel Sanders2015-07-315-7/+7
| | | | | | | | | internal_mmap It's implicated in a buildbot failure and while the failure looks unrelated, this commit is the only probably candidate in the blamelist. llvm-svn: 243740
* [libFuzzer] prepare for __sanitizer_cov_trace_switch in libFuzzer and ↵Kostya Serebryany2015-07-312-3/+5
| | | | | | sanitizer coverage. Also fix pedantic warnings llvm-svn: 243721
* [Sanitizers] [Bug 24151] Generalize type of offset in internal_mmapDaniel Sanders2015-07-305-7/+7
| | | | | | | | | | | | | | | | Summary: Using u64 as type for offset changes its value, changing starting address for map in file. This patch solves Bug 24151, which raises issue while mapping file in mips32. Patch by Mohit Bhakkad Reviewers: dsanders, kcc Subscribers: hans, llvm-commits, samsonov, nitesh.jain, sagar, bhushan, jaydeep Differential Revision: http://reviews.llvm.org/D11588 llvm-svn: 243686
* [sanitizer] add a weak hook for strncmp interceptor, both to dfsan and other ↵Kostya Serebryany2015-07-301-9/+17
| | | | | | sanitizers. Hide the declaration and the calls in better macros llvm-svn: 243610
* [sanitizer] add a weak hook for memcmp interceptor, to be used primarily for ↵Kostya Serebryany2015-07-302-0/+20
| | | | | | fuzzing. More hooks will be added later. So far this is a Linux-only feature llvm-svn: 243601
* [Sanitizer] Replace diagnostic string literal to workaround CMake 2.8 bug.Alexey Samsonov2015-07-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Let me tell you a story. Suppose you want to build your project (e.g. LLVM) with CMake 2.8, Clang and AddressSanitizer. You also want to ensure that Clang is fresh enough and check that CMAKE_CXX_COMPILER_VERSION is 3.1+. This check would fail - CMake would fail to correctly calculate compiler version if you pass CMAKE_CXX_FLAGS=-fsanitize=address. The problem is funky compiler version calculation in CMakeDetermineCompilerId.cmake module: it compiles the sample source file with provided compiler and compile flags, runs "strings" and greps for "INFO:" ASCII strings contained on the executable to fetch "INFO:compiler", "INFO:compiler_version" etc. It limits the output of grep to just 4 lines. Unfortunately, if your executable was built with ASan, it would also contain an ASCII string INFO: %s ignores mlock/mlockall/munlock/munlockall and INFO:compiler_version string would never be parsed. All of the above actually happened after r243574 when we tried to configure libcxx with just-built Clang with TSan/MSan, and the version check mentioned above failed in HandleLLVMOptions.cmake (╯°□°)╯.~.┻━┻ llvm-svn: 243599
* [asan,tsan,msan] move the memcmp interceptor from asan/tsan to ↵Kostya Serebryany2015-07-293-0/+44
| | | | | | sanitizer_common. This may potentially lead to more reports from msan as it now sees the reads inside memcmp. To disable, use the flag intercept_memcmp=0. Likewise, it may potentially cause new races to appear due to more strict memcmp checking (flag strict_memcmp=1) llvm-svn: 243595
* [sanitizer] Fix Mac build.Evgeniy Stepanov2015-07-285-13/+21
| | | | llvm-svn: 243480
* [asan] Read process name from /proc/self/cmdline on Linux.Evgeniy Stepanov2015-07-285-8/+40
| | | | | | | | | | Rename getBinaryBasename() to getProcessName() and, on Linux, read it from /proc/self/cmdline instead of /proc/self/exe. The former can be modified by the process. The main motivation is Android, where application processes re-write cmdline to a package name. This lets us setup per-application ASAN_OPTIONS through include=/some/path/%b. llvm-svn: 243473
* Add commentary explaining PPC access to return addressBill Schmidt2015-07-281-0/+3
| | | | llvm-svn: 243470
* PowerPC's ABIs differ from those of other architectures in that theBill Schmidt2015-07-282-2/+9
| | | | | | | | | | callee-saved return address is stored in the caller's stack frame, not the callee's. This patch adjusts the logic to find the LR in the correct place for PowerPC. Patch joint with Bill Seurer. llvm-svn: 243467
* [sanitizer] Fix FreeBSD build of sanitizer_common.Evgeniy Stepanov2015-07-281-0/+2
| | | | | | Broken in r243051. llvm-svn: 243359
* [asan] Only link liblog on Android when it exists.Evgeniy Stepanov2015-07-241-1/+1
| | | | | | With r242975, liblog is only used on certain older platforms. llvm-svn: 243139
* [asan] Fix android system property access on aarch64.Evgeniy Stepanov2015-07-241-4/+4
| | | | | | | __system_property_get is gone from the NDK headers and libs in 64-bit toolchains, but it is still exported by platform libc.so. llvm-svn: 243137
* [sanitizer] Fix double definition of a function.Evgeniy Stepanov2015-07-231-0/+2
| | | | llvm-svn: 243055
* [sanitizer] Implement logging to syslog.Evgeniy Stepanov2015-07-2310-40/+106
| | | | | | | | | | | | | | | | | Previously, Android target had a logic of duplicating all sanitizer output to logcat. This change extends it to all posix platforms via the use of syslog, controlled by log_to_syslog flag. Enabled by default on Android, off everywhere else. A bit of cmake magic is required to allow Printf() to call a libc function. I'm adding a stub implementation to support no-libc builds like dfsan and safestack. This is a second attempt. I believe I've fixed all the issues that prompted the revert: Mac build, and all kinds of non-CMake builds (there are 3 of those). llvm-svn: 243051
* Revert r242975.Evgeniy Stepanov2015-07-238-99/+36
| | | | | | Breaks Mac build. llvm-svn: 242978
* [sanitizer] Implement logging to syslog.Evgeniy Stepanov2015-07-228-36/+99
| | | | | | | | | | | | | Previously, Android target had a logic of duplicating all sanitizer output to logcat. This change extends it to all posix platforms via the use of syslog, controlled by log_to_syslog flag. Enabled by default on Android, off everywhere else. A bit of cmake magic is required to allow Printf() to call a libc function. I'm adding a stub implementation to support no-libc builds like dfsan and safestack. llvm-svn: 242975
* [sanitizer] Implement include_if_exists with process name substitution.Evgeniy Stepanov2015-07-214-18/+53
| | | | | | | | | include_if_exists=/path/to/sanitizer/options reads flags from the file if it is present. "%b" in the include file path (for both variants of the flag) is replaced with the basename of the main executable. llvm-svn: 242853
* Reverting r242787 ("[asan] Fix the freopen interceptor to allow NULL instead ↵Kuba Brecka2015-07-211-2/+2
| | | | | | of a filename") to investigate buildbot failure. llvm-svn: 242791
* [asan] Fix the freopen interceptor to allow NULL instead of a filenameKuba Brecka2015-07-211-2/+2
| | | | | | | | According to man freopen, passing NULL instead of a filename is valid, however the current implementation of the interceptor assumes this parameter is non-NULL. Let's fix that and add a test case. Differential Revision: http://reviews.llvm.org/D11389 llvm-svn: 242787
* [Sanitizer] Teach ReadFileToBuffer to distinguish empty file from ↵Alexey Samsonov2015-07-177-35/+39
| | | | | | | | | | | | | | | | inaccessible file. Summary: This fixes https://code.google.com/p/address-sanitizer/issues/detail?id=399 (sanitizers crash with empty suppression files). Reviewers: kcc Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D11284 llvm-svn: 242594
* [asan] Fix sanitizer_allocator_test on AArch64.Evgeniy Stepanov2015-07-171-0/+2
| | | | llvm-svn: 242582
* [msan] Fix open_memstream handling.Evgeniy Stepanov2015-07-171-8/+7
| | | | | | | | For open_memstream() files, buffer pointer is only valid immediately after fflush() or fclose(). Fix the fclose() interceptor to unpoison after the REAL(fclose) call, not before it. llvm-svn: 242535
* [Sanitizer] Fix fopencookie() interceptor to work with null hook functions.Alexey Samsonov2015-07-141-7/+9
| | | | llvm-svn: 242193
* sanitizer_common: Only use _ReadWriteBarrier when targeting MSVC cl.exe.Peter Collingbourne2015-07-131-1/+1
| | | | | | Fixes check-ubsan when self hosting on Windows. llvm-svn: 242003
* sanitizer_common: Fix implementation of bit count operations on 64-bit Windows.Peter Collingbourne2015-07-131-11/+9
| | | | llvm-svn: 242002
* [asan] Fix an OS X startup crash when an empty section is presentKuba Brecka2015-07-061-0/+1
| | | | | | | | On OS X, when the main instrumented binary contains a custom section with zero length, ASan will crash (assert failure) early in the initialization. Reviewed at http://reviews.llvm.org/D10944 llvm-svn: 241474
* UBSan: Enable runtime library tests on Windows, and get most tests passing.Peter Collingbourne2015-07-021-2/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | Specifically: - Disable int128 tests on Windows, as MSVC cl.exe does not support int128, so we might not have been able to build the runtime with int128 support. - XFAIL the vptr tests as we lack Microsoft ABI support. - XFAIL enum.cpp as UBSan fails to add the correct instrumentation code for some reason. - Modify certain tests that build executables multiple times to use unique names for each executable. This works around a race condition observed on Windows. - Implement IsAccessibleMemoryRange for Windows to fix the last misaligned.cpp test. - Introduce a substitution for testing crashes on Windows using KillTheDoctor. Differential Revision: http://reviews.llvm.org/D10864 llvm-svn: 241303
* [sanitizer] add #ifdefs around slow unwinder to fix OS X debug buildKuba Brecka2015-07-021-0/+4
| | | | | | | | | | A recent change in slow unwinder causes the OS X build to fail when using COMPILER_RT_DEBUG=On. Let's fix this by #ifdef'ing it with #if SANITIZER_CAN_SLOW_UNWIND. See http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20150622/284294.html Reviewed at http://reviews.llvm.org/D10870 llvm-svn: 241261
* Add declaration of _ReadWriteBarrier. Fixes build of asan tests on Windows.Peter Collingbourne2015-07-021-0/+5
| | | | llvm-svn: 241227
* Re-apply r241217 with build fixes:Peter Collingbourne2015-07-022-17/+24
| | | | | | | - Disable building of the interceptor library on 64-bit Windows. - Mangle names in /alternatename directive for 32-bit Windows. llvm-svn: 241224
* Revert r241217, it breaks the build on Windows.Nico Weber2015-07-022-24/+17
| | | | llvm-svn: 241219
* ubsan: Port runtime library to (32- and 64-bit) Windows.Peter Collingbourne2015-07-022-17/+24
| | | | | | Differential Revision: http://reviews.llvm.org/D10856 llvm-svn: 241217
* [asan] Fix SanitizerCommon.PthreadDestructorIterations test on Android L.Evgeniy Stepanov2015-06-294-19/+31
| | | | | | | On Android L, TSD destructors run 8 times instead of 4. Back to 4 times on the current master branch (as well as on K). llvm-svn: 240992
* [libsanitizer] Replace ReadBinaryName() with ReadBinaryNameCached(),Alexander Potapenko2015-06-294-3/+16
| | | | | | | | | which caches the executable name upon the first invocation. This is necessary because Google Chrome (and potentially other programs) restrict the access to /proc/self/exe on linux. This change should fix https://code.google.com/p/chromium/issues/detail?id=502974 llvm-svn: 240960
* [asan] Disable glibc-specific code chunk on Android.Evgeniy Stepanov2015-06-261-1/+1
| | | | | | Fixes quarantine_size_mb.cc test on the Android bot. llvm-svn: 240854
* [asan] Link sanitizer_common tests on Android as -pie.Evgeniy Stepanov2015-06-261-0/+4
| | | | llvm-svn: 240825
* [libsanitizer] Delete the unused GetBinaryName() function.Alexander Potapenko2015-06-262-5/+0
| | | | llvm-svn: 240767
OpenPOWER on IntegriCloud