summaryrefslogtreecommitdiffstats
path: root/compiler-rt
Commit message (Collapse)AuthorAgeFilesLines
* [UBSan] Implement runtime suppressions (PR25066).Alexey Samsonov2015-12-186-51/+151
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Add the ability to suppress UBSan reports for files/functions/modules at runtime. The user can now pass UBSAN_OPTIONS=suppressions=supp.txt with the contents of the form: signed-integer-overflow:file-with-known-overflow.cpp alignment:function_doing_unaligned_access vptr:shared_object_with_vptr_failures.so Suppression categories match the arguments passed to -fsanitize= flag (although, see below). There is no overhead if suppressions are not provided. Otherwise there is extra overhead for symbolization. Limitations: 1) sometimes suppressions need debug info / symbol table to function properly (although sometimes frontend generates enough info to do the match). 2) it's only possible to suppress recoverable UB kinds - if you've built the code with -fno-sanitize-recover=undefined, suppressions will not work. 3) categories are fine-grained check kinds, not groups like "undefined" or "integer", so you can't write "undefined:file_with_ub.cc". Reviewers: rsmith, kcc Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D15363 llvm-svn: 256018
* Revert r255996 ("[tsan] Add a DCHECK to verify __tsan_read* and __tsan_write ↵Kuba Brecka2015-12-183-46/+62
| | | | | | | | function aren't called from ScopedInterceptor"). There are some test failures on the Linux buildbots. llvm-svn: 255997
* [tsan] Add a DCHECK to verify __tsan_read* and __tsan_write function aren't ↵Kuba Brecka2015-12-183-62/+46
| | | | | | | | | | called from ScopedInterceptor Interceptors using ScopedInteceptor should never call into user's code before the ScopedInterceptor is out of scope (and its destructor is called). Let's add a DCHECK to enforce that. Differential Revision: http://reviews.llvm.org/D15381 llvm-svn: 255996
* [tsan] Fix scoping of ScopedInteceptor in libdispatch supportKuba Brecka2015-12-183-0/+36
| | | | | | | | Some interceptors in tsan_libdispatch_mac.cc currently wrongly use TSAN_SCOPED_INTERCEPTOR/ScopedInterceptor. Its constructor can start ignoring memory accesses, and the destructor the stops this -- however, e.g. dispatch_sync can call user's code, so the ignoring will extend to user's code as well. This is not expected and we should only limit the scope of ScopedInterceptor to TSan code. This patch introduces annotations that mark the beginning and ending of a callback into user's code. Differential Revision: http://reviews.llvm.org/D15419 llvm-svn: 255995
* Fix typo in MSC pathXinliang David Li2015-12-171-1/+1
| | | | llvm-svn: 255938
* [PGO] cleanup: unify prefix for portability macrosXinliang David Li2015-12-1612-80/+83
| | | | llvm-svn: 255748
* [cfi] Exclude ubsan runtime library from non-diag CFI builds.Evgeniy Stepanov2015-12-162-3/+21
| | | | | | | Split the CFI runtime in two: cfi and cfi_diag. The latter includes UBSan runtime to allow printing diagnostics. llvm-svn: 255735
* [cfi] Fix GCC build.Evgeniy Stepanov2015-12-161-2/+2
| | | | llvm-svn: 255733
* [cfi] Limit cross-dso tests to Linux.Evgeniy Stepanov2015-12-161-0/+9
| | | | | | Mac is missing the driver support to link the CFI runtime library. llvm-svn: 255730
* [cfi] Fix shadow sanity check.Evgeniy Stepanov2015-12-161-4/+5
| | | | | | | The current check may break if the starting address in fill_shadow is not page-aligned. llvm-svn: 255725
* Cross-DSO control flow integrity (compiler-rt part).Evgeniy Stepanov2015-12-1511-3/+511
| | | | | | | | | | | | | | | | | | This is an initial version of the runtime cross-DSO CFI support library. It contains a number of FIXMEs, ex. it does not support the diagnostic mode nor dlopen/dlclose, but it works and can be tested. Diagnostic mode, in particular, would require some refactoring (we'd like to gather all CFI hooks in the UBSan library into one function so that we could easier pass the diagnostic information down to __cfi_check). It will be implemented later. Once the diagnostic mode is in, I plan to create a second test configuration to run all existing tests in both modes. For now, this patch includes only a few new cross-DSO tests. llvm-svn: 255695
* [PGO] Improve prof library portabilityXinliang David Li2015-12-153-6/+8
| | | | | | | | | Patch by: Johan Engelen Introduce LLVM_LIBRARY_WEAK macro. Define LLVM_LIBRARY_WEAK and LLVM_LIBRARY_VISIBIITY for MSVC llvm-svn: 255688
* [PGO] Open file with explict binary modeXinliang David Li2015-12-151-1/+1
| | | | | | | | | | Patch by: Johan Engelen On windows, opening in text mode will result in line ending chars to be appended leading to profile corruption. llvm-svn: 255684
* [asan] try to fix ARM botsKostya Serebryany2015-12-151-0/+2
| | | | llvm-svn: 255594
* [asan] add option: handle_sigillKostya Serebryany2015-12-155-0/+32
| | | | llvm-svn: 255588
* [msan] Intercept ctermid, ctermid_r.Evgeniy Stepanov2015-12-143-0/+47
| | | | llvm-svn: 255566
* [TSAN, PPC64] Fix obvious typo of supported virtual memory sizesBill Schmidt2015-12-141-1/+1
| | | | llvm-svn: 255507
* [compiler-rt] [msan] Variadic support for AArch64Adhemerval Zanella2015-12-142-4/+1
| | | | | | | | | Now with variadic support for msan on aarch6 there is no need for XFAIL signal_stress_test anymore. Also to garantee aligned stores for the FP/SIMD arguments enforce the '__msan_va_arg_tls' alignment to sizeof the SIMD register (16). llvm-svn: 255496
* [tsan] Update dispatch_group support to avoid using a disposed group objectKuba Brecka2015-12-142-0/+62
| | | | | | | | | | We're using the dispatch group itself to synchronize (to call Release() and Acquire() on it), but in dispatch group notifications, the group can already be disposed/deallocated. This causes a later assertion failure at `DCHECK_EQ(*meta, 0);` in `MetaMap::AllocBlock` when the same memory is reused (note that the failure only happens in debug builds). Fixing this by retaining the group and releasing it in the notification. Adding a stress test case that reproduces this. Differential Revision: http://reviews.llvm.org/D15380 llvm-svn: 255494
* [compiler-rt] [safestack] Silent overflow.c test on aarch64Adhemerval Zanella2015-12-142-0/+7
| | | | | | | | | | | | The safestack overflow.c test is currently failing on an aarch64 buildbot with a segfault, but it is currently passing on other configuration. This patch silent the issue for now on aarch64 by setting to all supported architectures the 'stable-runtime' configure and set the test to requires it. llvm-svn: 255491
* [compiler-rt] [safestack] Enable for aarch64Adhemerval Zanella2015-12-112-2/+7
| | | | | | | | | | | | | This patch enables the safestack for aarch64. The frontend already have it enabled on all supported architectures and no adjustment is required in llvm. The compiler-rt adjustments are basically add on the cmake configuration to enable the tests and fix the pagesize debug check by getting its value at runtime (since aarch64 has multiple pagesize depending of kernel configuration). llvm-svn: 255345
* [PGO] add a test case in profiler runtimeXinliang David Li2015-12-111-0/+135
| | | | | | | | Add a test case to cover profile dumping of functions with no value sites, functions with value sites but no dynamic VP data, and functions with runtime VP data. llvm-svn: 255327
* [PGO] Split value profiling runtime into its own fileXinliang David Li2015-12-106-221/+245
| | | | | | | | | Value profile runtime depends on libc which breaks buffer API implemenation with current file organization. Test case is also updated to check more symbols. llvm-svn: 255294
* Sync up with masterXinliang David Li2015-12-101-0/+1
| | | | llvm-svn: 255293
* [PGO] Move impl specific decl to InstrProfilingInternal.h (NFC)Xinliang David Li2015-12-103-3/+3
| | | | llvm-svn: 255290
* [TSan] Try harder to avoid compiler-generated memcpy calls.Alexey Samsonov2015-12-103-10/+11
| | | | | | | | check_memcpy test added in r254959 fails on some configurations due to memcpy() calls inserted by Clang. Try harder to avoid them by using internal_memcpy() where applicable. llvm-svn: 255287
* [PGO] Move target-dependent macro to InstrProfilingPort.h (NFC)Xinliang David Li2015-12-102-5/+9
| | | | llvm-svn: 255285
* [PGO] Header file cleanup (NFC)Xinliang David Li2015-12-102-41/+55
| | | | | | | | | InstrProfiling.h file declares profile runtime public APIs. It has become a dumping place for many different things, which needs cleanups. In this change, core type declarations and portability macros are moved to a new file InstrProfilingPort.h. llvm-svn: 255270
* [PGO] use COMPILER_RT_HAS_ATOMTICS macroXinliang David Li2015-12-101-4/+4
| | | | llvm-svn: 255266
* [power] Fix test case target checksBill Seurer2015-12-103-6/+6
| | | | | | | Several test cases that used to fail on both power LE and BE now run correctly on LE. llvm-svn: 255262
* [asan] Use atomic_uintptr_t instead of atomic_uint64_t in SuppressErrorReport.Yury Gribov2015-12-101-2/+2
| | | | | | | | | Some targets (e.g. Mips) don't have 64-bit atomics, so using atomic_uint64_t leads to build failures. Use atomic_uintptr_t to avoid such errors. Patch by Max Ostapenko. llvm-svn: 255242
* [asan] Move halt_on_error_suppress_equal_pcs.cc to Posix directory.Yury Gribov2015-12-101-0/+0
| | | | | | Patch by Max Ostapenko. llvm-svn: 255230
* [asan] Suppress duplicated errors in ASan recovery mode.Yury Gribov2015-12-105-2/+83
| | | | | | | | Patch by Max Ostapenko. Differential Revision: http://reviews.llvm.org/D15080 llvm-svn: 255228
* Replace cmake check for printf with a check for fopen.Evgeniy Stepanov2015-12-101-1/+1
| | | | | | | Printf is a builtin, and the check fails with -Werror because of a clang warning about an incompatible redeclaration. llvm-svn: 255189
* Revert "[CMake] Provide options for toggling on and off various runtime ↵Chris Bieneman2015-12-1010-98/+113
| | | | | | | | libraries." This reverts r255170. This change caused a bunch of bot failures and needs to be revised. llvm-svn: 255184
* [CMake] [Darwin] Log architecture test failures to CMakeError.logChris Bieneman2015-12-101-0/+4
| | | | | | This makes debugging configuration issues way easier. llvm-svn: 255183
* [PGO] Add cmake check to determine atomics op availabilityXinliang David Li2015-12-091-0/+30
| | | | | | | | | This allows the profile runtime to pick the right impl for cmp&swap for a given target. Differential Revision: http://reviews.llvm.org/D15248 llvm-svn: 255173
* [CMake] Provide options for toggling on and off various runtime libraries.Chris Bieneman2015-12-0910-113/+98
| | | | | | | | | | | | | | | Summary: Rather than having to add new "experimental" options each time someone wants to work on bringing a sanitizer to a new platform, this patch makes options for all of them. The default values for the options are set by the platform checks that would have enabled them, but they can be overridden on or off. Reviewers: kubabrecka, samsonov Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D14846 llvm-svn: 255170
* [tsan] Move emptyset/oldset to ThreadSignalContext.Yabin Cui2015-12-091-5/+6
| | | | | | | | | | | | | | Summary: Android doesn't support __thread keyword. So move emptyset/oldset from THREADLOCAL to ThreadSignalContext. Reviewers: kcc, eugenis, dvyukov Subscribers: llvm-commits, tberghammer, danalbert Differential Revision: http://reviews.llvm.org/D15299 llvm-svn: 255168
* [tsan] Use REAL(malloc) instead of __libc_malloc for Android.Yabin Cui2015-12-092-2/+11
| | | | | | | | | | | | | | | Summary: Android doesn't have __libc_malloc and related allocation functions. As its dynamic linker doesn't use malloc, so we can use REAL(malloc) to replace __libc_malloc safely. Reviewers: kcc, eugenis, dvyukov Subscribers: llvm-commits, tberghammer, danalbert, srhines Differential Revision: http://reviews.llvm.org/D15297 llvm-svn: 255167
* Fix the target specific "-msse3" flag check in CMake. NFCSumanth Gundapaneni2015-12-091-9/+1
| | | | | | | | | | | msse3 is a target dependent flag and must be guarded as check_cxx_compiler_flag() checks only for compiler error messages and ignores warnings. Earlier COMPILER_RT_HAS_MSSE3_FLAG is set to "TRUE" for all targets as clang emits warnings and the compilation spits unnecessary warnings for non-X86 targets. This issue is fixed by coupling the flag with "-Werror" Differential Revision: http://reviews.llvm.org/D15362 llvm-svn: 255165
* [tsan] Disable interceptors not supported in Android.Yabin Cui2015-12-092-17/+21
| | | | | | | | | | Reviewers: kcc, eugenis, dvyukov Subscribers: llvm-commits, tberghammer, danalbert, srhines Differential Revision: http://reviews.llvm.org/D15295 llvm-svn: 255164
* asan_win_dynamic_runtime_thunk.cc: declare atexitHans Wennborg2015-12-091-0/+1
| | | | | | | MSVC apparently makes atexit available even without including stdlib.h, but clang-cl does not. This makes the file build also with clang-cl. llvm-svn: 255160
* [TSan] Try harder to avoid compiler-generated memset calls.Alexey Samsonov2015-12-095-6/+8
| | | | | | | | | | check_memcpy test added in r254959 fails on some configurations due to memset() calls inserted by Clang. Try harder to avoid them: * Explicitly use internal_memset() instead of empty braced-initializer. * Replace "new T()" with "new T", as the former generates zero-initialization for structs in C++11. llvm-svn: 255136
* [tsan] Define sigaction_t for Android.Yabin Cui2015-12-091-0/+12
| | | | | | | | | | Reviewers: kcc, eugenis, dvyukov Subscribers: llvm-commits, tberghammer, danalbert, srhines Differential Revision: http://reviews.llvm.org/D15298 llvm-svn: 255135
* Avoid extended mnemonic 'mfvrsave' in assembly codeBill Schmidt2015-12-091-2/+2
| | | | llvm-svn: 255116
* [UBSan] Clarify the way we disable de-duplication of reports from ↵Alexey Samsonov2015-12-094-24/+38
| | | | | | | | | | | unrecoverable handlers. Let unrecoverable handlers be responsbile for killing the program with Die(), and let functions which print the error report know if it's going to happen. Re-write the comments to describe the situation. llvm-svn: 255081
* Adjust line numbers to account for new XFAIL commentsReid Kleckner2015-12-081-2/+2
| | | | llvm-svn: 255076
* [UBSan] Remove "-fsanitize=" prefix from ubsan_checks.inc. NFC.Alexey Samsonov2015-12-083-34/+26
| | | | llvm-svn: 255075
* [UBSan] Always calculate ErrorType (kind of UB) before printing a report.Alexey Samsonov2015-12-082-42/+65
| | | | | | | | | Currently, this is an NFC. However, knowing out the kind of error report before we bring up all the reporting machinery (implemented in ScopedReport class) is important once we teach UBSan runtime suppressions. llvm-svn: 255074
OpenPOWER on IntegriCloud