summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/tsan/rtl
Commit message (Collapse)AuthorAgeFilesLines
...
* Revert r251918 ("[tsan] Fix build errors for TSan on OS X").Kuba Brecka2015-11-032-5/+1
| | | | llvm-svn: 251919
* [tsan] Fix build errors for TSan on OS XKuba Brecka2015-11-032-1/+5
| | | | | | | | | | This patch moves a few functions from `sanitizer_linux_libcdep.cc` to `sanitizer_posix_libcdep.cc` in order to use them on OS X as well. Plus a few more small build fixes. This is part of an effort to port TSan to OS X, and it's one the very first steps. Don't expect TSan on OS X to actually work or pass tests at this point. Differential Revision: http://reviews.llvm.org/D14235 llvm-svn: 251918
* [tsan] Port TSan interceptors on OS XKuba Brecka2015-11-031-103/+151
| | | | | | | | | | This patch modifies `tsan_interceptors.cc` to be buildable on OS X. Several of the intercepted methods are not available on OS X, so we need to `#if !SANITIZER_MAC` them. Plus a few other fixes, e.g. `pthread_yield` doesn't exist, let's use `internal_sched_yield` instead. This is part of an effort to port TSan to OS X, and it's one the very first steps. Don't expect TSan on OS X to actually work or pass tests at this point. Differential Revision: http://reviews.llvm.org/D14237 llvm-svn: 251916
* Revert "Apply modernize-use-default to compiler-rt."Alexey Samsonov2015-10-304-6/+10
| | | | | | | | | | | | This reverts commit r250823. Replacing at least some of empty constructors with "= default" variants is a semantical change which we don't want. E.g. __tsan::ClockBlock contains a union of large arrays, and it's critical for correctness and performance that we don't memset() these arrays in the constructor. llvm-svn: 251717
* Apply modernize-use-default to compiler-rt.Angel Garcia Gomez2015-10-204-10/+6
| | | | | | | | | | | | Summary: Replace empty bodies of default constructors and destructors with '= default'. Reviewers: klimek, bkramer Subscribers: alexfh, cfe-commits Differential Revision: http://reviews.llvm.org/D13892 llvm-svn: 250823
* [sanitizer] Move CheckVMASize after flag initializationAdhemerval Zanella2015-09-151-3/+1
| | | | llvm-svn: 247684
* [compiler-rt] [sanitizers] Add VMA size check at runtimeAdhemerval Zanella2015-09-111-0/+3
| | | | | | | | | This patch adds a runtime check for asan, dfsan, msan, and tsan for architectures that support multiple VMA size (like aarch64). Currently the check only prints a warning indicating which is the VMA built and expected against the one detected at runtime. llvm-svn: 247413
* tsan: speed up race deduplicationDmitry Vyukov2015-09-0311-108/+126
| | | | | | | | | | | | | | | | | | | | | | | Race deduplication code proved to be a performance bottleneck in the past if suppressions/annotations are used, or just some races left unaddressed. And we still get user complaints about this: https://groups.google.com/forum/#!topic/thread-sanitizer/hB0WyiTI4e4 ReportRace already has several layers of caching for racy pcs/addresses to make deduplication faster. However, ReportRace still takes a global mutex (ThreadRegistry and ReportMutex) during deduplication and also calls mmap/munmap (which take process-wide semaphore in kernel), this makes deduplication non-scalable. This patch moves race deduplication outside of global mutexes and also removes all mmap/munmap calls. As the result, race_stress.cc with 100 threads and 10000 iterations become 30x faster: before: real 0m21.673s user 0m5.932s sys 0m34.885s after: real 0m0.720s user 0m23.646s sys 0m1.254s http://reviews.llvm.org/D12554 llvm-svn: 246758
* [tsan] workaround for a crash in deadlock detector, bug ↵Kostya Serebryany2015-09-011-1/+1
| | | | | | https://github.com/google/sanitizers/issues/594 llvm-svn: 246592
* [compiler-rt] [tsan] Enable TSan for AArch64/42-bit VMAAdhemerval Zanella2015-08-282-4/+32
| | | | | | | | | | | This patch adds support for tsan on aarch64-linux with 42-bit VMA (current default config for 64K pagesize kernels). The support is enabled by defining the SANITIZER_AARCH64_VMA to 42 at build time for both clang/llvm and compiler-rt. The default VMA is 39 bits. It also enabled tsan for previous supported VMA (39). llvm-svn: 246330
* [sanitizer] Move sem_* to common interceptors.Evgeniy Stepanov2015-08-271-63/+6
| | | | llvm-svn: 246184
* [TSan] Support __sanitizer_set_death_callback().Alexey Samsonov2015-08-222-2/+2
| | | | llvm-svn: 245776
* [Sanitizers] Unify the semantics and usage of "exitcode" runtime flag across ↵Alexey Samsonov2015-08-214-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | all sanitizers. Summary: Merge "exitcode" flag from ASan, LSan, TSan and "exit_code" from MSan into one entity. Additionally, make sure sanitizer_common now uses the value of common_flags()->exitcode when dying on error, so that this flag will automatically work for other sanitizers (UBSan and DFSan) as well. User-visible changes: * "exit_code" MSan runtime flag is now deprecated. If explicitly specified, this flag will take precedence over "exitcode". The users are encouraged to migrate to the new version. * __asan_set_error_exit_code() and __msan_set_exit_code() functions are removed. With few exceptions, we don't support changing runtime flags during program execution - we can't make them thread-safe. The users should use __sanitizer_set_death_callback() that would call _exit() with proper exit code instead. * Plugin tools (LSan and UBSan) now inherit the exit code of the parent tool. In particular, this means that ASan would now crash the program with exit code "1" instead of "23" if it detects leaks. Reviewers: kcc, eugenis Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D12120 llvm-svn: 245734
* tsan: don't report any bugs when report_bugs=0 flag is setDmitry Vyukov2015-08-211-0/+2
| | | | llvm-svn: 245720
* -Wdeprecated: Use noexcept rather than throw() where supportedDavid Blaikie2015-08-101-4/+4
| | | | | | | | | | Summary: I've copy/pasted the LLVM_NOEXCEPT definition macro goo from LLVM's Compiler.h. Is there somewhere I should put this in Compiler RT? Is there a useful header to define/share things like this? Reviewers: samsonov Differential Revision: http://reviews.llvm.org/D11780 llvm-svn: 244453
* [tsan] Enable tsan for aarch64Adhemerval Zanella2015-08-054-7/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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,tsan,msan] move the memcmp interceptor from asan/tsan to ↵Kostya Serebryany2015-07-291-16/+0
| | | | | | 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
* tsan: fix shift overflowDmitry Vyukov2015-07-261-3/+3
| | | | | | | 3<<30 fits into 32-bit unsigned, but does not fit into int. Found by ubsan. llvm-svn: 243241
* __tsan::ThreadCreate takes incorrect value for detached argumentIsmail Pazarbasi2015-07-241-1/+9
| | | | | | | | | | | | | | | Summary: PTHREAD_CREATE_DETACHED has a different value on Mac OS X. Since both PTHREAD_CREATE_JOINABLE and PTHREAD_CREATE_DETACHED are non-zero, `__tsan::ThreadCreate` always creates detached threads. Reviewers: kcc, samsonov, glider Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D10606 llvm-svn: 243151
* [sanitizer] Implement logging to syslog.Evgeniy Stepanov2015-07-231-1/+1
| | | | | | | | | | | | | | | | | 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
* [sanitizer] Implement include_if_exists with process name substitution.Evgeniy Stepanov2015-07-211-1/+1
| | | | | | | | | 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
* [TSan] Fix dl_iterate_phdr callback for the case when info->dlpi_name is ↵Alexey Samsonov2015-07-101-4/+8
| | | | | | overwritten by user. llvm-svn: 241876
* tsan: fix handling of condition variable destructionDmitry Vyukov2015-06-301-2/+2
| | | | | | | | | | | | POSIX states that "It shall be safe to destroy an initialized condition variable upon which no threads are currently blocked", and later clarifies "A condition variable can be destroyed immediately after all the threads that are blocked on it are awakened) (in examples section). Tsan reported such destruction as a data race. Fixes https://llvm.org/bugs/show_bug.cgi?id=23616 Reviewed in http://reviews.llvm.org/D10693 llvm-svn: 241082
* [asan] Fix SanitizerCommon.PthreadDestructorIterations test on Android L.Evgeniy Stepanov2015-06-291-1/+1
| | | | | | | 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
* tsan: implement suppressions for top frame onlyDmitry Vyukov2015-06-292-13/+22
| | | | | | | | | | The new suppression type is called "race_top" and is matched only against top frame in report stacks. This is required for situations when we want to suppress a race in a "thread pool" or "event loop" implementation. If we simply use "race:ThreadPool::Execute" suppression, that can suppress everything in the program. Reviewed in http://reviews.llvm.org/D10686 llvm-svn: 240949
* tsan: fix handling of dup2 Dmitry Vyukov2015-06-253-14/+32
| | | | | | | | | | | | Previously tsan modelled dup2(oldfd, newfd) as write on newfd. We hit several cases where the write lead to false positives: 1. Some software dups a closed pipe in place of a socket before closing the socket (to prevent races actually). 2. Some daemons dup /dev/null in place of stdin/stdout. On the other hand we have not seen cases when write here catches real bugs. So model dup2 as read on newfd instead. llvm-svn: 240687
* tsan: merge function definition and declarationDmitry Vyukov2015-06-251-10/+4
| | | | llvm-svn: 240633
* tsan: fix false positive between dlopen and dl_iterate_phdrDmitry Vyukov2015-06-241-0/+41
| | | | | | | | | We see false reports between dlopen and dl_iterate_phdr. This happens because tsan does not see dynamic linker internal synchronization. Unpoison module names in dl_iterate_phdr callback. llvm-svn: 240576
* tsan: don't print external PCs in reportsDmitry Vyukov2015-06-242-5/+1
| | | | | | They are meaningless. llvm-svn: 240539
* tsan: fix unbounded memory consumption for large mallocsDmitry Vyukov2015-06-241-0/+17
| | | | | | | This happens only in corner cases, but we observed this on a real app. See the test for description of the exact scenario that lead to unbounded memory consumption. llvm-svn: 240535
* tsan: mark meta shadow as NOHUGEPAGEDmitry Vyukov2015-06-181-0/+4
| | | | | | | | Meta shadow is compressing and we don't flush it, so it makes sense to mark it as NOHUGEPAGE to not over-allocate memory. On one program it reduces memory consumption from 5GB to 2.5GB. llvm-svn: 240028
* [ASan] Make binary name reader cross-platform.Yury Gribov2015-06-041-0/+1
| | | | | | Differential Revision: http://reviews.llvm.org/D10213 llvm-svn: 239020
* [sanitizer_common] Added VS-style output for source locationsFilipe Cabecinhas2015-06-041-0/+1
| | | | | | | | | | | | | | | | | | | | | Summary: With this patch, we have a flag to toggle displaying source locations in the regular style: file:line:column or Visual Studio style: file(line,column) This way, they get picked up on the Visual Studio output window and one can double-click them to get to that file location. Reviewers: samsonov, rnk Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D10113 llvm-svn: 239000
* Add descriptive names to sanitizer entries in /proc/self/maps. Helps debugging.Evgeniy Stepanov2015-05-293-11/+15
| | | | | | | | | | | | | | | | | | This is done by creating a named shared memory region, unlinking it and setting up a private (i.e. copy-on-write) mapping of that instead of a regular anonymous mapping. I've experimented with regular (sparse) files, but they can not be scaled to the size of MSan shadow mapping, at least on Linux/X86_64 and ext3 fs. Controlled by a common flag, decorate_proc_maps, disabled by default. This patch has a few shortcomings: * not all mappings are annotated, especially in TSan. * our handling of memset() of shadow via mmap() puts small anonymous mappings inside larger named mappings, which looks ugly and can, in theory, hit the mapping number limit. llvm-svn: 238621
* [sanitizer] More string interceptors: strstr, strcasestr, strspn, strcspn, ↵Yury Gribov2015-05-281-11/+0
| | | | | | | | | | strpbrk. Patch by Maria Guseva. Differential Revision: http://reviews.llvm.org/D9017 llvm-svn: 238406
* [sanitizer] Recognize static TLS in __tls_get_addr interceptor.Evgeniy Stepanov2015-05-161-0/+8
| | | | | | | Current code tries to find the dynamic TLS header to the left of the TLS block without checking that it's not a static TLS allocation. llvm-svn: 237495
* tsan: add memory access functions that accept pcDmitry Vyukov2015-05-053-0/+54
| | | | | | This is required for Java support, as real PCs don't work for Java. llvm-svn: 236484
* tsan: fix a bug memory access handlingDmitry Vyukov2015-04-281-1/+2
| | | | | | | | | | We incorrectly replaced shadow slots when the new value is not stronger than the old one. The bug can lead to false negatives. The bug was detected by Go race test suite: https://github.com/golang/go/issues/10589 llvm-svn: 236008
* [TSan] Attempt to fix old Makefile build.Alexey Samsonov2015-04-281-1/+1
| | | | llvm-svn: 235960
* Export __ubsan_* symbols from MSan and TSan runtimes.Alexey Samsonov2015-04-281-0/+1
| | | | llvm-svn: 235958
* Allow UBSan+MSan and UBSan+TSan combinations (Clang part).Alexey Samsonov2015-04-283-6/+32
| | | | | | | | Embed UBSan runtime into TSan and MSan runtimes in the same as we do in ASan. Extend UBSan test suite to also run tests for these combinations. llvm-svn: 235954
* [TSan] Move new/delete interceptors into a separate source file. NFC.Alexey Samsonov2015-04-273-93/+126
| | | | llvm-svn: 235906
* tsan: fix handling of pthread_detachDmitry Vyukov2015-04-201-1/+8
| | | | | | | | | | Fixes https://llvm.org/bugs/show_bug.cgi?id=23235 If pthread_create is followed by pthread_detach, the new thread may not acquire synchronize with the parent thread. llvm-svn: 235293
* tsan: fix parsing of second_deadlock_stack flagDmitry Vyukov2015-04-141-0/+4
| | | | | | | It was broken during flag parsing refactoring. Enable test for the flag. llvm-svn: 234878
* Use 'override/final' instead of 'virtual' for overridden methodsAlexander Kornienko2015-04-112-13/+9
| | | | | | | | | | | | The patch is generated using clang-tidy misc-use-override check. This command was used: tools/clang/tools/extra/clang-tidy/tool/run-clang-tidy.py \ -checks='-*,misc-use-override' -header-filter='llvm|clang' -j=32 -fix \ -format llvm-svn: 234680
* Split Mprotect into MmapNoAccess and MprotectNoAccess to be more portableTimur Iskhodzhanov2015-04-101-1/+1
| | | | | | | On Windows, we have to know if a memory to be protected is mapped or not. On POSIX, Mprotect was semantically different from mprotect most people know. llvm-svn: 234602
* Use WriteToFile instead of internal_write in non-POSIX codeTimur Iskhodzhanov2015-04-091-1/+1
| | | | llvm-svn: 234487
* Move some POSIX-specific functions from sanitizer_libc.h to a new ↵Timur Iskhodzhanov2015-04-081-0/+1
| | | | | | sanitizer_posix.h llvm-svn: 234418
* [Sanitizers] Make OpenFile more portableTimur Iskhodzhanov2015-04-081-3/+3
| | | | llvm-svn: 234410
* tsan: handle async signals while blocked in pthread_cond_waitDmitry Vyukov2015-04-083-8/+33
| | | | | | Fixes https://code.google.com/p/thread-sanitizer/issues/detail?id=91 llvm-svn: 234394
OpenPOWER on IntegriCloud