summaryrefslogtreecommitdiffstats
path: root/compiler-rt
Commit message (Collapse)AuthorAgeFilesLines
...
* [libFuzzer] fix missing close on opened fileVitaly Buka2019-02-261-0/+1
| | | | | | | | | | | | | | | | | | | | Summary: When running the standalone main on a large corpus, I eventually get a EMFILE error ("Too many open files"). Patch by Paul Chaignon Reviewers: kcc, vitalybuka Reviewed By: vitalybuka Subscribers: lebedev.ri, #sanitizers, llvm-commits Tags: #llvm, #sanitizers Differential Revision: https://reviews.llvm.org/D58622 llvm-svn: 354918
* Fixed a minor merge error with this patch.Mitch Phillips2019-02-261-1/+1
| | | | llvm-svn: 354908
* [compiler-rt] Provide better llvm-lit failure when llvm-config fails.Mitch Phillips2019-02-261-1/+2
| | | | | | | | | | | | | | | | | | | Summary: The current error message can cause confusion if llvm-config can't be executed for reasons other than "not found". In my example, cross compiling generated an llvm-config binary for aarch64 which couldn't be executed natively. Instead of telling me that the error was with the file architecture, it reports the file as not being present. Reviewers: pcc Subscribers: dberris, javed.absar, kristof.beyls, jdoerfert, #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D58647 llvm-svn: 354907
* Revert "[compiler-rt] Intercept the bcmp() function."Vlad Tsyrklevich2019-02-268-91/+28
| | | | | | | This reverts commits r354851, 354852, 354853 and r354888. They were causing build failures on the android sanitizer bot. llvm-svn: 354906
* [libFuzzer] Remove extra semicolonsJonathan Metzman2019-02-263-5/+5
| | | | | | | | | | | | | | | | | | Summary: Remove extra semicolons so that libFuzzer can compile with -Werror -Wextra-semi Reviewers: Dor1s, morehouse, thakis Reviewed By: Dor1s, morehouse Subscribers: jdoerfert, #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D58674 llvm-svn: 354902
* [scudo][standalone] Introduce platform specific code & mutexesKostya Kortchinsky2019-02-2615-52/+986
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: This CL adds the platform specific code for Fuchsia, Linux & Android, as well as some tests related to those (more tests to come later). While some of it is pretty much a straight port of the existing scudo & sanitizer_common code, the memory mapping functions have been reworked a bit to fit the limited usage scenario that Scudo has for them. For Fuchsia, I can now track the Vmar/Vmo pair for memory mappings if there is an intent to grow or decommit some mapping (that will be useful for the Primary). Reviewers: eugenis, vitalybuka, mcgrathr, phosek, flowerhack, morehouse, dmmoore415 Reviewed By: vitalybuka, morehouse Subscribers: kcc, dvyukov, srhines, mgorny, delcypher, jfb, jdoerfert, #sanitizers, llvm-commits Tags: #llvm, #sanitizers Differential Revision: https://reviews.llvm.org/D58184 llvm-svn: 354895
* [compiler-rt] Disable failing test on darwin during investigation.Clement Courbet2019-02-261-0/+1
| | | | | | | | | | | | | | /Users/buildslave/jenkins/workspace/clang-stage1-configure-RA/llvm/projects/compiler-rt/test/asan/TestCases/Posix/bcmp_test.cc:14:12: error: CHECK: expected string not found in input // CHECK: {{#1.*bcmp}} ^ <stdin>:2:57: note: scanning from here ==34677==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7ffee93777c4 at pc 0x0001068a7285 bp 0x7ffee9377770 sp 0x7ffee9376ef8 ^ <stdin>:6:20: note: possible intended match here #2 0x106888e77 in main bcmp_test.cc:12 ^ llvm-svn: 354888
* [Sanitizer] Add interceptor for pthread_sigmaskPavel Labath2019-02-265-0/+31
| | | | | | | | | | | | | | | | | | | | | | Summary: pthread_sigmask is just like sigprocmask, except that its behavior in multithreaded programs is explicitly specified. Sanitizers were lacking a common interceptor for pthread_sigmask (although some specific sanitizers defined custom version), which lead to false positives (at least in msan) when using this function. The interceptor implementation, and its test are based on the equivalent code for sigprocmask. Reviewers: eugenis, vitalybuka Subscribers: kubamracek, delcypher, jfb, jdoerfert, llvm-commits, #sanitizers Tags: #llvm, #sanitizers Differential Revision: https://reviews.llvm.org/D58382 llvm-svn: 354874
* [compiler-rt] disable asan bcmp tests on android.Clement Courbet2019-02-261-0/+1
| | | | | | | | Android does not have bcmp. sanitizer-x86_64-linux-android: run instrumented asan tests [arm/aosp_marlin-userdebug/PI] - stdio llvm-svn: 354853
* [compiler-rt] Fix test broken by r354851.Clement Courbet2019-02-262-2/+2
| | | | | | | error: CHECK: expected string not found in input // CHECK: Uninitialized bytes in __interceptor_memcmp at offset 3 llvm-svn: 354852
* [compiler-rt] Intercept the bcmp() function.Clement Courbet2019-02-266-26/+87
| | | | | | | | | | | | | | | | | | | | | Summary: I have not introduced a separate hook for `bcmp()` as I don't think there should be any reason for a sanitizer to treat it differently from `memcmp()`. This is only enabled when building on POSIX with GNU extensions. Context: this is to avoid losing coverage when emitting `bcmp() == 0` instead of `memcmp() == 0` in llvm, see https://reviews.llvm.org/D56593. Reviewers: mgorny, krytarowski, vitalybuka, dvyukov Subscribers: kubamracek, dberris, delcypher, jdoerfert, #sanitizers, llvm-commits, jyknight Tags: #llvm, #sanitizers Differential Revision: https://reviews.llvm.org/D58379 llvm-svn: 354851
* [llvm-cov] Fix llvm-cov on Windows and un-XFAIL testReid Kleckner2019-02-262-6/+3
| | | | | | | | | | | | | | | | | | | | | | | | Summary: The llvm-cov tool needs to be able to find coverage names in the executable, so the .lprfn and .lcovmap sections cannot be merged into .rdata. Also, the linker merges .lprfn$M into .lprfn, so llvm-cov needs to handle that when looking up sections. It has to support running on both relocatable object files and linked PE files. Lastly, when loading .lprfn from a PE file, llvm-cov needs to skip the leading zero byte added by the profile runtime. Reviewers: vsk Subscribers: hiraditya, #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D58661 llvm-svn: 354840
* [winasan] Unpoison stack memory when threads exit (redux)David Major2019-02-261-0/+13
| | | | | | | | | | | | | | This is a second attempt at r342652 using a TLS callback instead of an interceptor. In long-running builds we've seen some ASan complaints during thread creation that we suspect are due to leftover poisoning from previous threads whose stacks occupied that memory. This patch adds a callback that unpoisons the stack memory when a thread exits. Differential Revision: https://reviews.llvm.org/D58641 llvm-svn: 354836
* [sanitizer] Re-disable a few tests on android.Evgeniy Stepanov2019-02-264-4/+6
| | | | | | Tests were accidentally enabled r354829. llvm-svn: 354834
* [sanitizer] Remove "-android" from test_arch.Evgeniy Stepanov2019-02-252-16/+2
| | | | | | | | | | | | | | | | | | Summary: ASan and Scudo tests are adding "-android" to test arch. There are no tests that depend on it as far as I can see. If necessary, do this instead: REQUIRES: aarch64-target-arch && android Reviewers: pcc, vitalybuka Subscribers: srhines, kubamracek, mgorny, javed.absar, kristof.beyls, cryptoad, #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D58532 llvm-svn: 354829
* Remove overly broad assert from r354717.Richard Trieu2019-02-231-2/+0
| | | | llvm-svn: 354720
* [NFC][Sanitizer] Comment out argument checksJulian Lettner2019-02-232-4/+4
| | | | | | These break clang-ppc64 bots. llvm-svn: 354718
* [NFC][Sanitizer] Add argument checks to BufferedStackTrace::Unwind* functionsJulian Lettner2019-02-236-10/+17
| | | | | | | | Reviewers: vitalybuka Differential Revision: https://reviews.llvm.org/D58555 llvm-svn: 354717
* [NFC][Sanitizer] Re-enable test on DarwinJulian Lettner2019-02-221-3/+0
| | | | | | | This unexpectedly passes on our CI, although it still fails on my machine. llvm-svn: 354701
* [NFC][Sanitizer] Rename BufferedStackTrace::FastUnwindStackJulian Lettner2019-02-228-22/+21
| | | | | | | | | | | | | | | | FastUnwindStack -> UnwindFast SlowUnwindStack -> UnwindSlow Stack is redundant, verb should come first. SlowUnwindStackWithContext(uptr pc, void *context, u32 max_depth) -> SlowUnwindStack WithContext is redundant, since it is a required parameter. Reviewers: vitalybuka Differential Revision: https://reviews.llvm.org/D58551 llvm-svn: 354696
* [Sanitizer] Fix uses of stack->Unwind(..., fast)Julian Lettner2019-02-224-5/+6
| | | | | | | | | | | Apply StackTrace::WillUseFastUnwind(fast) in a few more places missed by my previous patch (https://reviews.llvm.org/D58156). Reviewers: vitalybuka Differential Revision: https://reviews.llvm.org/D58550 llvm-svn: 354695
* [sanitizer] Common macro for .note.GNU-stack directives (NFC)Evgeniy Stepanov2019-02-215-15/+15
| | | | llvm-svn: 354632
* Revert "[asan] Fix vfork handling.", +1Evgeniy Stepanov2019-02-2118-194/+0
| | | | | | Revert r354625, r354627 - multiple build failures. llvm-svn: 354629
* [asan] Fix vfork handling.Evgeniy Stepanov2019-02-212-6/+4
| | | | | | | | __asan_handle_vfork was unpoisoning the wrong part of the stack. Adjust the test to catch this reliably (current failure is non-deterministic). llvm-svn: 354627
* [hwasan,asan] Intercept vfork.Evgeniy Stepanov2019-02-2118-0/+196
| | | | | | | | | | | | | | Summary: AArch64 only for now. Reviewers: vitalybuka, pcc Subscribers: srhines, kubamracek, mgorny, javed.absar, krytarowski, kristof.beyls, jdoerfert, #sanitizers, llvm-commits, kcc Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D58313 llvm-svn: 354625
* Revert "[sanitizers] Restore internal_readlink for x32"Matt Morehouse2019-02-212-6/+1
| | | | | | This reverts r354451 since it broke the Windows sanitizer bot. llvm-svn: 354601
* [LSan] Fix `__sanitizer_print_stack_trace` via fast unwinderJulian Lettner2019-02-204-6/+4
| | | | | | | | | | Summary: Quick follow-up to: https://reviews.llvm.org/D58156 Reviewers: vitalybuka Differential Revision: https://reviews.llvm.org/D58358 llvm-svn: 354522
* Fix license headersVitaly Buka2019-02-201-2/+3
| | | | llvm-svn: 354500
* [sanitizers] Restore internal_readlink for x32H.J. Lu2019-02-202-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | r316591 has @@ -389,13 +383,11 @@ uptr internal_dup2(int oldfd, int newfd) { } uptr internal_readlink(const char *path, char *buf, uptr bufsize) { -#if SANITIZER_NETBSD - return internal_syscall_ptr(SYSCALL(readlink), path, buf, bufsize); -#elif SANITIZER_USES_CANONICAL_LINUX_SYSCALLS +#if SANITIZER_USES_CANONICAL_LINUX_SYSCALLS return internal_syscall(SYSCALL(readlinkat), AT_FDCWD, (uptr)path, (uptr)buf, bufsize); #else - return internal_syscall(SYSCALL(readlink), (uptr)path, (uptr)buf, bufsize); + return internal_syscall_ptr(SYSCALL(readlink), path, buf, bufsize); #endif } which dropped the (uptr) cast and broke x32. This patch puts back the (uptr) cast to restore x32 and fixes: https://bugs.llvm.org/show_bug.cgi?id=40783 Differential Revision: https://reviews.llvm.org/D58413 llvm-svn: 354451
* [msan] Fix name_to_handle_at test on overlayfs.Evgeniy Stepanov2019-02-191-1/+1
| | | | | | Udev supports name_to_handle_at. Use /dev/null instead of /bin/cat. llvm-svn: 354402
* [msan] Remove cxa_atexit_race.ccVitaly Buka2019-02-191-35/+0
| | | | | | | | | | | | | | | | | | | | | Summary: The goal of the test to check that msan does not crash when code is racy on __cxa_atexit. Original crash was caused by race condition in the glibc. With the msan patch the msan does not crashes however the race is still there and the test triggers it. Because the test relies on triggering of undefined behavior results are not very predictable and it may occasionally crashes or hangs. I don't see how to reasonably improve the test, so I remove it. Reviewers: eugenis, peter.smith Subscribers: jfb, jdoerfert, #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D58396 llvm-svn: 354377
* [sanitizers] add a regression test for the bug fixed in r354366Kostya Serebryany2019-02-191-0/+6
| | | | llvm-svn: 354373
* [sanitizer] fix a memory safety bug (!!!) in sanitizer suppressions code, ↵Kostya Serebryany2019-02-191-1/+1
| | | | | | discovered by Aaron Jacobs llvm-svn: 354366
* [compiler-rt][CMake] Set project for the custom libc++Petr Hosek2019-02-191-0/+1
| | | | | | | | | | | | | This is another follow up to r354212 which is broken on Darwin when cross-compiling runtimes to Linux when it ignores the -fuse-ld=lld linker flag and attempts to use the host linker when performing the compiler identification. Upon investigation, I noticed that setting the project with appropriate list of languages makes the error go away and it shouldn't hurt either. Differential Revision: https://reviews.llvm.org/D58372 llvm-svn: 354350
* [LSan][Darwin][NFC] Add comment explaining test failureJulian Lettner2019-02-181-1/+1
| | | | llvm-svn: 354290
* [Sanitizer] On Darwin `__sanitizer_print_stack_trace` only prints topmost frameJulian Lettner2019-02-185-6/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In compiler-rt we have the notion of a `fast` and a `slow` stack unwinder. Darwin currently only supports the fast unwinder. From reading the code, my understanding is that `BufferedStackTrace::Unwind` can be called with `bp=0, stack_top=0, stack_bottom=0, request_fast_unwind=false`. If `request_fast_unwind=true`, then we alos need to supply bp, stack_top, and stack_bottom. However, `BufferedStackTrace::Unwind` uses `StackTrace::WillUseFastUnwind` which will adapt `request_fast_unwind` if the requested unwinder is not supported. On Darwin, the result is that we don't pass actual values for bp, stack_top, and stack_bottom, but end up using the fast unwinder. The tests then fail because we only print the topmost stack frame. This patch adds a check to `WillUseFastUnwind` at the point of usage to avoid the mismatch between `request_fast_unwind` and what `Unwind` actually does. I am also interested in cleaning up the `request_fast_unwind` machinery so this patch just the simplest thing possible so I can enable the tests. Reviewers: vitalybuka, vsk Differential Revision: https://reviews.llvm.org/D58156 llvm-svn: 354282
* [compiler-rt] Fix broken sanitizer bots (hopefully)Jonas Hahnfeld2019-02-1713-16/+15
| | | | | | | | | | | | | | | | | | | According to the logs and local debugging there were two issues: 1) tsan tests listed libc++.a before the source file. That's usually ok for shared libraries, but the linker will not add symbols from a static library unless needed at that time. As a result the tests that rely upon symbols from the library (and not only include the headers) had undefined references. To solve this I'm adding a new substitution %link_libcxx_tsan which expands to libc++.a if available. 2) The target Fuzzer-x86_64-Test linked in SANITIZER_TEST_CXX_LIBRARIES which defaults to -lstdc++. This resulted in error messages like hidden symbol '_ZdlPv' is not defined locally hidden symbol '_Znwm' is not defined locally when using GNU gold (ld.bfd and lld are fine). Removing the linkage is fine because we build a custom libc++ for that purpose. llvm-svn: 354231
* [compiler-rt] Build custom libcxx with libcxxabiJonas Hahnfeld2019-02-1713-43/+71
| | | | | | | | | | | | | | | This changes add_custom_libcxx to also build libcxxabi and merges the two into a static and hermetic library. There are multiple advantages: 1) The resulting libFuzzer doesn't expose C++ internals and looks like a plain C library. 2) We don't have to manually link in libstdc++ to provide cxxabi. 3) The sanitizer tests cannot interfere with an installed version of libc++.so in LD_LIBRARY_PATH. Differential Revision: https://reviews.llvm.org/D58013 llvm-svn: 354212
* [compiler-rt] Cleanup usage of C++ ABI libraryJonas Hahnfeld2019-02-1610-40/+74
| | | | | | | | | | | | | Add missed value "libcxxabi" and introduce SANITIZER_TEST_CXX for linking unit tests. This needs to be a full C++ library and cannot be libcxxabi. Recommit r354132 which I reverted in r354153 because it broke a sanitizer bot. This was because of the "fixes" for pthread linking, so I've removed these changes. Differential Revision: https://reviews.llvm.org/D58012 llvm-svn: 354198
* [libFuzzer] make len_control less agressive: set the initial max len to the ↵Kostya Serebryany2019-02-162-1/+16
| | | | | | length of the largest seed. This was the original intent, but... Now, with a test, to ensure it stays this way llvm-svn: 354191
* [libFuzzer] fork mode: try harder to cleanup after itselfKostya Serebryany2019-02-163-11/+36
| | | | llvm-svn: 354186
* [Sanitizer] iOS: Pull up parallelism_group handling into common.lit.configJulian Lettner2019-02-156-17/+3
| | | | | | | | | | | | | | | | | | | Serial execution on iOS devices is not specific to sanitizers. We want to throttle all on-device tests. Pull the setting of the parallelism_group up into the common lit configuration file. Rename `darwin-ios-device-sanitizer` to `ios-device`. This group is not specific to sanitizers and (theoretically) independent from the host OS. Note that we don't support running unit tests on-device (there are no configurations generated for that). If that ever changes, we also need this configuration in `unittests/lit.common.unit.cfg`. Reviewers: delcypher Differential Revision: https://reviews.llvm.org/D58209 llvm-svn: 354179
* [libFuzzer] form mode: add -ignore_crashes flag, honor the max_total_time ↵Kostya Serebryany2019-02-159-23/+70
| | | | | | flag, print the number of ooms/timeouts/crashes, fix a typo llvm-svn: 354175
* Fix invalid code that Clang trunk will soon diagnose.Richard Smith2019-02-151-1/+1
| | | | | | | | | | | | | There is an ambiguity between ::SizeClassMap (the typedef declared near the start of this file) and __sanitizer::SizeClassMap (found by the 'using namespace __sanitizer;' near the start of this file). Historically a Clang bug has meant that the error was not diagnosed, but soon Clang will start diagnosing it. Explicitly qualify this use of SizeClassMap so that it finds __sanitizer::SizeClassMap rather than being ill-formed due to ambiguity. llvm-svn: 354174
* Fix unsymbolized stack history printing.Evgeniy Stepanov2019-02-152-2/+7
| | | | | | | | | | | | | | | | | | | | | Summary: When symbols are unavailable, the current code prints sp: ... pc: ... (null) (null) instead of module name + offset. Change the output to include module name and offset, and also to match the regular sanitizer stack trace format so that it is recognized by symbolize.py out of the box. Reviewers: kcc, pcc Subscribers: kubamracek, jdoerfert, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D58267 llvm-svn: 354157
* Runtime flags for malloc bisection.Evgeniy Stepanov2019-02-158-19/+141
| | | | | | | | | | | | Reviewers: kcc, pcc Subscribers: kubamracek, mgorny, jdoerfert, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D58162 llvm-svn: 354156
* Fix false positive when tag_in_malloc=0,tag_in_free=1.Evgeniy Stepanov2019-02-152-4/+61
| | | | | | | | | | | | | | | | Summary: With tag_in_free=1, malloc() can not assume that the memory is untagged, and needs to retag is to 0. Reviewers: pcc, kcc Subscribers: kubamracek, jfb, jdoerfert, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D58158 llvm-svn: 354155
* Revert "[compiler-rt] Cleanup usage of C++ ABI library"Jonas Hahnfeld2019-02-1511-75/+40
| | | | | | | This reverts r354132 because it breaks sanitizer-x86_64-linux: http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux/builds/19915 llvm-svn: 354153
* [compiler-rt] Let CMake search for thread supportJonas Hahnfeld2019-02-151-0/+2
| | | | | | This is an educated guess to fix sanitizer-x86_64-linux after r354132. llvm-svn: 354143
* [compiler-rt] Cleanup usage of C++ ABI libraryJonas Hahnfeld2019-02-1510-40/+73
| | | | | | | | | Add missed value "libcxxabi" and introduce SANITIZER_TEST_CXX for linking unit tests. This needs to be a full C++ library and cannot be libcxxabi. Differential Revision: https://reviews.llvm.org/D58012 llvm-svn: 354132
OpenPOWER on IntegriCloud