summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* [msan] Add interceptors: crypt, crypt_r.Evgeniy Stepanov2019-10-086-0/+105
| | | | | | | | | | | | Reviewers: vitalybuka Subscribers: srhines, #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D68431 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@373993 91177308-0d34-0410-b5e6-96231b3b80d8
* [tsan, go] fix Go windows buildVitaly Buka2019-10-072-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: Don't use weak exports when building tsan into a shared library for Go. gcc can't handle the pragmas used to make the weak references. Include files that have been added since the last update to build.bat. (We should really find a better way to list all the files needed.) Add windows version defines (WINVER and _WIN32_WINNT) to get AcquireSRWLockExclusive and ReleaseSRWLockExclusive defined. Define GetProcessMemoryInfo to use the kernel32 version. This is kind of a hack, the windows header files should do this translation for us. I think we're not in the right family partition (we're using Desktop, but that translation only happens for App and System partitions???), but hacking the family partition seems equally gross and I have no idea what the consequences of that might be. Patch by Keith Randall. Reviewers: dvyukov, vitalybuka Reviewed By: vitalybuka Subscribers: jfb, delcypher, #sanitizers, llvm-commits Tags: #llvm, #sanitizers Differential Revision: https://reviews.llvm.org/D68599 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@373984 91177308-0d34-0410-b5e6-96231b3b80d8
* [tsan, go] break commands into multiple linesVitaly Buka2019-10-071-3/+55
| | | | | | | | | | | | | | Summary: Patch by Keith Randall. Reviewers: dvyukov, vitalybuka Subscribers: delcypher, jfb, #sanitizers, llvm-commits Tags: #llvm, #sanitizers Differential Revision: https://reviews.llvm.org/D68596 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@373983 91177308-0d34-0410-b5e6-96231b3b80d8
* [sanitizer] Print SIGTRAP for corresponding signalVitaly Buka2019-10-072-0/+10
| | | | | | | | | | | | Reviewers: eugenis, jfb Subscribers: #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D68603 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@373979 91177308-0d34-0410-b5e6-96231b3b80d8
* [tsan] Don't delay SIGTRAP handlerVitaly Buka2019-10-072-4/+34
| | | | | | | | | | | | Reviewers: eugenis, jfb Subscribers: #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D68604 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@373978 91177308-0d34-0410-b5e6-96231b3b80d8
* [scudo][standalone] Correct releaseToOS behaviorKostya Kortchinsky2019-10-073-27/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: There was an issue in `releaseToOSMaybe`: one of the criteria to decide if we should proceed with the release was wrong. Namely: ``` const uptr N = Sci->Stats.PoppedBlocks - Sci->Stats.PushedBlocks; if (N * BlockSize < PageSize) return; // No chance to release anything. ``` I meant to check if the amount of bytes in the free list was lower than a page, but this actually checks if the amount of **in use** bytes was lower than a page. The correct code is: ``` const uptr BytesInFreeList = Region->AllocatedUser - (Region->Stats.PoppedBlocks - Region->Stats.PushedBlocks) * BlockSize; if (BytesInFreeList < PageSize) return 0; // No chance to release anything. ``` Consequences of the bug: - if a class size has less than a page worth of in-use bytes (allocated or in a cache), reclaiming would not occur, whatever the amount of blocks in the free list; in real world scenarios this is unlikely to happen and be impactful; - if a class size had less than a page worth of free bytes (and enough in-use bytes, etc), then reclaiming would be attempted, with likely no result. This means the reclaiming was overzealous at times. I didn't have a good way to test for this, so I changed the prototype of the function to return the number of bytes released, allowing to get the information needed. The test added fails with the initial criteria. Another issue is that `ReleaseToOsInterval` can actually be 0, meaning we always try to release (side note: it's terrible for performances). so change a `> 0` check to `>= 0`. Additionally, decrease the `CanRelease` threshold to `PageSize / 32`. I still have to make that configurable but I will do it at another time. Finally, rename some variables in `printStats`: I feel like "available" was too ambiguous, so change it to "total". Reviewers: morehouse, hctim, eugenis, vitalybuka, cferris Reviewed By: morehouse Subscribers: delcypher, #sanitizers, llvm-commits Tags: #llvm, #sanitizers Differential Revision: https://reviews.llvm.org/D68471 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@373930 91177308-0d34-0410-b5e6-96231b3b80d8
* [scudo][standalone] Make malloc_info return a minimal XMLKostya Kortchinsky2019-10-043-4/+16
| | | | | | | | | | | | | | | | | | | | | Summary: Initially, our malloc_info was returning ENOTSUP, but Android would rather have it return successfully and write a barebone XML to the stream, so we will oblige. Add an associated test. Reviewers: cferris, morehouse, hctim, eugenis, vitalybuka Reviewed By: morehouse Subscribers: delcypher, #sanitizers, llvm-commits Tags: #llvm, #sanitizers Differential Revision: https://reviews.llvm.org/D68427 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@373754 91177308-0d34-0410-b5e6-96231b3b80d8
* [compiler-rt] Remove O1 tests from signal_line.cppVitaly Buka2019-10-041-4/+0
| | | | | | It does not work on arm git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@373702 91177308-0d34-0410-b5e6-96231b3b80d8
* [compiler-rt] Fix signal_line.cpp testVitaly Buka2019-10-041-2/+2
| | | | | | r373682 committed wrong experimental version git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@373684 91177308-0d34-0410-b5e6-96231b3b80d8
* [compiler-rt] Remove O2, O3 from signal_line test for fix android testsVitaly Buka2019-10-041-11/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@373682 91177308-0d34-0410-b5e6-96231b3b80d8
* compiler-rt: use __GLIBC_PREREQ for SANITIZER_INTERCEPT_GETRANDOMVitaly Buka2019-10-041-2/+2
| | | | | | | | | | | | | | Summary: Fixes https://github.com/google/oss-fuzz/issues/2836 Reviewers: eugenis Subscribers: dberris, #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D68178 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@373681 91177308-0d34-0410-b5e6-96231b3b80d8
* [compiler-rt] More optimization levels in signal_line.cpp testVitaly Buka2019-10-031-12/+13
| | | | git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@373642 91177308-0d34-0410-b5e6-96231b3b80d8
* compiler-rt: move all __GLIBC_PREREQ into own header fileVitaly Buka2019-10-035-19/+38
| | | | | | | | | | | | Reviewers: eugenis Subscribers: dberris, #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D68177 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@373632 91177308-0d34-0410-b5e6-96231b3b80d8
* Move SanitizerInitializeUnwinder outside anonymous namespace.Matt Morehouse2019-10-021-32/+32
| | | | | | Fixes the Android build breakage introduced in r373528. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@373539 91177308-0d34-0410-b5e6-96231b3b80d8
* [sanitizer_common] Declare __sanitizer_on_print in Windows interception.Matt Morehouse2019-10-021-0/+1
| | | | | | Speculative fix for Windows bot. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@373532 91177308-0d34-0410-b5e6-96231b3b80d8
* [sanitizer_common] Disable onprint.cpp on Android.Matt Morehouse2019-10-021-0/+2
| | | | | | The test fails to find the written file on Android. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@373531 91177308-0d34-0410-b5e6-96231b3b80d8
* [sanitizer_common] Add __sanitizer_on_print to interface list.Matt Morehouse2019-10-021-0/+1
| | | | | | Should fix the current Windows buildbot failure. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@373530 91177308-0d34-0410-b5e6-96231b3b80d8
* [compiler-rt] Use GetNextInstructionPc in signal handlersVitaly Buka2019-10-026-6/+44
| | | | | | | | | | | | | | | | | | Summary: All other stack trace callers assume that PC contains return address. HWAsan already use GetNextInstructionPc in similar code. PR43339 Reviewers: eugenis, kcc, jfb Subscribers: dexonsmith, dberris, #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D68313 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@373529 91177308-0d34-0410-b5e6-96231b3b80d8
* NFC: add namespace {}Vitaly Buka2019-10-021-0/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@373528 91177308-0d34-0410-b5e6-96231b3b80d8
* [sanitizer_common] Rename OnPrint to __sanitizer_on_print.Matt Morehouse2019-10-022-1/+38
| | | | | | | | | | | | | | | | | | Summary: https://reviews.llvm.org/D28596 exposed OnPrint in the global namespace, which can cause collisions with user-defined OnPrint() functions. Reviewers: vitalybuka, dvyukov Reviewed By: vitalybuka, dvyukov Subscribers: llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D67987 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@373518 91177308-0d34-0410-b5e6-96231b3b80d8
* [CMake] Fix the value of `config.target_cflags` for non-macOS Apple ↵Dan Liew2019-10-015-50/+105
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | platforms. Attempt #3. The main problem here is that `-*-version_min=` was not being passed to the compiler when building test cases. This can cause problems when testing on devices running older OSs because Clang would previously assume the minimum deployment target is the the latest OS in the SDK which could be much newer than what the device is running. Previously the generated value looked like this: `-arch arm64 -isysroot <path_to_xcode>/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk` With this change it now looks like: `-arch arm64 -stdlib=libc++ -miphoneos-version-min=8.0 -isysroot <path_to_xcode>/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk` This mirrors the setting of config.target_cflags on macOS. This change is made for ASan, LibFuzzer, TSan, and UBSan. To implement this a new `get_test_cflags_for_apple_platform()` function has been added that when given an Apple platform name and architecture returns a string containing the C compiler flags to use when building tests. This also calls a new helper function `is_valid_apple_platform()` that validates Apple platform names. This is the third attempt at landing the patch. The first attempt (r359305) had to be reverted (r359327) due to a buildbot failure. The problem was that calling `get_test_cflags_for_apple_platform()` can trigger a CMake error if the provided architecture is not supported by the current CMake configuration. Previously, this could be triggered by passing `-DCOMPILER_RT_ENABLE_IOS=OFF` to CMake. The root cause is that we were generating test configurations for a list of architectures without checking if the relevant Sanitizer actually supported that architecture. We now intersect the list of architectures for an Apple platform with `<SANITIZER>_SUPPORTED_ARCH` (where `<SANITIZER>` is a Sanitizer name) to iterate through the correct list of architectures. The second attempt (r363633) had to be reverted (r363779) due to a build failure. The failed build was using a modified Apple toolchain where the iOS simulator SDK was missing. This exposed a bug in the existing UBSan test generation code where it was assumed that `COMPILER_RT_ENABLE_IOS` implied that the toolchain supported both iOS and the iOS simulator. This is not true. This has been fixed by using the list `SANITIZER_COMMON_SUPPORTED_OS` for the list of supported Apple platforms for UBSan. For consistency with the other Sanitizers we also now intersect the list of architectures with UBSAN_SUPPORTED_ARCH. rdar://problem/50124489 Differential Revision: https://reviews.llvm.org/D61242 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@373405 91177308-0d34-0410-b5e6-96231b3b80d8
* [libFuzzer] Remove lazy counters.Matt Morehouse2019-10-0111-70/+0
| | | | | | | | | | | | | | | | Summary: Lazy counters haven't improved performance for large fuzz targets. Reviewers: kcc Reviewed By: kcc Subscribers: llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D67476 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@373403 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "compiler-rt: use __GLIBC_PREREQ for SANITIZER_INTERCEPT_GETRANDOM"Vitaly Buka2019-10-016-37/+21
| | | | | | | | | | | Revert "compiler-rt: move all __GLIBC_PREREQ into own header file" "move all __GLIBC_PREREQ" breaks build on some bots This reverts commit 2d75ee937397c209dbd95aefc88da6301fed07da. This reverts commit 7a6461fcc2ed8e28c43993c561721af0bbe97f3a. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@373367 91177308-0d34-0410-b5e6-96231b3b80d8
* compiler-rt: use __GLIBC_PREREQ for SANITIZER_INTERCEPT_GETRANDOMVitaly Buka2019-10-011-2/+2
| | | | | | | | | | | | | | Summary: Fixes https://github.com/google/oss-fuzz/issues/2836 Reviewers: eugenis Subscribers: dberris, #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D68178 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@373284 91177308-0d34-0410-b5e6-96231b3b80d8
* compiler-rt: move all __GLIBC_PREREQ into own header fileVitaly Buka2019-10-015-19/+35
| | | | | | | | | | | | Reviewers: eugenis Subscribers: dberris, #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D68177 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@373283 91177308-0d34-0410-b5e6-96231b3b80d8
* Rename tsan_interceptors.cpp into tsan_interceptors_posix.cppVitaly Buka2019-10-013-3/+3
| | | | | | | | | | | | | | | | | | | | | Summary: It's needed to use __GLIBC_PREREQ from <features.h> tsan didn't let us to include <features.h> by using --sysroot=. to disable system includes on anything that is not named as "tsan*posix*", "tsan*mac*", "tsan*linux*". See compiler-rt/lib/tsan/CMakeLists.txt Reviewers: eugenis, dvyukov, kcc Reviewed By: kcc Subscribers: mgorny, #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D68176 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@373282 91177308-0d34-0410-b5e6-96231b3b80d8
* [msan] Intercept __getrlimit.Evgeniy Stepanov2019-09-302-7/+33
| | | | | | | | | | | | | | | | | | | | Summary: This interceptor is useful on its own, but the main purpose of this change is to intercept libpthread initialization on linux/glibc in order to run __msan_init before any .preinit_array constructors. We used to trigger on pthread_initialize_minimal -> getrlimit(), but that call has changed to __getrlimit at some point. Reviewers: vitalybuka, pcc Subscribers: jfb, #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D68168 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@373239 91177308-0d34-0410-b5e6-96231b3b80d8
* [libFuzzer] Dump trace and provide correct msg for overwritten input.Mitch Phillips2019-09-271-1/+3
| | | | | | | | | | | | | | | | | | Summary: Now crashes with a stacktrace and uses 'overwrites-const-input' as the error message instead of 'out-of-memory'. Reviewers: morehouse, Dor1s Reviewed By: morehouse, Dor1s Subscribers: #sanitizers, llvm-commits, metzman, Dor1s Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D68067 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@373130 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "[profile] Add a test dependency on cxx-headers"Vedant Kumar2019-09-271-1/+1
| | | | | | | | | | This reverts commit b539350f7d006b7d6f42c5c4b5715da87a52e5d8. See: http://lab.llvm.org:8011/builders/sanitizer-windows/builds/52140/steps/annotate/logs/stdio The cxx-headers target doesn't exist everywhere. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@373123 91177308-0d34-0410-b5e6-96231b3b80d8
* [profile] Mark instrprof-gcov-fork.test UNSUPPORTED on Darwin as wellVedant Kumar2019-09-271-0/+1
| | | | | | | | | | This test remains flaky everywhere, I think. We should consider deleting it and accompanying support code in GCOVProfiling: I've stopped short of doing that now as the gcov exec* tests appear to be stable. See the thread re: r347779. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@373121 91177308-0d34-0410-b5e6-96231b3b80d8
* [profile] Add a test dependency on cxx-headersVedant Kumar2019-09-271-1/+1
| | | | | | | This enables running profile runtime tests which #include <string>, etc. via just `check-profile`. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@373120 91177308-0d34-0410-b5e6-96231b3b80d8
* hwasan: Compatibility fixes for short granules.Peter Collingbourne2019-09-273-5/+58
| | | | | | | | | | | | | | | | | | | | | | | | | We can't use short granules with stack instrumentation when targeting older API levels because the rest of the system won't understand the short granule tags stored in shadow memory. Moreover, we need to be able to let old binaries (which won't understand short granule tags) run on a new system that supports short granule tags. Such binaries will call the __hwasan_tag_mismatch function when their outlined checks fail. We can compensate for the binary's lack of support for short granules by implementing the short granule part of the check in the __hwasan_tag_mismatch function. Unfortunately we can't do anything about inline checks, but I don't believe that we can generate these by default on aarch64, nor did we do so when the ABI was fixed. A new function, __hwasan_tag_mismatch_v2, is introduced that lets code targeting the new runtime avoid redoing the short granule check. Because tag mismatches are rare this isn't important from a performance perspective; the main benefit is that it introduces a symbol dependency that prevents binaries targeting the new runtime from running on older (i.e. incompatible) runtimes. Differential Revision: https://reviews.llvm.org/D68059 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@373035 91177308-0d34-0410-b5e6-96231b3b80d8
* [libFuzzer] [NFC] Fix grammar error with "it's"Mitch Phillips2019-09-262-2/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@372937 91177308-0d34-0410-b5e6-96231b3b80d8
* builtins test: Move clear_cache_test.c from a mprotect()ed global to a ↵Nico Weber2019-09-251-28/+21
| | | | | | | | | | | | | | | | | | mmap()ed variable ld64 in the macOS 10.15 SDK gives __DATA a maxprot of 3, meaning it can't be made executable at runtime by default. Change clear_cache_test.c to use mmap()ed data that's mapped as writable and executable from the beginning, instead of trying to mprotect()ing a __DATA variable as executable. This fixes the test on macOS with the 10.15 SDK. PR43407. Differential Revision: https://reviews.llvm.org/D67929 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@372849 91177308-0d34-0410-b5e6-96231b3b80d8
* [NFC] Invoke lipo from CMAKE_LIPO.Puyan Lotfi2019-09-241-1/+3
| | | | | | | | This shouldn't change anything, except that a cmake cache file that specifies CMAKE_LIPO can specify an alternate lipo to use. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@372790 91177308-0d34-0410-b5e6-96231b3b80d8
* [TSAN] Add read/write range interface functions with PCJoachim Protze2019-09-243-0/+53
| | | | | | | | | | Adding annotation function variants __tsan_write_range_pc and __tsan_read_range_pc to annotate ranged access to memory while providing a program counter for the access. Differential Revision: https://reviews.llvm.org/D66885 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@372730 91177308-0d34-0410-b5e6-96231b3b80d8
* sanitizer_common: fix freebsd build errorDmitry Vyukov2019-09-241-1/+0
| | | | | | | | | | | Variable flags is not used. Remove it. Suggested-by: randall77 (Keith Randall) Review: https://reviews.llvm.org/D67928 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@372698 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix int to bool errors exposed due to r372612.Rumeet Dhindsa2019-09-243-4/+4
| | | | | | | | | | Differential Revision: https://reviews.llvm.org/D67937 M lib/builtins/fp_add_impl.inc M lib/builtins/fp_lib.h M lib/builtins/fp_trunc_impl.inc git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@372684 91177308-0d34-0410-b5e6-96231b3b80d8
* [llvm-cov] NFC: Specify a specific C++ standard in the test.Artem Dergachev2019-09-241-3/+6
| | | | | | Makes life easier for downstream users with customized default standard. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@372674 91177308-0d34-0410-b5e6-96231b3b80d8
* [compiler-rt] Fix lint check failure on commentsJinsong Ji2019-09-222-2/+4
| | | | | | | | | This fixes buildbot failures for https://reviews.llvm.org/rL372459. (at least on PowerPC/Z ) The fix is generated by running clang-format on the error lines only. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@372511 91177308-0d34-0410-b5e6-96231b3b80d8
* Add __lsan::ScopedInterceptorDisabler for strerror(3)Kamil Rytarowski2019-09-213-0/+23
| | | | | | | | | | | | | | | | | | | | Summary: strerror(3) on NetBSD uses internally TSD with a destructor that is never fired for exit(3). It's correctly called for pthread_exit(3) scenarios. This is a case when a leak on exit(3) is expected, unavoidable and harmless. Reviewers: joerg, vitalybuka, dvyukov, mgorny Reviewed By: vitalybuka Subscribers: dmgreen, kristof.beyls, jfb, llvm-commits, #sanitizers Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D67337 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@372461 91177308-0d34-0410-b5e6-96231b3b80d8
* Avoid memory leak in ASan testKamil Rytarowski2019-09-211-0/+1
| | | | | | | | | | | | | | | | | | | Summary: Add missing free(3) for the malloc(3) call. Detected on NetBSD with LSan. Reviewers: joerg, mgorny, vitalybuka, dvyukov Reviewed By: vitalybuka Subscribers: llvm-commits, #sanitizers Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D67330 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@372460 91177308-0d34-0410-b5e6-96231b3b80d8
* Stop tracking atexit/__cxa_atexit/pthread_atfork allocations in LSan/NetBSDKamil Rytarowski2019-09-214-1/+101
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The atexit(3) and __cxa_atexit() calls allocate internally memory and free on exit, after executing all callback. This causes false positives as DoLeakCheck() is called from the atexit handler. In the LSan/ASan tests there are strict checks triggering false positives here. Intercept all atexit(3) and __cxa_atexit() calls and disable LSan when calling the real functions. Stop tracing allocations in pthread_atfork(3) funtions, as there are performed internal allocations that are not freed for the time of running StopTheWorld() code. This avoids false-positives. The same changes have to be replicated in the ASan and LSan runtime. Non-NetBSD OSs are not tested and this code is restricted to NetBSD only. Reviewers: dvyukov, joerg, mgorny, vitalybuka, eugenis Reviewed By: vitalybuka Subscribers: jfb, llvm-commits, #sanitizers Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D67331 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@372459 91177308-0d34-0410-b5e6-96231b3b80d8
* [lsan] Fix deadlock in dl_iterate_phdr.Evgeniy Stepanov2019-09-195-12/+69
| | | | | | | | | | | | | | | | | Summary: Do not grab the allocator lock before calling dl_iterate_phdr. This may cause a lock order inversion with (valid) user code that uses malloc inside a dl_iterate_phdr callback. Reviewers: vitalybuka, hctim Subscribers: jfb, #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D67738 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@372348 91177308-0d34-0410-b5e6-96231b3b80d8
* [cmake] Strip quotes in try_compile_onlyHans Wennborg2019-09-191-0/+6
| | | | | | | | | | | | | | | | | After r372209, the compile command can end up including an argument with quotes in it, e.g. -fprofile-instr-use="/foo/bar.profdata" when invoking the compiler with execute_process, the compiler ends up getting that argument with quotes and all, and fails to open the file. This all seems horribly broken, but one way of working around it is to simply strip the quotes from the string here. If they were there to protect a path that's got spaces in it, that wasn't going to work anyway because the string is later split by spaces. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@372312 91177308-0d34-0410-b5e6-96231b3b80d8
* tsan: allow the Go runtime to return multiple stack frames for a single PCDmitry Vyukov2019-09-181-7/+18
| | | | | | | | | | | | | | This fix allows tsan to report stack traces correctly even in the presence of mid-stack inlining by the Go compiler. See https://go-review.googlesource.com/c/go/+/195781 for the Go runtime side of this change. Author: randall77 (Keith Randall) Reviewed: https://reviews.llvm.org/D67671 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@372205 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove asan test for strncat(x, y, 0)David Bolvansky2019-09-171-3/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@372143 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASAN] Adjust asan tests due to new optimizationsDavid Bolvansky2019-09-171-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@372141 91177308-0d34-0410-b5e6-96231b3b80d8
* [libFuzzer] Always print DSO map on Fuchsia libFuzzer launchJake Ehrlich2019-09-172-0/+12
| | | | | | | | | | | | | | | | Fuchsia doesn't have /proc/id/maps, so it relies on the kernel logging system to provide the DSO map to be able to symbolize in the context of ASLR. The DSO map is logged automatically on Fuchsia when encountering a crash or writing to the sanitizer log for the first time in a process. There are several cases where libFuzzer doesn't encounter a crash, e.g. on timeouts, OOMs, and when configured to print new PCs as they become covered, to name a few. Therefore, this change always writes to the sanitizer log on startup to ensure the DSO map is available in the log. Author: aarongreen Differential Revision: https://reviews.llvm.org/D66233 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@372056 91177308-0d34-0410-b5e6-96231b3b80d8
* [test] Clean up previous raw profile before merging into itVedant Kumar2019-09-161-1/+1
| | | | | | | This fixes a test failure in instrprof-set-file-object-merging.c which seems to have been caused by reuse of stale data in old raw profiles. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@372041 91177308-0d34-0410-b5e6-96231b3b80d8