summaryrefslogtreecommitdiffstats
path: root/compiler-rt/test
Commit message (Collapse)AuthorAgeFilesLines
...
* [libFuzzer] Re-enable libFuzzer on i386 Linux and fix testJonathan Metzman2019-05-021-0/+2
| | | | | | | | | | | | | | | | | | | | | Summary: Re-enable libFuzzer on i386 Linux after it was accidentally disabled. Also disable gc-sections.test on i386 since lld isn't garbage collecting properly with ASAN on i386. Reviewers: morehouse Reviewed By: morehouse Subscribers: srhines, mgorny, #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D61415 llvm-svn: 359802
* [tsan] Fix and re-enable user_malloc.cc testVitaly Buka2019-05-011-9/+9
| | | | | | | | | | | | | | Summary: no_sanitize_thread is not enough as it still puts some tsan instrumentation Reviewers: eugenis Subscribers: kubamracek, #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D61393 llvm-svn: 359731
* [sanitizer] Implement reallocarray.Evgeniy Stepanov2019-05-014-8/+44
| | | | | | | | | | | | | | | | Summary: It's a cross of calloc and realloc. Sanitizers implement calloc-like check for size overflow. Reviewers: vitalybuka, kcc Subscribers: kubamracek, #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D61108 llvm-svn: 359708
* [libFuzzer] Add --dump-input-on-failure to help diagnose AArch64 failuresPeter Smith2019-05-012-6/+6
| | | | | | | | | | | | | | The fork-siguser.test and fork.test intermittently fail on the AArch64 buildbot. Unfortunately these failures are not reproducible on a similar machine and seem to fail when the machines are under load. Before suggesting the tests be marked unsupported for AArch64 we'd like to see if we can get some more information about the failures to see if it helps us reproduce. This patch adds --dump-input-on-failure to the FileCheck commands to see if we can get some more information about the failures. Differential Revision: https://reviews.llvm.org/D61315 llvm-svn: 359675
* [libFuzzer] Fix failing test: sigint.testJonathan Metzman2019-04-301-3/+1
| | | | | | | | | | | | | | | | | | Summary: Fix sigint.test by making it require msan rather than enumerating unsupported platforms. Reviewers: kcc Reviewed By: kcc Subscribers: #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D61353 llvm-svn: 359638
* [libFuzzer] temporarily disable a test on windows, where there is no memmem ↵Kostya Serebryany2019-04-301-0/+2
| | | | | | in the usual place llvm-svn: 359624
* [libFuzzer] add MagicSeparatorTestKostya Serebryany2019-04-302-0/+51
| | | | llvm-svn: 359620
* [libFuzzer] Replace -seed_corpus to better support fork mode on WinJonathan Metzman2019-04-301-0/+24
| | | | | | | | | | | | | | | | | | Summary: Pass seed corpus list in a file to get around argument length limits on Windows. This limit was preventing many uses of fork mode on Windows. Reviewers: kcc, morehouse Reviewed By: kcc Subscribers: #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D60980 llvm-svn: 359610
* [compiler-rt][builtins][sanitizers] Update compiler-rt test cases forAmy Kwan2019-04-302-6/+15
| | | | | | | | | | | | | | | | compatibility with system's toolchain This patch aims to: - Guard ompiler-rt/test/builtins/Unit/compiler_rt_logb_test.c with macros, so the test runs on GLIBC versions >= 2.23. This is because the test relies on comparing its computed values to libm. Oolder versions might not compute to the same value as the compiler-rt value. - Update compiler-rt/test/sanitizer_common/TestCases/Posix/getpw_getgr.cc so that std::string is not used, since false positives may be detected. Differential Revision: https://reviews.llvm.org/D60644 llvm-svn: 359606
* Reland "[compiler-rt] Simple crtbegin.o and crtend.o implementation"Petr Hosek2019-04-306-0/+184
| | | | | | | | | | | | | | | Clang relies on existence of certain symbols that are normally provided by crtbegin.o/crtend.o. However, LLVM does not currently provide implementation of these files, instead relying on either libgcc or implementations provided as part of the system. This change provides an initial implementation of crtbegin.o/crtend.o that can be used on system that don't provide crtbegin.o/crtend.o as part of their C library. Differential Revision: https://reviews.llvm.org/D28791 llvm-svn: 359591
* fix broken testJonathan Metzman2019-04-301-7/+7
| | | | llvm-svn: 359590
* remove extra zerosJonathan Metzman2019-04-301-1/+1
| | | | llvm-svn: 359589
* remove stale commentJonathan Metzman2019-04-301-1/+1
| | | | llvm-svn: 359588
* fix commentJonathan Metzman2019-04-301-1/+1
| | | | llvm-svn: 359586
* [libFuzzer] Enable for i386Jonathan Metzman2019-04-301-0/+2
| | | | | | | | | | | | Summary: Get libFuzzer to build on i386 and fix tests. Subscribers: mgorny, #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D61070 llvm-svn: 359585
* Fix issues with testing for i386Jonathan Metzman2019-04-305-3/+8
| | | | llvm-svn: 359584
* Enable x86 buildsJonathan Metzman2019-04-303-6/+4
| | | | llvm-svn: 359583
* Revert "[compiler-rt] Simple crtbegin.o and crtend.o implementation"Petr Hosek2019-04-305-162/+0
| | | | | | This reverts commit r359576 since it's failing on Windows bots. llvm-svn: 359579
* [compiler-rt] Simple crtbegin.o and crtend.o implementationPetr Hosek2019-04-305-0/+162
| | | | | | | | | | | | | | | Clang relies on existence of certain symbols that are normally provided by crtbegin.o/crtend.o. However, LLVM does not currently provide implementation of these files, instead relying on either libgcc or implementations provided as part of the system. This change provides an initial implementation of crtbegin.o/crtend.o that can be used on system that don't provide crtbegin.o/crtend.o as part of their C library. Differential Revision: https://reviews.llvm.org/D28791 llvm-svn: 359576
* [AddressSanitizer] [Windows] Fix HeapReAlloc and _recalloc bugs in ↵Matthew G McGovern2019-04-292-0/+58
| | | | | | | | | | | asan_malloc_win.cc HeapReAlloc should allow for 0 sized reallocations without freeing the memory block provided by the user. _recalloc previously did not zero new memory after reallocation. https://reviews.llvm.org/D61268 llvm-svn: 359498
* [CMake] Don't modify `FUZZER_SUPPORTED_ARCH` is place.Dan Liew2019-04-281-2/+3
| | | | | | | | | | | | | | On a Darwin host we were modifying the `FUZZER_SUPPORTED_ARCH` in place which would strip out non-x86 architectures. This unhelpful if we want to use `FUZZER_SUPPORTED_ARCH` later. To fix this we introduce `FUZZER_TEST_ARCH` which is similar to what we have for for the other sanitizers. For non-Darwin host platforms `FUZZER_TEST_ARCH` is the same as `FUZZER_SUPPORTED_ARCH` but for Darwin host platforms we use `darwin_filter_host_archs(...)` as the previous code did. llvm-svn: 359394
* Revert "[CMake] Fix the value of `config.target_cflags` for non-macOS Apple"Dan Liew2019-04-264-29/+9
| | | | | | | | | | | | | | | | | | | | | This reverts commit 1bcdbd68616dc7f8debe126caafef7a7242a0e6b. It's been reported that some bots are failing with this change with CMake error like: ``` CMake Error at /b/s/w/ir/k/llvm-project/compiler-rt/cmake/config-ix.cmake:177 (message): Unsupported architecture: arm64 Call Stack (most recent call first): /b/s/w/ir/k/llvm-project/compiler-rt/cmake/config-ix.cmake:216 (get_target_flags_for_arch) /b/s/w/ir/k/llvm-project/compiler-rt/test/tsan/CMakeLists.txt:78 (get_test_cflags_for_apple_platform) ``` I'm reverting the patch now to unbreak builds. I will investigate properly when time permits. rdar://problem/50124489 llvm-svn: 359327
* [asan_symbolize] Teach `asan_symbolize.py` to symbolicate using a module mapDan Liew2019-04-261-0/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The use case here is to be able get the UUIDs of the modules that need to be symbolicated so that external plugins can see them. This information can be extracted from ASan reports if the `print_module_map` ASan option is enabled. Currently printing of the module map is only implemented on Darwin and so this is effectively a Darwin only feature right now. The module map hooks into symbolization using the new plugin infrastructure. A new hook in `AsanSymbolizerPlugInProxy` (and in `AsanSymbolizerPlugIn`) is also provided to allow external plugins to hook into the module look up process. This will allow external plugins to look up modules with knowledge of their UUID. The new plug-in is currently stored in the `asan_symbolize.py` script. We could potentially move this into a separate file in the future (to reduce clutter) if we can come up with a policy for where to search for plugins that should always get loaded. rdar://problem/49476995 Reviewers: kubamracek, yln, samsonov, dvyukov, vitalybuka Subscribers: #sanitizers, llvm-commits Tags: #llvm, #sanitizers Differential Revision: https://reviews.llvm.org/D60531 llvm-svn: 359322
* [CMake] Fix the value of `config.target_cflags` for non-macOS AppleDan Liew2019-04-264-9/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | platforms. 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. rdar://problem/50124489 Differential Revision: https://reviews.llvm.org/D58578 llvm-svn: 359305
* [libFuzzer] Disable MSan interceptors in SIGINT handler.Matt Morehouse2019-04-261-0/+17
| | | | | | | | | | | | | | | | | | | | | | Summary: Avoids an MSan false positive if the SIGINT comes while the user callback is running. The false positive happens when the interrupt handler calls opendir() to remove some temporary files, which is intercepted by MSan. Fixes https://github.com/google/oss-fuzz/issues/2332. Reviewers: kcc Reviewed By: kcc Subscribers: llvm-commits, Dor1s, metzman Tags: #llvm Differential Revision: https://reviews.llvm.org/D61163 llvm-svn: 359254
* [libFuzzer] Require linux for libcxx.testMatt Morehouse2019-04-251-0/+1
| | | | llvm-svn: 359223
* [compiler-rt] Build custom libc++abi without exceptions.Matt Morehouse2019-04-251-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | Summary: Since neither compiler-rt nor the libc++ we build use exceptions, we don't need libc++abi to have them either. This resolves an issue where libFuzzer's private libc++ contains implementations for __cxa_throw and friends, causing fuzz targets built with their own C++ library to segfault during exception unwinding. See https://github.com/google/oss-fuzz/issues/2328. Reviewers: phosek, EricWF, kcc Reviewed By: phosek Subscribers: kcc, dberris, mgorny, christof, llvm-commits, metzman Tags: #llvm Differential Revision: https://reviews.llvm.org/D61053 llvm-svn: 359218
* [fuzzer] Fix reload.test on Linux/aarch64Adhemerval Zanella2019-04-241-2/+2
| | | | | | | | | | The compiler generates a 'brk' instruction for __builtin_trap on aarch64 and Linux kernel issues a SIGTRAP. It is different from x86, where compiler emits an 'ud2' and kernel issues a SIGILL. A straightforward is to use abort instead. llvm-svn: 359126
* [TSan] Support fiber API on macOSJulian Lettner2019-04-209-21/+33
| | | | | | | | | | | | | | Committing on behalf of Yuri Per (yuri). Reviewers: dvyukov, kubamracek, yln Reviewed By: kubamracek Authored By: yuri Differential Revision: https://reviews.llvm.org/D58110 llvm-svn: 358802
* Removed regiser dump checks from FP unit test.Mitch Phillips2019-04-191-41/+14
| | | | llvm-svn: 358770
* [HWASan] Added no-FP unit test for register dump.Mitch Phillips2019-04-191-12/+12
| | | | | | | | | | | | | | Summary: Unit test for D60798. Reviewers: eugenis Subscribers: kubamracek, #sanitizers, llvm-commits, pcc Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D60806 llvm-svn: 358769
* Updated test case.Mitch Phillips2019-04-191-7/+19
| | | | llvm-svn: 358768
* Added no-FP unit test for register dump.Mitch Phillips2019-04-191-0/+43
| | | | llvm-svn: 358767
* Summary:Jonathan Metzman2019-04-183-18/+50
| | | | | | | | | | | | | | | | | | | | | | Add close_fd_mask functionality to AFL driver. Summary: Add support for env var AFL_DRIVER_CLOSE_FD_MASK which behaves the same as libFuzzer's -close_fd_mask=1. Also add tests. Reviewers: kcc, vitalybuka, morehouse Reviewed By: morehouse Subscribers: #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D60334 llvm-svn: 358703
* [asan_symbolize] Add a simple plugin architectureDan Liew2019-04-183-0/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This change adds a simple plugin architecture to `asan_symbolize.py`. The motivation here is that sometimes it's necessary to perform extra work to figure out where binaries with debug symbols can actually be found. For example it might be the case that a remote service needs to be queried for binaries and then copied to the local system. This "extra work" can be extremely site-specific such that adding the code directly into the `asan_symbolize.py` would just clutter the code for a very niche use case. To avoid this, the `asan_symbolize.py` can now load external code via a new `--plugins` command line option. These plugins are loaded before main command line argument parsing so that they can add their own command line options. Right now the only hook into the behaviour of symbolization is the `filter_binary_path()` function which assumes a very similar role to the `binary_name_filter` function that was previously in the code. We can add more hooks as necessary. Code in the `asan_symbolize.py` script does not call plugin code directly. Instead it uses a `AsanSymbolizerPlugInProxy` object. This object * Loads plugins from files. * Manages the lifetime of the plugins. * Provides an interface for calling into plugin functions and handles calling into multiple plugins. To unify the way binary paths are filtered the old `sysroot_path_filter` function (and associated code) has been turned into a simple plugin (`SysRootFilterPlugIn`) that is always loaded. The plugin unloads itself if the `-s` option is not present on the command line. Users should not see any functional change relating to this command line option. Some simple tests are provided to illustrate what plugin code looks like and also to check the functionality continues to work. rdar://problem/49476995 Reviewers: kubamracek, yln, samsonov, dvyukov, vitalybuka Subscribers: srhines, #sanitizers, llvm-commits Tags: #llvm, #sanitizers Differential Revision: https://reviews.llvm.org/D60529 llvm-svn: 358657
* [TSan][libdispatch] Port gcd-sync-block-copy.mm to C++Julian Lettner2019-04-162-3/+52
| | | | | | | | | | | | | | | | | | | | | | | Summary: Apparently, it makes a difference on where a block lives depending on if it's passed "inline" versus assigned and then passed via a variable. Both tests in this commit now give a signal, if `Block_copy` is used in `dispatch_sync`. Since these tests use different mechanisms (Objective-C retain versus C++ copy constructor) as proxies to observe if the block was copied, we should keep both of them. Commit, that first avoided the unnecessary copy: faef7d034a9ec6cb757137adce8e8670ec6c2d7b Subscribers: kubamracek, #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D60639 llvm-svn: 358469
* [libFuzzer] add -features_dir= flag to dump unique input features on diskKostya Serebryany2019-04-131-0/+7
| | | | llvm-svn: 358317
* [TSan][libdispatch] Move libdispatch tests out of Darwin folderJulian Lettner2019-04-1223-6/+8
| | | | | | | The libdispatch tests are now not tied to Darwin anymore. Move them to their own platform-independent folder. llvm-svn: 358316
* [libFuzzer] Fix DataFlow.cpp logic when tracing long inputs.Max Moroz2019-04-121-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: 1. Do not create DFSan labels for the bytes which we do not trace. This is where we run out of labels at the first place. 2. When dumping the traces on the disk, make sure to offset the label identifiers by the number of the first byte in the trace range. 3. For the last label, make sure to write it at the last position of the trace bit string, as that label represents the input size, not any particular byte. Also fixed the bug with division in python which I've introduced when migrated the scripts to Python3 (`//` is required for integral division). Otherwise, the scripts are wasting too much time unsuccessfully trying to collect and process traces from the long inputs. For more context, see https://github.com/google/oss-fuzz/issues/1632#issuecomment-481761789 Reviewers: kcc Reviewed By: kcc Subscribers: delcypher, #sanitizers, llvm-commits Tags: #llvm, #sanitizers Differential Revision: https://reviews.llvm.org/D60538 llvm-svn: 358311
* [TSan][libdispatch] Don't link against FoundationJulian Lettner2019-04-126-13/+22
| | | | | | | Now that our tests don't depend on Foundation anymore, don't link it in. llvm-svn: 358309
* [TSan][libdispatch] Replace NSTemporaryDirectory in testsJulian Lettner2019-04-126-13/+8
| | | | | | | | | | | | | After this change, most tests don't have a dependency on Foundation. Note: To hold the file name `tempnam` allocates a new buffer. We leak this buffer (omit the free), but I don't think we need to care. Reviewed By: kubamracek Differential Revision: https://reviews.llvm.org/D60591 llvm-svn: 358308
* [libFuzzer] support -runs=N in the fork mode. Make sure we see one-line ↵Kostya Serebryany2019-04-122-0/+23
| | | | | | reports from ubsan in the fork mode. Test both llvm-svn: 358306
* [TSan][libdispatch] Fix failing testJulian Lettner2019-04-121-0/+1
| | | | | | | | | The ThreadSanitizer-x86_64-iossim configuration (different SDK) seems to require an additional #include. rdar://49856637 llvm-svn: 358300
* [TSan][libdispatch] Delete old testsJulian Lettner2019-04-112-69/+0
| | | | | | | | | | In a previous commit, I re-enabled the ported variants of these 2 tests: tsan/Darwin/gcd-data.mm -> tsan/libdispatch/data.c tsan/Darwin/gcd-source-serial.mm -> tsan/libdispatch/source-serial.c So now we can delete the Darwin-only version. llvm-svn: 358235
* [TSan][libdispatch] Re-enable disabled testsJulian Lettner2019-04-112-6/+0
| | | | | | | | I re-activated "broad strokes suppressions" (ignore_noninstrumented_modules=1) in my last commit. Re-enable tests that only fail on our bots to check if they work now. llvm-svn: 358209
* [TSan][libdispatch] Turn ignore_noninstrumented_modules=1 back on for DarwinJulian Lettner2019-04-111-0/+3
| | | | llvm-svn: 358208
* [TSan][libdispatch] Replace usage of NSMutableData with stack arrayJulian Lettner2019-04-115-10/+10
| | | | | | | | Reviewed By: kubamracek Differential Revision: https://reviews.llvm.org/D60477 llvm-svn: 358205
* [TSan][libdispatch] Change test to have two simultaneous timersJulian Lettner2019-04-111-1/+1
| | | | | | | | | | | Change test semantics by waiting for both timer callbacks at the end instead of serializing operations: start/wait timer 1 then 2. Reviewed By: kubamracek Differential Revision: https://reviews.llvm.org/D60476 llvm-svn: 358204
* [TSan][libdispatch] Replace CFRunLoop with dispatch_semaphore, pt. 2Julian Lettner2019-04-1111-83/+97
| | | | | | | | Reviewed By: kubamracek Differential Revision: https://reviews.llvm.org/D60475 llvm-svn: 358203
* Prospective test fix in response to r358104.John McCall2019-04-111-1/+1
| | | | llvm-svn: 358149
OpenPOWER on IntegriCloud