summaryrefslogtreecommitdiffstats
path: root/compiler-rt
Commit message (Collapse)AuthorAgeFilesLines
* More OpenBSD fixesVitaly Buka2018-03-221-8/+26
| | | | | | | | | | | | | | | | | | Summary: - Use internal_syscall_ptr in internal_readlink - use sigcontext on OpenBSD Patch by David CARLIER Reviewers: krytarowski, vitalybuka Reviewed By: vitalybuka Subscribers: kubamracek, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D44713 llvm-svn: 328239
* [sanitizer] Split coverage into separate RT in sanitizer_commonKostya Kortchinsky2018-03-2211-6/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 llvm-svn: 328204
* Mmap interceptor new option, Write Exec runtime detectorVitaly Buka2018-03-215-0/+50
| | | | | | | | | | | | | | | | | | Summary: Following-up the refactoring of mmap interceptors, adding a new common option to detect PROT_WRITE|PROT_EXEC pages request. Patch by David CARLIER Reviewers: vitalybuka, vsk Reviewed By: vitalybuka Subscribers: krytarowski, #sanitizers Differential Revision: https://reviews.llvm.org/D44194 llvm-svn: 328151
* [libFuzzer] Disable equivalence-signals test on Darwin due to persistent ↵George Karpenkov2018-03-211-0/+3
| | | | | | failures llvm-svn: 328125
* [PowerPC] Disable failing dynamic tls test casesNemanja Ivanovic2018-03-212-1/+2
| | | | | | | Due to recent kernel upgrades, these test case fail on PowerPC buildbots. This is a known problem on affected kernels. llvm-svn: 328091
* tsan: fix darwin build after 328079Dmitry Vyukov2018-03-211-7/+6
| | | | | | | | | | 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. llvm-svn: 328082
* tsan: support inlined frames in external symbolizationDmitry Vyukov2018-03-215-14/+96
| | | | | | | | | | | | 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 llvm-svn: 328079
* Fix declaration of environ after r327923Vitaly Buka2018-03-211-4/+2
| | | | llvm-svn: 328077
* Revert "[compiler-rt] Change std::sort to llvm::sort in response to r327219"Mandeep Singh Grang2018-03-205-14/+14
| | | | | | This reverts commit 2ee210e1963e03aacc0f71c50e4994bb5c66586e. llvm-svn: 327936
* [compiler-rt] Change std::sort to llvm::sort in response to r327219Mandeep Singh Grang2018-03-205-14/+14
| | | | | | | | | | | | | | | | | | | Summary: r327219 added wrappers to std::sort which randomly shuffle the container before sorting. This will help in uncovering non-determinism caused due to undefined sorting order of objects having the same key. To make use of that infrastructure we need to invoke llvm::sort instead of std::sort. Reviewers: kcc, rsmith, RKSimon, eugenis Reviewed By: RKSimon Subscribers: efriedma, kubamracek, dberris, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D44360 llvm-svn: 327929
* OpenBSD UBsan support missing bitsVitaly Buka2018-03-192-67/+99
| | | | | | | | | | | | | | | | | Summary: Lost bits since the WIP ticket Patch by David CARLIER Reviewers: vitalybuka, vsk Reviewed By: vitalybuka Subscribers: srhines, kubamracek, krytarowski, fedor.sergeev, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D44599 llvm-svn: 327923
* Cleanup of "extern char **environ" declarationVitaly Buka2018-03-191-5/+5
| | | | llvm-svn: 327904
* Fix CMake/MSVC when compiler-rt and llvm are built separatelyVitaly Buka2018-03-191-1/+1
| | | | | | | | | | | | | | | | | Summary: For some reason CMake can't find the `append` macro if LLVM is built separately and imported via `LLVM_CONFIG_PATH`. Patch by Loo Rong Jie Reviewers: rnk, vitalybuka Reviewed By: rnk, vitalybuka Subscribers: dberris, mgorny, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D43458 llvm-svn: 327876
* Revert "Mmap interceptor new option, Write Exec runtime detector"Vitaly Buka2018-03-175-47/+0
| | | | | | | | Breaks Android bot. This reverts commit r327747. llvm-svn: 327762
* [Fuzzer] Build the shared memory hooks for FuchsiaPetr Hosek2018-03-161-0/+1
| | | | | | | | | This is needed otherwise we'll get undefined references when trying to use the libFuzzer built for Fuchsia. Differential Revision: https://reviews.llvm.org/D44590 llvm-svn: 327759
* OpenBSD UBsan support final missing bitsVitaly Buka2018-03-162-5/+7
| | | | | | | | | | | | | | | Summary: One forgotten file change + reordering one header due to clang-format Patch by David CARLIER Reviewers: vitalybuka, vsk Subscribers: kubamracek, fedor.sergeev, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D44556 llvm-svn: 327758
* [asan] Replace vfork with fork.Evgeniy Stepanov2018-03-163-0/+43
| | | | | | | | | | | | | | | | | | | | Summary: vfork is not ASan-friendly because it modifies stack shadow in the parent process address space. While it is possible to compensate for that with, for example, __asan_handle_no_return before each call to _exit or execve and friends, simply replacing vfork with fork looks like by far the easiest solution. Posix compliant programs can not detect the difference between vfork and fork. Fixes https://github.com/google/sanitizers/issues/925 Reviewers: kcc, vitalybuka Subscribers: kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D44587 llvm-svn: 327752
* [asan] Remove empty fork interceptor.Evgeniy Stepanov2018-03-162-14/+0
| | | | | | After a partial revert, ASan somehow ended up with an empty interceptor for fork(). llvm-svn: 327748
* Mmap interceptor new option, Write Exec runtime detectorVitaly Buka2018-03-165-0/+47
| | | | | | | | | | | | | | | | Summary: Following-up the refactoring of mmap interceptors, adding a new common option to detect PROT_WRITE|PROT_EXEC pages request. Patch by David CARLIER Reviewers: vitalybuka, vsk Reviewed By: vitalybuka Subscribers: krytarowski, #sanitizers Differential Revision: https://reviews.llvm.org/D44194 llvm-svn: 327747
* Revert "Mmap interceptor new option, Write Exec runtime detector"Jonas Devlieghere2018-03-165-47/+0
| | | | | | | | | This reverts r327696 because it is failing on GreenDragon. http://green.lab.llvm.org/green/job/clang-stage1-configure-RA/43605/ http://green.lab.llvm.org/green/job/clang-stage1-cmake-RA-expensive/10957/ llvm-svn: 327719
* tsan: revert: Update buildgo.sh to pass -isysroot on Darwin.Dmitry Vyukov2018-03-161-1/+1
| | | | | | | | | | | | | | 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. llvm-svn: 327700
* FreeBSD TSan support updateVitaly Buka2018-03-161-3/+3
| | | | | | | | | | | | | | | | | 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 llvm-svn: 327697
* Mmap interceptor new option, Write Exec runtime detectorVitaly Buka2018-03-165-0/+47
| | | | | | | | | | | | | | | | Summary: Following-up the refactoring of mmap interceptors, adding a new common option to detect PROT_WRITE|PROT_EXEC pages request. Patch by David CARLIER Reviewers: vitalybuka, vsk Reviewed By: vitalybuka Subscribers: krytarowski, #sanitizers Differential Revision: https://reviews.llvm.org/D44194 llvm-svn: 327696
* MSan, FreeBSD few tests fixesVitaly Buka2018-03-152-2/+13
| | | | | | | | | | | | | | | | Summary: pthread_getattr_np_deadlock support pthread_getname_np unsupported Reviewers: krytarowski, vitalybuka Reviewed By: vitalybuka Subscribers: eugenis, srhines, krytarowski, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D44085 llvm-svn: 327678
* OpenBSD UBsan support procmapsVitaly Buka2018-03-154-9/+144
| | | | | | | | | | | | | | | | Summary: procmaps OpenBSD specifics Patch by David CARLIER Reviewers: krytarowski, vitalybuka Reviewed By: vitalybuka Subscribers: mgorny, emaste, kubamracek, fedor.sergeev, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D44050 llvm-svn: 327677
* OpenBSD UBsan support common functionsVitaly Buka2018-03-152-69/+107
| | | | | | | | | | | | | | | | Summary: Ripped off OpenBSD specific from the common Linux implementation Patch by David Carlier Reviewers: krytarowski, vitalybuka Reviewed By: vitalybuka Subscribers: emaste, srhines, kubamracek, fedor.sergeev, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D44036 llvm-svn: 327674
* [TSan] fix Go runtime test on amd64 with PIEMartin Pelikan2018-03-151-1/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | 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 llvm-svn: 327621
* [sanitizer] Fix off type in mmap64 interceptorVitaly Buka2018-03-151-1/+1
| | | | llvm-svn: 327596
* [scudo] Add Chunk::getSize, rework Chunk::getUsableSizeKostya Kortchinsky2018-03-142-25/+28
| | | | | | | | | | | | | | | | | | | | | | | | Summary: Using `getActuallyAllocatedSize` from the Combined resulting in mediocre compiled code, as the `ClassId != 0` predicament was not propagated there, resulting in additional branches and dead code. Move the logic in the frontend, which results in better compiled code. Also I think it makes it slightly easier to distinguish between the size the user requested, and the size that was actually allocated by the allocator. `const` a couple of things as well. This has no functional impact. Reviewers: alekseyshl Reviewed By: alekseyshl Subscribers: delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D44444 llvm-svn: 327525
* fix some user facing typos / in the commentsSylvestre Ledru2018-03-135-8/+8
| | | | llvm-svn: 327402
* [Sanitizers] Add more standard compliant posix_memalign implementation for LSan.Alex Shlyapnikov2018-03-127-9/+36
| | | | | | | | | | | | | | | 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 llvm-svn: 327338
* [asan] poison_heap=0 should not disable __asan_handle_no_return.Evgeniy Stepanov2018-03-123-2/+15
| | | | | | | | | | Reviewers: kcc, alekseyshl, vitalybuka Subscribers: kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D44339 llvm-svn: 327337
* [scudo] Secondary allocator overhaul to support WindowsKostya Kortchinsky2018-03-122-56/+113
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The need for this change stems from the fact that Windows doesn't support partial unmapping (`MEM_RELEASE` implies the entire allocated region). So we now have to keep track of the reserved region and the committed region, so that we can function without the trimming we did when dealing with larger alignments. Instead of just having a `ReservedAddressRange` per chunk, we introduce a `LargeChunkHeader` (and `LargeChunk` namespace) that additionally holds the committed size and the usable size. The former is needed for stats purposes, the latter is used by the frontend. Requiring both is debatable, we could only work with the usable size but then be off by up to a page per chunk when dealing with stats. Additionally, we introduce more stats since they turned out to be useful for experiments, and a `PrintStats` function that will be used by the combined allocator in later patch. Reviewers: alekseyshl, flowerhack Reviewed By: alekseyshl Subscribers: delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D43949 llvm-svn: 327321
* [sanitizer] Align & pad the allocator structures to the cacheline size v2Kostya Kortchinsky2018-03-124-15/+18
| | | | | | | | | | | | | | | | | | | | Summary: This is a new version of D44261, which broke some builds with older gcc, as they can't align on a constexpr, but rather require an integer (see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56859) among others. We introduce `SANITIZER_CACHE_LINE_SIZE` in `sanitizer_platform.h` to be used in `ALIGNED` attributes instead of using directly `kCacheLineSize`. Reviewers: alekseyshl, thakis Reviewed By: alekseyshl Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D44326 llvm-svn: 327297
* [Fuzzer] When building for Fuchsia, add an explicit libc++ dependencyPetr Hosek2018-03-101-0/+5
| | | | | | | | | | libFuzzer dependes on C++ library, when building for Fuchsia, we need to ensure that libFuzzer is only being built after libc++ has been built, so we add an explicity dependency on it. Differential Revision: https://reviews.llvm.org/D44340 llvm-svn: 327196
* [asan] Clean up the REQUIRES of `asan/TestCases/strcat-overlap.cc`Dan Liew2018-03-091-1/+5
| | | | | | | | | | | | by explicitly listing where we expect this test to work. Because this test invokes undefined behaviour all sorts of things can happen (e.g. crash, or on some bots asan manages to catch something). The test seems to pass okay on Darwin (x86_64/x86_64/i386) and on Linux (x86_64/i386) so explicitly require one of these platforms to run the test. llvm-svn: 327185
* cfi: Disable simple-pass.cpp on Darwin.Peter Collingbourne2018-03-091-0/+3
| | | | | | -mretpoline does not work yet on Darwin. llvm-svn: 327168
* [sanitizer] Revert rCRT327145Kostya Kortchinsky2018-03-093-14/+13
| | | | | | | | | | | | | | | | | | | Summary: It breaks the Chromium toolchain due to: ``` lib/sanitizer_common/sanitizer_allocator_primary32.h:269:34: error: requested alignment is not an integer constant struct ALIGNED(kCacheLineSize) SizeClassInfo { ``` Reviewers: alekseyshl, thakis Reviewed By: thakis Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D44320 llvm-svn: 327167
* Use branch funnels for virtual calls when retpoline mitigation is enabled.Peter Collingbourne2018-03-091-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The retpoline mitigation for variant 2 of CVE-2017-5715 inhibits the branch predictor, and as a result it can lead to a measurable loss of performance. We can reduce the performance impact of retpolined virtual calls by replacing them with a special construct known as a branch funnel, which is an instruction sequence that implements virtual calls to a set of known targets using a binary tree of direct branches. This allows the processor to speculately execute valid implementations of the virtual function without allowing for speculative execution of of calls to arbitrary addresses. This patch extends the whole-program devirtualization pass to replace certain virtual calls with calls to branch funnels, which are represented using a new llvm.icall.jumptable intrinsic. It also extends the LowerTypeTests pass to recognize the new intrinsic, generate code for the branch funnels (x86_64 only for now) and lay out virtual tables as required for each branch funnel. The implementation supports full LTO as well as ThinLTO, and extends the ThinLTO summary format used for whole-program devirtualization to support branch funnels. For more details see RFC: http://lists.llvm.org/pipermail/llvm-dev/2018-January/120672.html Differential Revision: https://reviews.llvm.org/D42453 llvm-svn: 327163
* [sanitizer] Align & pad the allocator structures to the cacheline sizeKostya Kortchinsky2018-03-093-13/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Both `SizeClassInfo` structures for the 32-bit primary & `RegionInfo` structures for the 64-bit primary can be used by different threads, and as such they should be aligned & padded to the cacheline size to avoid false sharing. The former was padded but the array was not aligned, the latter was not padded but we lucked up as the size of the structure was 192 bytes, and aligned by the properties of `mmap`. I plan on adding a couple of fields to the `RegionInfo`, and some highly threaded tests pointed out that without proper padding & alignment, performance was getting a hit - and it is going away with proper padding. This patch makes sure that we are properly padded & aligned for both. I used a template to avoid padding if the size is already a multiple of the cacheline size. There might be a better way to do this, I am open to suggestions. Reviewers: alekseyshl, dvyukov Reviewed By: alekseyshl Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D44261 llvm-svn: 327145
* [asan] Try to unbreak arm build bots by only running the test onDan Liew2018-03-091-0/+1
| | | | | | | x86_64 and x86_64H (and not in the iOS simulator) where it seems to work. We need to properly fix the test when time permits. llvm-svn: 327122
* Mark the -overlap tests are "UNSUPPORTED: android". Android test harness ↵Kuba Mracek2018-03-094-0/+7
| | | | | | doesn't know how to handle suppression files. llvm-svn: 327091
* Mark strcat-overlap.cc as "UNSUPPORTED: win32"Kuba Mracek2018-03-091-0/+2
| | | | llvm-svn: 327081
* Move lto-constmerge-odr.cc to Posix (it's failing on Windows).Kuba Mracek2018-03-081-0/+0
| | | | llvm-svn: 327080
* [asan] Fix bug where suppression of overlapping accesses was ignored onDan Liew2018-03-085-9/+200
| | | | | | | | | | `strcpy()`, `strncpy()`, `strcat()`, and `strncat()`. rdar://problem/35576899 Differential Revision: https://reviews.llvm.org/D43702 llvm-svn: 327068
* [asan] Fix a false positive ODR violation due to LTO ConstantMerge pass ↵Kuba Mracek2018-03-082-9/+17
| | | | | | | | | | [compiler-rt part, take 3] This fixes a false positive ODR violation that is reported by ASan when using LTO. In cases, where two constant globals have the same value, LTO will merge them, which breaks ASan's ODR detection. See the included testcase for an example. Differential Revision: https://reviews.llvm.org/D43959 llvm-svn: 327062
* More revert of r327031Kuba Mracek2018-03-081-0/+0
| | | | llvm-svn: 327038
* Revert r327031Kuba Mracek2018-03-082-17/+9
| | | | llvm-svn: 327032
* [asan] Fix a false positive ODR violation due to LTO ConstantMerge pass ↵Kuba Mracek2018-03-082-9/+17
| | | | | | | | | | [compiler-rt part] This fixes a false positive ODR violation that is reported by ASan when using LTO. In cases, where two constant globals have the same value, LTO will merge them, which breaks ASan's ODR detection. Differential Revision: https://reviews.llvm.org/D43959 llvm-svn: 327031
* Build LLVMDemangle from build_symbolizer.shEugene Zemtsov2018-03-081-1/+1
| | | | | | Symbolizer now depends on internal implementation of itaniumDemangle. llvm-svn: 326987
OpenPOWER on IntegriCloud