summaryrefslogtreecommitdiff
path: root/lib/tsan
AgeCommit message (Collapse)Author
2017-12-12[CMake] Support runtimes and monorepo layouts when looking for libcxxPetr Hosek
This also slightly refactors the code that's checking the directory presence which allows eliminating one unnecessary variable. Differential Revision: https://reviews.llvm.org/D40637 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@320446 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-06[TSan] Make more TSan interceptors symbolizer-aware.Alex Shlyapnikov
Summary: Switching the rest of intercepted allocs to InternalAlloc (well, except __libc_memalign) when current thread is 'in_symbolizer'. Symbolizer might (and does) use allocation functions other than malloc/calloc/realloc. posix_memalign is the one actually used, others switched just in case (since the failure is obscure and not obvious to diagnose). Reviewers: dvyukov Subscribers: llvm-commits, kubamracek Differential Revision: https://reviews.llvm.org/D40877 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@319929 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-04Move __tsan::Vector to __sanitizerKamil Rytarowski
Summary: The low-fat STL-like vector container will be reused in MSan. It is needed to implement an atexit(3) interceptor on NetBSD/amd64 in MSan. Sponsored by <The NetBSD Foundation> Reviewers: joerg, dvyukov, eugenis, vitalybuka, kcc Reviewed By: dvyukov Subscribers: kubamracek, mgorny, llvm-commits, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D40726 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@319650 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-29[sanitizer] Refactor how assembly files are handledKuba Mracek
This renames ASM_TSAN_SYMBOL and ASM_TSAN_SYMBOL_INTERCEPTOR to just ASM_SYMBOL and ASM_SYMBOL_INTERCEPTOR, because they can be useful in more places than just TSan. Also introduce a CMake function to add ASM sources to a target. Differential Revision: https://reviews.llvm.org/D40143 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@319339 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-29Defer StartBackgroundThread() and StopBackgroundThread() in TSanKamil Rytarowski
Summary: NetBSD cannot spawn new POSIX thread entities in early libc and libpthread initialization stage. Defer this to the point of intercepting the first pthread_create(3) call. This is the last change that makes Thread Sanitizer functional on NetBSD/amd64 without downstream patches. ******************** Testing Time: 64.91s ******************** Failing Tests (5): ThreadSanitizer-x86_64 :: dtls.c ThreadSanitizer-x86_64 :: ignore_lib5.cc ThreadSanitizer-x86_64 :: ignored-interceptors-mmap.cc ThreadSanitizer-x86_64 :: mutex_lock_destroyed.cc ThreadSanitizer-x86_64 :: vfork.cc Expected Passes : 290 Expected Failures : 1 Unsupported Tests : 83 Unexpected Failures: 5 Sponsored by <The NetBSD Foundation> Reviewers: joerg, eugenis, dvyukov, vitalybuka Reviewed By: dvyukov Subscribers: kubamracek, llvm-commits, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D40583 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@319305 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-28Support the setjmp(3) family of functions in TSan/NetBSDKamil Rytarowski
Summary: This change adds support for the setjmp(3)/longjmp(3) family of functions on NetBSD. There are three types of them on NetBSD: - setjmp(3) / longjmp(3) - sigsetjmp(3) / sigsetjmp(3) - _setjmp(3) / _longjmp(3) Due to historical and compat reasons the symbol names are mangled: - setjmp -> __setjmp14 - longjmp -> __longjmp14 - sigsetjmp -> __sigsetjmp14 - siglongjmp -> __siglongjmp14 - _setjmp -> _setjmp - _longjmp -> _longjmp This leads to symbol renaming in the existing codebase. There is no such symbol as __sigsetjmp/__longsetjmp on NetBSD Add a comment that GNU-style executable stack note is not needed on NetBSD. The stack is not executable without it. Sponsored by <The NetBSD Foundation> Reviewers: joerg, dvyukov, vitalybuka Reviewed By: dvyukov Subscribers: llvm-commits, kubamracek, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D40337 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@319189 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-28[PowerPC][tsan] Update tsan to handle changed memory layouts in newer kernelsBill Seurer
In more recent Linux kernels with 47 bit VMAs the layout of virtual memory for powerpc64 changed causing the thread sanitizer to not work properly. This patch adds support for 47 bit VMA kernels for powerpc64. (second part) Tested on several 4.x and 3.x kernel releases. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@319180 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-28Correct mangled_sp on NetBSD/amd64 in TSanKamil Rytarowski
The proper index is 6, not 2. Patch extracted from https://reviews.llvm.org/D40337 Reviewed and accepted by <dvyukov>. Sponsored by <The NetBSD Foundation> git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@319163 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-28Handle symbol renaming of sigaction for NetBSDKamil Rytarowski
Summary: NetBSD uses the __sigaction14 symbol name for historical and compat reasons for the sigaction(2) function name. Rename the interceptors and users of sigaction to sigaction_symname and reuse it in the code base. This change fixes 4 failing tests in TSan/NetBSD: - ThreadSanitizer-x86_64 :: signal_errno.cc - ThreadSanitizer-x86_64 :: signal_malloc.cc - ThreadSanitizer-x86_64 :: signal_sync2.cc - ThreadSanitizer-x86_64 :: signal_thread.cc Sponsored by <The NetBSD Foundation> Reviewers: joerg, vitalybuka, eugenis, dvyukov, kcc Reviewed By: dvyukov Subscribers: kubamracek, llvm-commits, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D40341 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@319160 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-21Correct NetBSD support in pthread_once(3)/TSanKamil Rytarowski
Summary: The pthread_once(3)/NetBSD type is built with the following structure: struct __pthread_once_st { pthread_mutex_t pto_mutex; int pto_done; }; Set the pto_done position as shifted by __sanitizer::pthread_mutex_t_sz from the beginning of the pthread_once struct. This corrects deadlocks when the pthread_once(3) function is used. Sponsored by <The NetBSD Foundation> Reviewers: joerg, dvyukov, vitalybuka Reviewed By: dvyukov Subscribers: llvm-commits, kubamracek, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D40262 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@318742 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-20[tsan] Fix sigaction implementation when it's called only to get handlerVitaly Buka
Reviewers: eugenis Subscribers: kubamracek, llvm-commits, krytarowski Differential Revision: https://reviews.llvm.org/D40272 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@318707 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-20Try to fix syntax for !NetBSD in TSAN_INTERCEPTORsKamil Rytarowski
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@318676 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-20Handle NetBSD specific indirection of libpthread functionsKamil Rytarowski
Summary: Correct handling of libpthread(3) functions in TSan/NetBSD: - pthread_cond_init(3), - pthread_cond_signal(3), - pthread_cond_broadcast(3), - pthread_cond_wait(3), - pthread_cond_destroy(3), - pthread_mutex_init(3), - pthread_mutex_destroy(3), - pthread_mutex_trylock(3), - pthread_rwlock_init(3), - pthread_rwlock_destroy(3), - pthread_rwlock_rdlock(3), - pthread_rwlock_tryrdlock(3), - pthread_rwlock_wrlock(3), - pthread_rwlock_trywrlock(3), - pthread_rwlock_unlock(3), - pthread_once(3). Code out of the libpthread(3) context uses the libc symbols that are prefixed with __libc_, for example: __libc_cond_init. This caused that these functions were invisible to sanitizers on NetBSD. Intercept the libc-specific ones and add them as NetBSD-specific aliases for the common pthread(3) ones. NetBSD needs to intercept both functions, as the regularly named ones are used internally in libpthread(3). Sponsored by <The NetBSD Foundation> Reviewers: joerg, dvyukov, vitalybuka Reviewed By: dvyukov Subscribers: kubamracek, llvm-commits, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D40243 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@318673 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-13Update TSan/ARM64 max VM to 0xfc0000000 to reflect a kernel change.Kuba Mracek
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@318103 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-13[tsan] Fix signal chainingVitaly Buka
Summary: Return saved values only if installed sigaction is our wrapper. Reviewers: eugenis, dvyukov Subscribers: llvm-commits, kubamracek Differential Revision: https://reviews.llvm.org/D39935 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@318082 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-13[tsan] Deadly signal handler for tsanVitaly Buka
Summary: https://github.com/google/sanitizers/issues/637 Reviewers: eugenis Subscribers: kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D39929 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@318078 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-13[PowerPC][tsan] Update tsan to handle changed memory layouts in newer kernelsBill Seurer
In more recent Linux kernels with 47 bit VMAs the layout of virtual memory for powerpc64 changed causing the thread sanitizer to not work properly. This patch adds support for 47 bit VMA kernels for powerpc64. Tested on several 4.x and 3.x kernel releases. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@318044 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-10[tsan] Move out more types to sanitizer_commonVitaly Buka
https://github.com/google/sanitizers/issues/637 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@317946 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-10[compiler-rt] Fix const and volatile qualifier warningsKuba Mracek
Building with a new clang produces a bunch of warnings about dropped 'const' and 'volatile' qualifiers on pointers. Let's fix them. Differential Revision: https://reviews.llvm.org/D39861 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@317929 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-10[tsan] Move code of sigaction_impl and signal_implVitaly Buka
They need to be after sanitizer_signal_interceptors.inc to use READ function Part of https://github.com/google/sanitizers/issues/637 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@317914 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-10[tsan] Extract sigaction_impl and signal_implVitaly Buka
Preparation for switching to sanitizer_signal_interceptors.inc Part of https://github.com/google/sanitizers/issues/637 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@317913 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-10[tsan] Use __sanitizer_siginfo from sanitizer_commonVitaly Buka
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@317872 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-10[sanitizer] Remove references and hide CommonSanitizerReportMutexVitaly Buka
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@317865 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-08Correct atexit(3) support in TSan/NetBSDKamil Rytarowski
Summary: The NetBSD specific implementation of cxa_atexit() does not preserve the 2nd argument if dso is equal to NULL. Changes: - Split paths of handling intercepted __cxa_atexit() and atexit(3). This affects all supported Operating Systems. - Add a local stack-like structure to hold the __cxa_atexit() context. atexit(3) is documented in the C standard as calling callback from the earliest to the oldest entry. This path also fixes potential ABI problem of passing an argument to a function from the atexit(3) callback mechanism. - Add new test to ensure LIFO style of atexit(3) callbacks: atexit3.cc Proposal to change the behavior of __cxa_atexit() in NetBSD has been rejected. With the above changes TSan/NetBSD with the current tsan_interceptors.cc can bootstrap into operation. Sponsored by <The NetBSD Foundation> Reviewers: vitalybuka, dvyukov, joerg, kcc, eugenis Reviewed By: dvyukov Subscribers: kubamracek, llvm-commits, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D39619 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@317735 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-07(NFC) Rename GetMax{,User}VirtualAddress.Evgeniy Stepanov
Future change will introduce GetMaxVirtualAddress that will not take the kernel area into account. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@317638 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-07tsan: allow usage of global vars with ctors in interceptorsDmitry Vyukov
We allow usage of global/per-thread data with non-trivial ctors/dtors throughout tsan code base by placing all global/per-thread data into Context/ThreadState and then explicitly constructing them with placement new. This greatly simplifies code by restricting the "linker initialized plague" to only these 2 objects. Do the same for interceptors data. This allows to use Vector instead of bunch of hand-written code in: https://reviews.llvm.org/D39619 Reviewed in: https://reviews.llvm.org/D39721 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@317587 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-04Fix CMake definitions of tsan runtime to make it installed by ↵Mehdi Amini
"install-compiler-rt" Summary: The PARENT_TARGET was correctly set under APPLE but not under linux. Reviewers: kubamracek, samsonov Subscribers: dberris, mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D39621 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@317391 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-03Late fixup in _lwp_exit on TSan/NetBSDKamil Rytarowski
Call DestroyThreadState() before REAL(_lwp_exit)(); This variation is less racy. Sponsored by <The NetBSD Foundation> git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@317369 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-03Correct detection of a thread terminationKamil Rytarowski
Summary: Stop using the Linux solution with pthread_key_create(3). This approach does not work on NetBSD, because calling the thread destructor is not the latest operation on a POSIX thread entity. NetBSD's libpthread still calls at least pthread_mutex_lock and pthread_mutex_unlock. Detect _lwp_exit(2) call as it is really the latest operation called from a detaching POSIX thread. This resolves one set of crashes observed in the Thread Sanitizer execution. Sponsored by <The NetBSD Foundation> Reviewers: joerg, kcc, vitalybuka, dvyukov, eugenis Reviewed By: vitalybuka Subscribers: llvm-commits, kubamracek, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D39618 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@317363 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-03Disable detection of on_exit()/TSan on NetBSDKamil Rytarowski
Summary: NetBSD does not ship with on_exit() function. Introduce TSAN_MAYBE_INTERCEPT_ON_EXIT. It looks like this addition fixes build for Darwin. Sponsored by <The NetBSD Foundation> Reviewers: vitalybuka, joerg, eugenis, dvyukov, kcc Reviewed By: vitalybuka Subscribers: llvm-commits, kubamracek, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D39617 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@317361 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-25Add NetBSD improvements in sanitizersKamil Rytarowski
Summary: Changes: * Add initial msan stub support. * Handle NetBSD specific pthread_setname_np(3). * NetBSD supports __attribute__((tls_model("initial-exec"))), define it in SANITIZER_TLS_INITIAL_EXEC_ATTRIBUTE. * Add ReExec() specific bits for NetBSD. * Simplify code and add syscall64 and syscall_ptr for !NetBSD. * Correct bunch of syscall wrappers for NetBSD. * Disable test/tsan/map32bit on NetBSD as not applicable. * Port test/tsan/strerror_r to a POSIX-compliant OSes. * Disable __libc_stack_end on NetBSD. * Disable ReadNullSepFileToArray() on NetBSD. * Define struct_ElfW_Phdr_sz, detected missing symbol by msan. * Change type of __sanitizer_FILE from void to char. This helps to reuse this type as an array. Long term it will be properly implemented along with SANITIZER_HAS_STRUCT_FILE setting to 1. * Add initial NetBSD support in lib/tsan/go/buildgo.sh. * Correct referencing stdout and stderr in tsan_interceptors.cc on NetBSD. * Document NetBSD x86_64 specific virtual memory layout in tsan_platform.h. * Port tests/rtl/tsan_test_util_posix.cc to NetBSD. * Enable NetBSD tests in test/msan/lit.cfg. * Enable NetBSD tests in test/tsan/lit.cfg. Sponsored by <The NetBSD Foundation> Reviewers: joerg, vitalybuka, eugenis, kcc, dvyukov Reviewed By: dvyukov Subscribers: #sanitizers, llvm-commits, kubamracek Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D39124 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@316591 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-25[tsan] Fix warnings in tsan_interceptors.cc from expansion of variadic macrosDmitry Vyukov
C99 technically requires the rest arguments to be used in C variadic macros. This presents a problem with the macro SCOPED_TSAN_INTERCEPTOR when func takes no arguments. This happens with the function pause. Like other void argument functions, we pass in a fake argument to avoid this warning. Author: Alex Langford (xiaobai) Reviewed in: https://reviews.llvm.org/D39151 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@316558 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-20[tsan] Add Mutex annotation flag for constant-initialized ↵Dmitry Vyukov
__tsan_mutex_linker_init behavior Add a new flag, _⁠_tsan_mutex_not_static, which has the opposite sense of _⁠_tsan_mutex_linker_init. When the new _⁠_tsan_mutex_not_static flag is passed to _⁠_tsan_mutex_destroy, tsan ignores the destruction unless the mutex was also created with the _⁠_tsan_mutex_not_static flag. This is useful for constructors that otherwise woud set _⁠_tsan_mutex_linker_init but cannot, because they are declared constexpr. Google has a custom mutex with two constructors, a "linker initialized" constructor that relies on zero-initialization and sets ⁠_⁠_tsan_mutex_linker_init, and a normal one which sets no tsan flags. The "linker initialized" constructor is morally constexpr, but we can't declare it constexpr because of the need to call into tsan as a side effect. With this new flag, the normal c'tor can set _⁠_tsan_mutex_not_static, the "linker initialized" constructor can rely on tsan's lazy initialization, and _⁠_tsan_mutex_destroy can still handle both cases correctly. Author: Greg Falcon (gfalcon) Reviewed in: https://reviews.llvm.org/D39095 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@316209 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-11Disable TSan tests on Android.Evgeniy Stepanov
They never passed. This change excludes them from 'check-all'. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@315512 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-11[sanitizer] Move the errno/ENOMEM allocator checks logic to separate .ccKostya Kortchinsky
Summary: This is a new attempt at D38706, which had 2 issues. The first one was that it broke TSan, because `sanitizer_errno.h` was not directly included in `tsan_mman.cc`. This fixes the include. The second one was that it broke the nolibc build, because `__errno_location` couldn't be found. This adds the new .cc to the libcdep list instead of the base one. Reviewers: alekseyshl Reviewed By: alekseyshl Subscribers: kubamracek, mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D38743 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@315509 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-04[sanitizer] Move cxx-abi library earlier in link flags.Evgeniy Stepanov
Summary: This change moves cxx-abi library in asan/ubsan/dd link command line ahead of other libraries, such as pthread/rt/dl/c/gcc. Given that cxx-abi may be the full libstdc++/libc++, it makes sense for it to be ahead of libc and libgcc, at least. The real motivation is Android, where in the arm32 NDK toolchain libstdc++.a is actually a linker script that tries to sneak LLVM's libunwind ahead of libgcc's. Wrong library order breaks unwinding. Reviewers: srhines, danalbert Subscribers: aemerson, kubamracek, mgorny, kristof.beyls, llvm-commits Differential Revision: https://reviews.llvm.org/D38520 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@314948 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-28tsan: handle signals in pause callDmitry Vyukov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@314384 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-21[tsan] Annotate function parameters with attribute 'noescape'.Akira Hatanaka
This commit annotates the block parameters of the following functions declared in compiler-rt with 'noescape': - dispatch_sync - dispatch_barrier_sync - dispatch_once - dispatch_apply This is needed to commit the patch that adds support for 'noescape' in clang (see https://reviews.llvm.org/D32210) since these functions are annotated with 'noescape' in the SDK header files. Differential Revision: https://reviews.llvm.org/D32210 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@313929 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-15tsan: respect LDFLAGS when build Go testDmitry Vyukov
Reported at: https://bugs.llvm.org/show_bug.cgi?id=27597 Some platforms need additional LDFLAGS when building the test (e.g. -no-pie). Respect LDFLAGS. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@313347 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-11[compiler-rt] Cleanup decoratorsVitaly Buka
Summary: Removed redundant End*() methods which defined same way. Removed redundant Warning() methods. Reviewers: eugenis Subscribers: kubamracek, llvm-commits, dberris Differential Revision: https://reviews.llvm.org/D37549 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@312950 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-30Add NetBSD support in tsan_interceptors.ccKamil Rytarowski
Summary: NetBSD is a POSIX-like BSD Operating System. Sponsored by <The NetBSD Foundation> Reviewers: joerg, kcc, vitalybuka, dvyukov, eugenis Reviewed By: dvyukov Subscribers: srhines, kubamracek, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D37305 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@312160 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-30Fix for TSan unit-tests:George Karpenkov
Previous refactoring has left unit-tests in a buggy state, where they were not launched at all. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@312094 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-25tsan: don't pass bogus PCs to __tsan_symbolize_externalDmitry Vyukov
See the added comment for an explanation. Reviewed in https://reviews.llvm.org/D37107 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@311768 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-18[TSan] Update test valuesVlad Tsyrklevich
Summary: This test was broken by the tail duplication logic being changed in r311139, update the test values and add a note about how to properly run a benchmark to verify that the values are safe to update. Reviewers: vitalybuka Reviewed By: vitalybuka Subscribers: dvyukov, kubamracek Differential Revision: https://reviews.llvm.org/D36889 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@311189 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-15[sanitizers CMake] NFC Refactor the logic for compiling and generating testsGeorge Karpenkov
into a function. Most CMake configuration under compiler-rt/lib/*/tests have almost-the-same-but-not-quite functions of the form add_X_[unit]tests for compiling and running the tests. Much of the logic is duplicated with minor variations across different sub-folders. This can harm productivity for multiple reasons: For newcomers, resulting CMake files are very large, hard to understand, and hide the intention of the code. Changes for enabling certain architectures end up being unnecessarily large, as they get duplicated across multiple folders. Adding new sub-projects requires more effort than it should, as a developer has to again copy-n-paste the configuration, and it's not even clear from which sub-project it should be copy-n-pasted. With this change the logic of compile-and-generate-a-set-of-tests is extracted into a function, which hopefully makes writing and reading CMake much easier. Differential Revision: https://reviews.llvm.org/D36116 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@310971 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-07[tsan] Fix format string in WriteMemoryProfileKuba Mracek
The current format string is broken and fails to parse. Differential Revision: https://reviews.llvm.org/D36192 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@310276 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-02[tsan] Check for pvalloc overlowKostya Kortchinsky
Summary: `CheckForPvallocOverflow` was introduced with D35818 to detect when pvalloc would wrap when rounding up to the next multiple of the page size. Add this check to TSan's pvalloc implementation. Reviewers: alekseyshl Reviewed By: alekseyshl Subscribers: llvm-commits, kubamracek Differential Revision: https://reviews.llvm.org/D36245 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@309897 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-28[sanitizers test CMake] further refactor testing CMake for tsanGeorge Karpenkov
TSan tests on Darwin first link all libraries into a static archive file. With this change, the linking is done once per all architecture, and previously the linking step was repeated per each architecture per each add_tsan_test call. Furthermore, the code is cleared up. Differential Revision: https://reviews.llvm.org/D35913 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@309406 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-28[sanitizer tests CMake] Factor out CMake logic for compiling sanitizer testsGeorge Karpenkov
Currently there's a large amount of CMake logic duplication for compiling sanitizer tests. If we add more sanitizers, the duplication will get even worse. This change factors out common compilation commands into a macro available to all sanitizers. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@309405 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-28Support libc++abi in addition to libstdc++Petr Hosek
This change adds sanitizer support for LLVM's libunwind and libc++abi as an alternative to libstdc++. This allows using the in tree version of libunwind and libc++abi which is useful when building a toolchain for different target. Differential Revision: https://reviews.llvm.org/D34501 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@309362 91177308-0d34-0410-b5e6-96231b3b80d8