summaryrefslogtreecommitdiffstats
path: root/compiler-rt/test
Commit message (Collapse)AuthorAgeFilesLines
...
* [SanitizerCoverage] Add associated metadata to PC guards.Matt Morehouse2018-08-141-1/+6
| | | | | | | | | | | | | | | | | | | | | | | Summary: Without this metadata LLD strips unused PC table entries but won't strip unused guards. This metadata also seems to influence the linker to change the ordering in the PC guard section to match that of the PC table section. The libFuzzer runtime library depends on the ordering of the PC table and PC guard sections being the same. This is not generally guaranteed, so we may need to redesign PC tables/guards/counters in the future. Reviewers: eugenis Reviewed By: eugenis Subscribers: kcc, hiraditya, llvm-commits Differential Revision: https://reviews.llvm.org/D50483 llvm-svn: 339733
* Reland "SafeStack: Delay thread stack clean-up""Vlad Tsyrklevich2018-08-141-8/+23
| | | | | | | | | | This relands commit r339405 (reverted in commit r339408.) The original revert was due to tests failing on a darwin buildbot; however, after looking at the affected code more I realized that the Darwin safestack support has always been broken and disabled it in r339719. This relands the original commit. llvm-svn: 339723
* SafeStack: Disable Darwin supportVlad Tsyrklevich2018-08-142-3/+1
| | | | | | | | | | | | | | | | | Summary: Darwin support does not appear to be used as evidenced by the fact that the pthread interceptors have never worked and there is no support for other common threading mechanisms like GCD. Reviewers: pcc, eugenis, kubamracek Reviewed By: pcc, kubamracek Subscribers: kubamracek, mgorny, delcypher, llvm-commits, #sanitizers, kcc Differential Revision: https://reviews.llvm.org/D50718 llvm-svn: 339719
* [scudo] Fix race condition in deallocation path when Quarantine is bypassedKostya Kortchinsky2018-08-141-0/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: There is a race window in the deallocation path when the Quarantine is bypassed. Initially we would just erase the header of a chunk if we were not to use the Quarantine, as opposed to using a compare-exchange primitive, to make things faster. It turned out to be a poor decision, as 2 threads (or more) could simultaneously deallocate the same pointer, and if the checks were to done before the header got erased, this would result in the pointer being added twice (or more) to distinct thread caches, and eventually be reused. Winning the race is not trivial but can happen with enough control over the allocation primitives. The repro added attempts to trigger the bug, with a moderate success rate, but it should be enough to notice if the bug ever make its way back into the code. Since I am changing things in this file, there are 2 smaller changes tagging along, marking a variable `const`, and improving the Quarantine bypass test at runtime. Reviewers: alekseyshl, eugenis, kcc, vitalybuka Reviewed By: eugenis, vitalybuka Subscribers: delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D50655 llvm-svn: 339705
* [hwasan] Provide __sanitizer_* aliases to allocator functions.Evgeniy Stepanov2018-08-131-0/+29
| | | | | | | | | | | | | | | | Summary: Export __sanitizer_malloc, etc as aliases to malloc, etc. This way users can wrap sanitizer malloc, even in fully static binaries. Both jemalloc and tcmalloc provide similar aliases (je_* and tc_*). Reviewers: vitalybuka, kcc Subscribers: llvm-commits, kubamracek Differential Revision: https://reviews.llvm.org/D50570 llvm-svn: 339614
* Revert "SafeStack: Delay thread stack clean-up"Vlad Tsyrklevich2018-08-101-23/+8
| | | | | | | | | This reverts commit r339405, it's failing on Darwin buildbots because it doesn't seem to have a tgkill/thr_kill2 interface. It has a __pthread_kill() syscall, but that relies on having a handle to the thread's port which is not equivalent to it's tid. llvm-svn: 339408
* SafeStack: Delay thread stack clean-upVlad Tsyrklevich2018-08-091-8/+23
| | | | | | | | | | | | | | | | | | Summary: glibc can call SafeStack instrumented code even after the last pthread data destructor has run. Delay cleaning-up unsafe stacks for threads until the thread is dead by having future threads clean-up prior threads stacks. Reviewers: pcc, eugenis Reviewed By: eugenis Subscribers: cryptoad, eugenis, kubamracek, delcypher, llvm-commits, #sanitizers, kcc Differential Revision: https://reviews.llvm.org/D50406 llvm-svn: 339405
* [CMake] Use normalized Windows target triplesPetr Hosek2018-08-0945-45/+45
| | | | | | | | | | | Changes the default Windows target triple returned by GetHostTriple.cmake from the old environment names (which we wanted to move away from) to newer, normalized ones. This also requires updating all tests to use the new systems names in constraints. Differential Revision: https://reviews.llvm.org/D47381 llvm-svn: 339307
* [libFuzzer] Increase the iteration limit in shrink.testGeorge Karpenkov2018-08-091-1/+1
| | | | | | | | | | | | | | After https://reviews.llvm.org/D48800, shrink.test started failing on x86_64h architecture. Looking into this, the optimization pass is too eager to unroll the loop on x86_64h, possibly leading to worse coverage data. Alternative solutions include not unrolling the loop when fuzzing, or disabling this test on that architecture. Differential Revision: https://reviews.llvm.org/D50484 llvm-svn: 339303
* [Coverage] Ignore 'unused' functions with non-zero execution countsVedant Kumar2018-08-071-0/+53
| | | | | | | | | | | | | | | | | Frontends emit 'unused' coverage mapping records for functions which are provably unused in a TU. These unused records contain a single counter with CounterKind::Zero. However, a function may be unused in one TU and used in another. When this happens, prefer the records with a full set of counters instead of arbitrarily picking the first loaded record. There is no impact on the single-TU case. In the multiple-TU case, this resolves issues causing a function to appear unused when it's not. Testing: check-{llvm,clang,compiler-rt} rdar://42981322 llvm-svn: 339194
* [libFuzzer] Disable print_unstable_stats.test for aarch64.Max Moroz2018-08-071-1/+3
| | | | | | | | | | | | | | | | Summary: Follow-up for https://reviews.llvm.org/D50264. Reported by testbots: http://lab.llvm.org:8011/builders/clang-cmake-aarch64-full/builds/5592 Reviewers: morehouse, kevinwkt, metzman, javed.absar, Dor1s Reviewed By: Dor1s Subscribers: kristof.beyls, delcypher, #sanitizers, llvm-commits, kcc Differential Revision: https://reviews.llvm.org/D50386 llvm-svn: 339143
* [libFuzzer] Add unstable function printing to print_unstable_stats flagMax Moroz2018-08-063-10/+28
| | | | | | | | | | | | | | | | | | | Summary: There may be cases in which a user wants to know which part of their code is unstable. We use ObservedFuncs and UnstableCounters to print at exit which of the ObservedFunctions are unstable under the -print_unstable_stats flag. Patch by Kyungtak Woo (@kevinwkt). Reviewers: Dor1s, metzman, morehouse Reviewed By: Dor1s, metzman, morehouse Subscribers: delcypher, #sanitizers, llvm-commits, kcc Differential Revision: https://reviews.llvm.org/D50264 llvm-svn: 339081
* [libFuzzer] Initial implementation of weighted mutation leveraging during ↵Max Moroz2018-08-021-2/+7
| | | | | | | | | | | | | | | | | | | | | runtime. Summary: Added functions that calculate stats while fuzz targets are running and give mutations weight based on how much new coverage they provide, and choose better performing mutations more often. Patch by Kodé Williams (@kodewilliams). Reviewers: Dor1s, metzman, morehouse Reviewed By: Dor1s, morehouse Subscribers: delcypher, kcc, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D49621 llvm-svn: 338776
* [libFuzzer] use absolute distance in addition to the hamming distance in ↵Kostya Serebryany2018-08-021-1/+1
| | | | | | value profiling; our A/B testing have (somewhat weak) indication that this provides an additional signal for corpus expansion llvm-svn: 338661
* Test: Enable exceptions for test that needs itFilipe Cabecinhas2018-08-011-1/+1
| | | | llvm-svn: 338535
* [gcov] Add test which uses forkMarco Castelluccio2018-08-013-0/+50
| | | | | | Test for https://bugs.llvm.org/show_bug.cgi?id=38180. llvm-svn: 338500
* [compiler-rt] Add a routine to specify the mode used when creating profile dirs.Matt Davis2018-07-311-0/+48
| | | | | | | | | | | | | | | | | | | | | Summary: This patch introduces `llvm_profile_set_dir_mode` and `llvm_profile_get_dir_mode` to the compiler-rt profile API. Originally, profile data was placed into a directory that was created with a hard-coded mode value of 0755 (for non-win32 builds). In certain cases, it can be helpful to create directories with a different mode other than 0755. This patch introduces set/get routines to allow users to specify a desired mode. The default remains at 0755. Reviewers: void, probinson Reviewed By: probinson Subscribers: probinson, dberris, cfe-commits Differential Revision: https://reviews.llvm.org/D49953 llvm-svn: 338456
* [gcov] Add tests using switch, one with break clauses and one with fallthroughMarco Castelluccio2018-07-315-0/+98
| | | | llvm-svn: 338453
* [XRay][compiler-rt] Profiling Mode: Include file header in buffersDean Michael Berris2018-07-312-4/+8
| | | | | | | | | | | | | | | | | Summary: This change provides access to the file header even in the in-memory buffer processing. This allows in-memory processing of the buffers to also check the version, and the format, of the profile data. Reviewers: eizan, kpw Reviewed By: eizan Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D50037 llvm-svn: 338347
* [NFC] Rename test/ubsan/TestCases/{ImplicitCast => ImplicitConversion}Roman Lebedev2018-07-303-0/+0
| | | | | | | | Just to be consistent with the rest. I should have done that in the commit itself, but the filepaths is one thing i forgot to verify :S llvm-svn: 338307
* [compiler-rt] integer-truncation-blacklist.c: XFAIL on android/iosRoman Lebedev2018-07-301-0/+5
| | | | | | | | | | | | | | | The Builder sanitizer-x86_64-linux-android is failing starting with rL338287 / D48959. It runs the tests via android_compile.py, so i'm not sure this is actually *this* issue: https://code.google.com/p/address-sanitizer/issues/detail?id=316 but this seems oddly similar to the other XFAIL'ed cases... Right now that seems to be the only failing builder, so i *think* it makes sense to try to just blacklist it for now. llvm-svn: 338296
* [compiler-rt][ubsan] Implicit Conversion Sanitizer - integer truncation - ↵Roman Lebedev2018-07-306-0/+147
| | | | | | | | | | | | | | | | | | | | | | compiler-rt part Summary: This is a compiler-rt part. The clang part is D48958. See [[ https://bugs.llvm.org/show_bug.cgi?id=21530 | PR21530 ]], https://github.com/google/sanitizers/issues/940. Reviewers: #sanitizers, samsonov, vsk, rsmith, pcc, eugenis, kcc, filcab Reviewed By: #sanitizers, vsk, filcab Subscribers: llvm-commits, eugenis, filcab, kubamracek, dberris, #sanitizers, regehr Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D48959 llvm-svn: 338287
* [test] Use printf instead of C++ iostream, NFC.Jonas Hahnfeld2018-07-261-4/+4
| | | | | | | | | | | This test fails with libc++ when built with MemorySanitizer. This is because we link to an uninstrumented version of the library so msan detects a nested error when calling std::cout << "...". This can be easily avoided by using good old printf. Differential Revision: https://reviews.llvm.org/D49867 llvm-svn: 338053
* [libFuzzer] Disable handle-unstable.test for ARM and delete duplicated test ↵Max Moroz2018-07-252-12/+3
| | | | | | | | | | | | | | | | | | file. Summary: This change should fix the failures mentioned in https://reviews.llvm.org/D49684#1175245 Reviewers: kevinwkt, morehouse, metzman Reviewed By: kevinwkt, morehouse Subscribers: kristof.beyls, delcypher, chrib, #sanitizers, llvm-commits, kcc Differential Revision: https://reviews.llvm.org/D49810 llvm-svn: 337949
* [XRay tests] Don't filter test-critical callsJeremy Morse2018-07-251-1/+1
| | | | | | | | | | By default, xray filters events that takes less than 5uS from its log. In this existing test, should printf complete very quickly this will lead to test-critical function calls being filtered (i.e. print_parent_tid). Given that we're not testing the filtering feature, disable it for this test. llvm-svn: 337929
* [Asan][Msan] Unit tests Disable some tests for FreeBSDDavid Carlier2018-07-254-2/+9
| | | | | | | | | | Reviewers: krytarowski Reviewed By: krytarowski Differential Revision: https://reviews.llvm.org/D49784 llvm-svn: 337913
* [libFuzzer] Handle unstable edges by disregarding unstable edgesMax Moroz2018-07-241-0/+39
| | | | | | | | | | | | | | | | | | | | Summary: Added a new mode within flag -handle_unstable for new unstable handling algorithm that does the following: When an edge is shown as unstable, copy to UnstableCounters the value 0. During ApplyUnstableCounters we copy back the value 0 to ModuleInline8bitCounters if the edge was unstable. This way we would be ignoring completely features that were collected through non-determinism. Unstable hits would be counted as if it never hit. Reviewers: metzman, Dor1s, kcc, morehouse Reviewed By: metzman, morehouse Subscribers: delcypher, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D49684 llvm-svn: 337853
* [tsan] Fix crash in objc_sync_enter/objc_sync_exit when using an Obj-C ↵Kuba Mracek2018-07-241-0/+62
| | | | | | | | | | tagged pointer Objective-C tagged pointers (either bottom-most or top-most bit is 1) are valid Obj-C objects but are not valid pointers. Make sure we don't crash on them when used in objc_sync_enter/objc_sync_exit. Instead, let's synchronize on a global object. Differential Revision: https://reviews.llvm.org/D49707 llvm-svn: 337837
* Reapply "[XRay] Remove scheduling dependency in fork_basic_logging.cc"Matthew Voss2018-07-231-4/+4
| | | | | | | | | | | | | | | | | | | Summary: Continuation of https://reviews.llvm.org/D49501 Second part of the test has an scheduling order when there shouldn't be. Reviewers: dberris, ormris Reviewed By: dberris, ormris Subscribers: TWeaver Differential Revision: https://reviews.llvm.org/D49559 llvm-svn: 337745
* [libFuzzer] Handle unstable edges by using minimum hit countsMax Moroz2018-07-231-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | Summary: Created unstable_handle flag that takes 1 or 2, depending on the handling type. Modified RunOne to accommodate the following heuristic: Use the first CollectFeatures to count how many features there are. If no new features, CollectFeatures like before. If there is new feature, we run CB 2 more times, Check which edges are unstable per input and we store the least amount of hit counts for each edge. Apply these hit counts back to inline8bitcounters so that CollectFeatures can work as intended. Modified UnstableCounters to 8int_t and created a bitset UnstableSet to tell which edges are unstable. Patch by Kyungtak Woo (@kevinwkt). Reviewers: Dor1s, metzman, morehouse Reviewed By: Dor1s, morehouse Subscribers: delcypher, #sanitizers, llvm-commits, kcc Differential Revision: https://reviews.llvm.org/D49525 llvm-svn: 337696
* Change the cap on the amount of padding for each vtable to 32-byte ↵Peter Collingbourne2018-07-201-3/+3
| | | | | | | | | | | | | (previously it was 128-byte) We tested different cap values with a recent commit of Chromium. Our results show that the 32-byte cap yields the smallest binary and all the caps yield similar performance. Based on the results, we propose to change the cap value to 32-byte. Patch by Zhaomo Yang! Differential Revision: https://reviews.llvm.org/D49405 llvm-svn: 337622
* [libFuzzer] Use separate test directory for each configJoel E. Denny2018-07-201-2/+0
| | | | | | | | | | | | | | Previously, check-all failed many tests for me. It was running the X86_64DefaultLinuxConfig, X86_64LibcxxLinuxConfig, and X86_64StaticLibcxxLinuxConfig configs out of llvm-build/projects/compiler-rt/test/fuzzer. Now, it runs them out of separate subdirectories there, and most tests pass. Reviewed By: morehouse, george.karpenkov Differential Revision: https://reviews.llvm.org/D49249 llvm-svn: 337521
* [libFuzzer] when -print_coverage=1 is given, print more stats (the number of ↵Kostya Serebryany2018-07-192-2/+5
| | | | | | seeds that hit every given function) llvm-svn: 337501
* [profile] Fix typo in testTeresa Johnson2018-07-191-1/+1
| | | | | | Noticed that this was causing a compiler warning in the test. llvm-svn: 337493
* [profile] Add interface to get profile filenameTeresa Johnson2018-07-191-0/+39
| | | | | | | | | | | | | | | | Summary: Add __llvm_profile_get_filename interface to get the profile filename, which can be used for identifying which profile file belongs to an app when multiple binaries are instrumented and dumping profiles into the same directory. The filename includes the path. Reviewers: davidxl Subscribers: delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D49529 llvm-svn: 337482
* [compiler-rt] Only set lto_flags if lto_supportedTeresa Johnson2018-07-191-3/+2
| | | | | | | | Fix bot failure from r37465. Move the new lto_flags append under the check for whether lto_supported. Otherwise TestingConfig may not have that member. llvm-svn: 337467
* [compiler-rt] Add NewPM testing to CFI testsTeresa Johnson2018-07-194-8/+19
| | | | | | | | | | | | | | | | | | Summary: Executes both LTO and ThinLTO CFI tests an additional time using the new pass manager. I only bothered to add with gold and not lld as testing with one linker should be sufficient. I didn't add for APPLE or WIN32 since I don't have a way to test those. Depends on D49429. Reviewers: pcc Subscribers: dberris, mgorny, mehdi_amini, delcypher, dexonsmith, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D49432 llvm-svn: 337465
* [XRay][compiler-rt] Profiling: No files when emptyDean Michael Berris2018-07-192-2/+2
| | | | | | | | | This change makes it so that the profiling mode implementation will only write files when there are buffers to write. Before this change, we'd always open a file even if there were no profiles collected when flushing. llvm-svn: 337443
* [libFuzzer] quick hack to fix the botKostya Serebryany2018-07-191-0/+1
| | | | llvm-svn: 337436
* [libFuzzer] first experimental attempt at DFT-based mutations ↵Kostya Serebryany2018-07-191-6/+12
| | | | | | (DFT=data-flow-trace) llvm-svn: 337434
* Remove scheduling dependency from XRay :: Posix/fork_basic_logging.ccMatthew Voss2018-07-191-2/+2
| | | | | | | | | | | | | | | | | | | Summary: We've been seeing intermittent failures on our internal bots and we suspect this may be due to the OS scheduling the child process to run before the parent process. This version ensures that the parent and child can be run in either order. Reviewers: Maknee, dberris Reviewed By: dberris Subscribers: delcypher, #sanitizers, Maknee, llvm-commits Differential Revision: https://reviews.llvm.org/D49501 llvm-svn: 337432
* Rename __asan_gen_* symbols to ___asan_gen_*.Peter Collingbourne2018-07-182-7/+7
| | | | | | | | | | This prevents gold from printing a warning when trying to export these symbols via the asan dynamic list after ThinLTO promotes them from private symbols to external symbols with hidden visibility. Differential Revision: https://reviews.llvm.org/D49498 llvm-svn: 337428
* [XRay][compiler-rt] FDR Mode: Allow multiple runsDean Michael Berris2018-07-181-0/+76
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Fix a bug in FDR mode which didn't allow for re-initialising the logging in the same process. This change ensures that: - When we flush the FDR mode logging, that the state of the logging implementation is `XRAY_LOG_UNINITIALIZED`. - Fix up the thread-local initialisation to use aligned storage and `pthread_getspecific` as well as `pthread_setspecific` for the thread-specific data. - Actually use the pointer provided to the thread-exit cleanup handling, instead of assuming that the thread has thread-local data associated with it, and reaching at thread-exit time. In this change we also have an explicit test for two consecutive sessions for FDR mode tracing, and ensuring both sessions succeed. Reviewers: kpw, eizan Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D49359 llvm-svn: 337341
* [libFuzzer] Mutation tracking and logging implemented.Max Moroz2018-07-171-0/+5
| | | | | | | | | | | | | | | | | | | Summary: Code now exists to track number of mutations that are used in fuzzing in total and ones that produce new coverage. The stats are currently being dumped to the command line. Patch by Kodé Williams (@kodewilliams). Reviewers: metzman, Dor1s, morehouse, kcc Reviewed By: Dor1s, morehouse, kcc Subscribers: delcypher, kubamracek, kcc, morehouse, llvm-commits, #sanitizers, mgorny Differential Revision: https://reviews.llvm.org/D48054 llvm-svn: 337324
* libFuzzer: prevent irrelevant strings from leaking into auto-dictionaryMatt Morehouse2018-07-171-2/+2
| | | | | | | | | | | | | | | | This is a fix for bug 37047. https://bugs.llvm.org/show_bug.cgi?id=37047 Implemented by basically reversing the logic. Previously all strings were considered, with some operations excluded. Now strings are excluded by default, and only strings during the CB considered. Patch By: pdknsk Differential Revision: https://reviews.llvm.org/D48800 llvm-svn: 337296
* [libFuzzer] Avoid STL in MSan test.Matt Morehouse2018-07-162-1/+27
| | | | | | | | | | | | | | | | Summary: STL can cause MSan false positives if lib[std]c++ isn't instrumented with MSan. Reviewers: kcc Reviewed By: kcc Subscribers: Dor1s, llvm-commits Differential Revision: https://reviews.llvm.org/D49404 llvm-svn: 337224
* Revert r337194 (https://reviews.llvm.org/D48891) due to compilation errors.Max Moroz2018-07-161-5/+0
| | | | llvm-svn: 337206
* [cmake][libFuzzer] fixup r337193 to ensure msan/dfsan are not addedAlex Lorenz2018-07-161-1/+7
| | | | | | to test deps for libfuzzer when they're not supported by the platform llvm-svn: 337203
* [libFuzzer] Mutation tracking and logging implemented.Max Moroz2018-07-161-0/+5
| | | | | | | | | | | | | | | | | | | Summary: Code now exists to track number of mutations that are used in fuzzing in total and ones that produce new coverage. The stats are currently being dumped to the command line. Patch by Kodé Williams (@kodewilliams). Reviewers: metzman, Dor1s, morehouse, kcc Reviewed By: Dor1s, morehouse, kcc Subscribers: delcypher, kubamracek, kcc, morehouse, llvm-commits, #sanitizers, mgorny Differential Revision: https://reviews.llvm.org/D48054 llvm-svn: 337194
* [libFuzzer] Add msan and dfsan to test deps.Matt Morehouse2018-07-161-1/+1
| | | | | | Required now that we have tests using MSan and DFSan. llvm-svn: 337193
OpenPOWER on IntegriCloud