summaryrefslogtreecommitdiff
path: root/lib/tsan
AgeCommit message (Collapse)Author
2018-07-20sanitizers: consistently check result of MmapFixedNoReserveDmitry Vyukov
MmapFixedNoReserve does not terminate process on failure. Failure to check its result and die will always lead to harder to debug crashes later in execution. This was observed in Go processes due to some address space conflicts. Consistently check result of MmapFixedNoReserve. While we are here also add warn_unused_result attribute to prevent such bugs in future and change return type to bool as that's what all callers want. Reviewed in https://reviews.llvm.org/D49367 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@337531 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-10[CMake] Add compiler-rt header files to the list of sources for targetsDan Liew
when building with an IDE so that header files show up in the UI. This massively improves the development workflow in IDEs. To implement this a new function `compiler_rt_process_sources(...)` has been added that adds header files to the list of sources when the generator is an IDE. For non-IDE generators (e.g. Ninja/Makefile) no changes are made to the list of source files. The function can be passed a list of headers via the `ADDITIONAL_HEADERS` argument. For each runtime library a list of explicit header files has been added and passed via `ADDITIONAL_HEADERS`. For `tsan` and `sanitizer_common` a list of headers was already present but it was stale and has been updated to reflect the current state of the source tree. The original version of this patch used file globbing (`*.{h,inc,def}`) to find the headers but the approach was changed due to this being a CMake anti-pattern (if the list of headers changes CMake won't automatically re-generate if globbing is used). The LLVM repo contains a similar function named `llvm_process_sources()` but we don't use it here for several reasons: * It depends on the `LLVM_ENABLE_OPTION` cache variable which is not set in standalone compiler-rt builds. * We would have to `include(LLVMProcessSources)` which I'd like to avoid because it would include a bunch of stuff we don't need. Differential Revision: https://reviews.llvm.org/D48422 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@336663 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-28[TSan] More detailed error message on failed sahdow memory madviseAlex Shlyapnikov
Summary: Report errno value on failed shadow memory madvise attempt and add a hint message with the possible workaround. Reviewers: eugenis Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D48668 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@335928 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-27[CMake] Tidy up the organisation of compiler-rt when configured as a standaloneDan Liew
build with an IDE (e.g. Xcode) as the generator. Previously the global `USE_FOLDERS` property wasn't set in standalone builds leading to existing settings of FOLDER not being respected. In addition to this there were several targets that appeared at the top level that were not interesting and clustered up the view. These have been changed to be displayed in "Compiler-RT Misc". Now when an Xcode project is generated from a standalone compiler-rt build the project navigator is much less cluttered. The interesting libraries should appear in "Compiler-RT Libraries" in the IDE. Differential Revision: https://reviews.llvm.org/D48378 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@335728 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-22tsan: fix deficiency in MutexReadOrWriteUnlockDmitry Vyukov
MutexUnlock uses ReleaseStore on s->clock, which is the right thing to do. However MutexReadOrWriteUnlock for writers uses Release on s->clock. Make MutexReadOrWriteUnlock also use ReleaseStore for consistency and performance. Unfortunately, I don't think any test can detect this as this only potentially affects performance. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@335322 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-21[tsan] Use DARWIN_osx_LINK_FLAGS when building unit tests to match ASan ↵Kuba Mracek
behavior. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@335265 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-20[TSan] fix build and couple of unit tests on FreeBSDDavid Carlier
Similarly to Msan adding -pie provokes linkage issue, was spotted with pie_test.cc Set to XFAIL for couple of unit tests. Reviewers: vitalybuka, krytarowski, dim Reviewed By: vitalybuka Differential Revision: https://reviews.llvm.org/D48317 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@335166 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-18[TSan] Report proper error on allocator failures instead of CHECK(0)-ingAlex Shlyapnikov
Summary: Following up on and complementing D44404 and other sanitizer allocators. Currently many allocator specific errors (OOM, for example) are reported as a text message and CHECK(0) termination, no stack, no details, not too helpful nor informative. To improve the situation, detailed and structured common errors were defined and reported under the appropriate conditions. Common tests were generalized a bit to cover a slightly different TSan stack reporting format, extended to verify errno value and returned pointer value check is now explicit to facilitate debugging. Reviewers: dvyukov Subscribers: srhines, kubamracek, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D48087 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@334975 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-13[TSan] Fix madvise(MADV_NOHUGEPAGE) for meta shadow memoryAlex Shlyapnikov
Summary: Move madvise(MADV_NOHUGEPAGE) for the meta shadow memory after the meta shadow memory is mapped (currently it silently fails with ENOMEM). Add a diagnostic message to detect similar problems in the future. Reviewers: dvyukov Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D48097 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@334624 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-11[sanitizer] Add fgets, fputs and puts into sanitizer_commonPeter Wu
Summary: Add fgets, fputs and puts to sanitizer_common. This adds ASAN coverage for these functions, extends MSAN support from fgets to fputs/puts and extends TSAN support from puts to fputs. Fixes: https://github.com/google/sanitizers/issues/952 Reviewed By: vitalybuka Differential Revision: https://reviews.llvm.org/D46545 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@334450 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-05Introduce CheckASLR() in sanitizersKamil Rytarowski
Summary: At least the ASan, MSan, TSan sanitizers require disabled ASLR on a NetBSD. Introduce a generic CheckASLR() routine, that implements a check for the current process. This flag depends on the global or per-process settings. There is no simple way to disable ASLR in the build process from the level of a sanitizer or during the runtime execution. With ASLR enabled sanitizers that operate over the process virtual address space can misbehave usually breaking with cryptic messages. This check is dummy for !NetBSD. Sponsored by <The NetBSD Foundation> Reviewers: vitalybuka, joerg Reviewed By: vitalybuka Subscribers: cryptoad, kubamracek, llvm-commits, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D47442 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@333985 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-04[TSan] FreeBSD / intercept thr_exitDavid Carlier
intercepting thr_exit to terminate threads under FreeBSD. Unblock few unit tests hanging. Reviewers: krytarowski, vitalybuka, emaste Reviewed By: dvyukov Differential Revision: https://reviews.llvm.org/D47677 M lib/tsan/rtl/tsan_interceptors.cc git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@333870 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-10[tsan] Add debugging API to retrieve the "external tag" from reportsKuba Mracek
Differential Revision: https://reviews.llvm.org/D46661 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@332048 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-09[sanitizer] Remove unneeded blank linesVitaly Buka
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@331831 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-09[sanitizer] Update .clang-format in compiler-rtVitaly Buka
Historically style is Google, but we never used AllowShortIfStatementsOnASingleLine. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@331829 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-07[sanitizer] Replace InternalScopedBuffer with InternalMmapVectorVitaly Buka
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@331618 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-07[sanitizer] Remove reserving constructor from InternalMmapVectorVitaly Buka
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@331617 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-07[sanitizer] Make InternalScopedBuffer::size() behavior similar to vector.Vitaly Buka
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@331612 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-05Remove dead sanitizer_procmaps_freebsd.ccKamil Rytarowski
This file has been obsoleted by sanitizer_procmaps_bsd.cc. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@331581 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-30tsan: disable trace switching after multithreaded forkDmitry Vyukov
The problem is reported in: https://github.com/google/sanitizers/issues/945 We already disable as much as possible after multithreaded fork, trace switching is last place that can hang due to basic operations (memory accesses, function calls). Disable it too. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@331163 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-27tsan: improve "destroy of a locked mutex" reportsDmitry Vyukov
1. Allow to suppress by current stack. We generally allow to suppress by all main stacks. Current is probably the stack one wants to use to suppress such reports. 2. Fix last lock stack restoration. We trimmed shadow value by storing it in u32. This magically worked for the test that provoked the report on the main thread. But this breaks for locks in any other threads. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@331023 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-19tsan: fix compiler warningsDmitry Vyukov
vmaSize is uptr, so we need to print it with %zd. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@330312 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-16[sanitizer] Build failures fixes post D45457Kostya Kortchinsky
Summary: Adding a couple missed RTSanitizerCommonSymbolizer in makefiles. Subscribers: kubamracek, mgorny, delcypher, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D45694 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@330134 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-16[sanitizer] Split Symbolizer/StackTraces from core RTSanitizerCommonKostya Kortchinsky
Summary: Host symbolizer & stacktraces related code in their own RT: `RTSanitizerCommonSymbolizer`, which is "libcdep" by nature. Symbolizer & stacktraces specific code that used to live in common files is moved to a new file `sanitizer_symbolizer_report.cc` as is. The purpose of this is the enforce a separation between code that relies on symbolization and code that doesn't. This saves the inclusion of spurious code due to the interface functions with default visibility, and the extra data associated. The following sanitizers makefiles were modified & tested locally: - dfsan: doesn't require the new symbolizer RT - esan: requires it - hwasan: requires it - lsan: requires it - msan: requires it - safestack: doesn't require it - xray: doesn't require it - tsan: requires it - ubsan: requires it - ubsan_minimal: doesn't require it - scudo: requires it (but not for Fuchsia that has a minimal runtime) This was tested locally on Linux, Android, Fuchsia. Reviewers: alekseyshl, eugenis, dberris, kubamracek, vitalybuka, dvyukov, mcgrathr Reviewed By: alekseyshl, vitalybuka Subscribers: srhines, kubamracek, mgorny, krytarowski, delcypher, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D45457 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@330131 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-16tsan: add support for linux/powerpc64 in buildgo.shDmitry Vyukov
The current implementation of the Go sanitizer only works on x86_64. Added some modifications to the buildgo.sh script and the Tsan code to make it work on powerpc64/linux. Author: cseo (Carlos Eduardo Seo) Reviewed in: https://reviews.llvm.org/D43025 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@330122 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-13[tsan] Add interceptors for objc_sync_enter and objc_sync_exitKuba Mracek
Objective-C's @synchronize synchronization primitive uses calls to objc_sync_enter and objc_sync_exit runtime functions. In most cases, they end up just calling pthread_mutex_lock/pthread_mutex_unlock, but there are some cases where the synchronization from pthread_mutex_lock/pthread_mutex_unlock interceptors isn't enough. Let's add explicit interceptors for objc_sync_enter and objc_sync_exit to handle all cases. Differential Revision: https://reviews.llvm.org/D45487 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@329982 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-03[sanitizer] Remove empty Symbolizer PrepareForSandboxingKostya Kortchinsky
Summary: `Symbolizer::PrepareForSandboxing` is empty for all platforms and apparently has been for a while (D10213). Remove it, and shuffle things around so that the platform specific code is now in `PlatformPrepareForSandboxing`. This allows to have one less symbolizer dependency in a common file, which helps for the upcoming split. Also remove `SymbolizerPrepareForSandboxing` in tsan_go which appears to not be used anywhere. Reviewers: alekseyshl, eugenis, dvyukov, mcgrathr Reviewed By: alekseyshl Subscribers: kubamracek, delcypher, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D44953 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@329094 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-22[sanitizer] Split coverage into separate RT in sanitizer_commonKostya Kortchinsky
Summary: `sanitizer_common`'s coverage support is fairly well separated, and libcdep by default. Several sanitizers don't make use of coverage, and as far as I can tell do no benefit from the extra dependencies pulled in by the coverage public interface functions. The following sanitizers call `InitializeCoverage` explicitely: MSan, ASan, LSan, HWAsan, UBSan. On top of this, any sanitizer bundling RTUBSan should add the coverage RT as well: ASan, Scudo, UBSan, CFI (diag), TSan, MSan, HWAsan. So in the end the following have no need: DFSan, ESan, CFI, SafeStack (nolibc anyway), XRay, and the upcoming Scudo minimal runtime. I tested this with all the sanitizers check-* with gcc & clang, and in standalone on Linux & Android, and there was no issue. I couldn't test this on Mac, Fuchsia, BSDs, & Windows for lack of an environment, so adding a bunch of people for additional scrunity. I couldn't test HWAsan either. Reviewers: eugenis, vitalybuka, alekseyshl, flowerhack, kubamracek, dberris, rnk, krytarowski Reviewed By: vitalybuka, alekseyshl, flowerhack, dberris Subscribers: mgorny, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D44701 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328204 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-21tsan: fix darwin build after 328079Dmitry Vyukov
328079 introduced a weak hook without default implementation. This broke darwin build: http://green.lab.llvm.org/green//job/clang-stage1-configure-RA/43731/consoleFull#-119213188149ba4694-19c4-4d7e-bec5-911270d8a58c Provide default impl for the hook. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328082 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-21tsan: support inlined frames in external symbolizationDmitry Vyukov
New API passes a callback function to the external symbolizer, allowing it to add multiple frames to the traceback. Note that the old interface API will be still supported until the clients migrate to the new one. Author: asmundak (Alexander Smundak) Reviewed in: https://reviews.llvm.org/D44714 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328079 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-16tsan: revert: Update buildgo.sh to pass -isysroot on Darwin.Dmitry Vyukov
This commit breaks actual Go runtime build on gomote builders (10.12) with: xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance Without this part build works fine. The original commit does not include any explanation as to why it is needed. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327700 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-16FreeBSD TSan support updateVitaly Buka
Summary: - Disable thread_finalize callback on FreeBSD, fixing couple of unit tests. Patch by David CARLIER Reviewers: vitalybuka Reviewed By: vitalybuka Subscribers: emaste, kubamracek, krytarowski, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D44156 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327697 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-15[TSan] fix Go runtime test on amd64 with PIEMartin Pelikan
Summary: Without this diff, the test segfaults. Examining the generated executable (which gets auto-deleted likely by cmake/ninja) yields this error message: ThreadSanitizer failed to allocate 0x4000 (16384) bytes at address 1755558480000 (errno: 12) Note that the address has more than 47 bits, which on amd64 means special treatment and therefore points out an overflow. The allocation came from __tsan_map_shadow on a .data pointer, which (on my work Debian-based box) means the 0x550000000000 range. This doesn't correspond to the constants mentioned in tsan_platform.h for Go binaries on Linux/amd64. The diff therefore allocates memory in the sort of area Go programs would, and prevents the test from crashing. It would be nice if reviewers kindly considered other setups and architectures :-) Reviewers: kcc, dvyukov Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D44071 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327621 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-12[Sanitizers] Add more standard compliant posix_memalign implementation for LSan.Alex Shlyapnikov
Summary: Add more standard compliant posix_memalign implementation for LSan and use corresponding sanitizer's posix_memalign implenetations in allocation wrappers on Mac. Reviewers: eugenis, fjricci Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D44335 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327338 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-07[Fuzzer] Avoid the unnecessary rebuild of the custom libc++Petr Hosek
This changes the add_custom_libcxx macro to resemble the llvm_ExternalProject_Add. The primary motivation is to avoid unnecessary libFuzzer rebuilds that are being done on every Ninja/Make invocation. The libc++ should be only rebuilt whenever the libc++ source itself changes. Differential Revision: https://reviews.llvm.org/D43213 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@326921 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-07[sanitizer] Move mmap interceptors into sanitizer_commonVitaly Buka
Reviewers: devnexen, krytarowski, eugenis Subscribers: kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D44125 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@326851 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-15[TSan] Fix static TLS boundaries calculations in __tls_get_addr interceptor.Alex Shlyapnikov
Summary: DTLS_on_tls_get_addr expects (tls_addr + tls_size) as the last parameter, static_tls_end. Reviewers: dvyukov Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D43325 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@325276 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-15Enable syscall-specific functions in TSan/NetBSDKamil Rytarowski
NetBSD ships now with netbsd_syscall_hooks.h and requires support for TSan specific features to be enabled. This is follow up of: D42048: Add NetBSD syscall hooks skeleton in sanitizers Sponsored by <The NetBSD Foundation> git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@325245 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-15Add NetBSD syscall hooks skeleton in sanitizersKamil Rytarowski
Summary: Implement the skeleton of NetBSD syscall hooks for use with sanitizers. Add a script that generates the rules to handle syscalls on NetBSD: generate_netbsd_syscalls.awk. It has been written in NetBSD awk(1) (patched nawk) and is compatible with gawk. Generate lib/sanitizer_common/sanitizer_platform_limits_netbsd.h that is a public header for applications, and included as: <sanitizer_common/sanitizer_platform_limits_netbsd.h>. Generate sanitizer_syscalls_netbsd.inc that defines all the syscall rules for NetBSD. This file is modeled after the Linux specific file: sanitizer_common_syscalls.inc. Start recognizing NetBSD syscalls with existing sanitizers: ASan, ESan, HWASan, TSan, MSan. Sponsored by <The NetBSD Foundation> Reviewers: joerg, vitalybuka, kcc, dvyukov, eugenis Reviewed By: vitalybuka Subscribers: hintonda, kubamracek, mgorny, llvm-commits, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D42048 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@325206 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-08[scudo] Allow options to be defined at compile timeKostya Kortchinsky
Summary: Allow for options to be defined at compile time, like is already the case for other sanitizers, via `SCUDO_DEFAULT_OPTIONS`. Reviewers: alekseyshl, dberris Reviewed By: alekseyshl, dberris Subscribers: kubamracek, delcypher, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D42980 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@324620 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-25Correct typo in TSan codeKamil Rytarowski
We wrongly enabled additional (unwanted) branch for NetBSD. Noted by Vlad Tsyrklevich git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@323413 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-21Reland "[Fuzzer] Parametrize add_custom_libcxx"Petr Hosek
add_custom_libcxx uses the just built compiler and installs the built libc++, e.g. for testing, neither of which is desirable in case of Fuzzer where the libc++ should be built using the host compiler and it's only linked into the libFuzzer and should never be installed. This change introduces additional arguments to add_custom_libcxx to allow parametrizing its behavior. Differential Revision: https://reviews.llvm.org/D42330 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@323054 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-20Revert "[Fuzzer] Parametrize add_custom_libcxx"Petr Hosek
This reverts commit r323032: failing on the sanitizer-x86_64-linux-autoconf bot. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@323033 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-20[Fuzzer] Parametrize add_custom_libcxxPetr Hosek
add_custom_libcxx uses the just built compiler and installs the built libc++, e.g. for testing, neither of which is desirable in case of Fuzzer where the libc++ should be built using the host compiler and it's only linked into the libFuzzer and should never be installed. This change introduces additional arguments to add_custom_libcxx to allow parametrizing its behavior. Differential Revision: https://reviews.llvm.org/D42330 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@323032 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-20[TSan][MIPS] Expand sanitizer memory space to lower addressesPetar Jovanovic
MemToShadowImpl() maps lower addresses to a memory space out of sanitizers range. The simplest example is address 0 which is mapped to 0x2000000000 static const uptr kShadowBeg = 0x2400000000ull; but accessing the address during tsan execution will lead to a segmentation fault. This patch expands the range used by the sanitizer and ensures that 1/8 of the maximum valid address in the virtual address spaces is used for shadow memory. Patch by Milos Stojanovic. Differential Revision: https://reviews.llvm.org/D41777 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@323013 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-17[Sanitizers] Make common allocator agnostic to failure handling modes.Alex Shlyapnikov
Summary: Make common allocator agnostic to failure handling modes and move the decision up to the particular sanitizer's allocator, where the context is available (call stack, parameters, return nullptr/crash mode etc.) It simplifies the common allocator and allows the particular sanitizer's allocator to generate more specific and detailed error reports (which will be implemented later). The behavior is largely the same, except one case, the violation of the common allocator's check for "size + alignment" overflow is now reportied as OOM instead of "bad request". It feels like a worthy tradeoff and "size + alignment" is huge in this case anyway (thus, can be interpreted as not enough memory to satisfy the request). There's also a Report() statement added there. Reviewers: eugenis Subscribers: kubamracek, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D42198 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@322784 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-28Ignore the DISPATCH_NOESCAPE if not definedYi Kong
This macro is only defined after XCode 8, causing build breakage for build systems with prior versions. Ignore DISPATCH_NOESCAPE if not defined. Differential Revision: https://reviews.llvm.org/D41601 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@321543 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-22[MSan,TSan] Add aligned new/delete interceptors.Alex Shlyapnikov
Summary: Providing aligned new/delete implementations to match ASan. Unlike ASan, MSan and TSan do not perform any additional checks on overaligned memory, hence no sanitizer specific tests. Reviewers: eugenis Subscribers: kubamracek, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D41532 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@321365 91177308-0d34-0410-b5e6-96231b3b80d8
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