summaryrefslogtreecommitdiffstats
path: root/compiler-rt
Commit message (Collapse)AuthorAgeFilesLines
...
* [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-193-25/+29
| | | | | | | | | 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
* [XRay][compiler-rt] FDR Mode: Add extents metadata to bufferDean Michael Berris2018-07-191-2/+30
| | | | | | | | | | | | When providing raw access to the FDR mode buffers, we used to not include the extents metadata record. This oversight means that processing the buffers in-memory will lose important information that would have been written in files. This change exposes the metadata record by serializing the data similarly to how we would do it when flushing to files. llvm-svn: 337441
* [Xray] Fix allocator build, MAP_NORESERVE flag is not always supportedDavid Carlier2018-07-191-1/+6
| | | | | | | | | | | | MAP_NORESERVE is not supported or a no-op on BSD. Reviewers: dberris Reviewed By: dberris Differential Revision: https://reviews.llvm.org/D49494 llvm-svn: 337440
* [libFuzzer] fix the bot (the no-assert build)Kostya Serebryany2018-07-191-0/+1
| | | | llvm-svn: 337437
* [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-198-15/+66
| | | | | | (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
* [Fuzzer] Improve crash unwinding on FuchsiaPetr Hosek2018-07-181-36/+237
| | | | | | | | | | | | | | | | | | | | | | | | | | Fuchsia doesn't have signals; instead it expects processes to have a dedicated exception thread that binds to the process' exception port and waits for exception packets to be delivered. On the other hand, libFuzzer and sanitizer_common use expect to collect crash information via libunwind from the same thread that caused the exception. The long term fix is to improve support for remote unwinding in libunbwind, plumb this through sanitizer_common and libFuzzer, and handle the exception exclusively on the exception thread. In the meantime, this revision has the exception thread "resurrect" the crashing thread by: * saving its general purpose register state onto the crashing thread's stack, * setting the crashing thread's program counter to an assembly trampoline with the CFI information needed by libunwind, and * resuming the crashed thread. Patch By: aarongreen Differential Revision: https://reviews.llvm.org/D48509 llvm-svn: 337418
* [libFuzzer] Create single template for visiting Inline8bitCountersMax Moroz2018-07-182-27/+25
| | | | | | | | | | | | | | | | | | Summary: Created IterateInline8bitCounters, a single template for visiting Inline8bitCounters (nested for loop) Made InitializeUnstableCounters and UpdateUnstableCounters both send a lambda to IterateInline8bitCounters. Patch by Kyungtak Woo (@kevinwkt). Reviewers: Dor1s, metzman, kcc, morehouse Reviewed By: metzman, morehouse Subscribers: delcypher, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D49453 llvm-svn: 337403
* [XRay][compiler-rt] Segmented Array: Simplify and OptimiseDean Michael Berris2018-07-185-232/+215
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This is a follow-on to D49217 which simplifies and optimises the implementation of the segmented array. In this patch we co-locate the book-keeping for segments in the `__xray::Array<T>` with the data it's managing. We take the chance in this patch to actually rename `Chunk` to `Segment` to better align with the high-level description of the segmented array. With measurements using benchmarks landed in D48879, we've identified that calls to `pthread_getspecific` started dominating the cycles, which led us to revert the change made in D49217 to use C++ thread_local initialisation instead (it reduces the cost by a huge margin, since we save one PLT-based call to pthread functions in the hot path). In particular, this is in `__xray::getThreadLocalData()`. We also took the opportunity to remove the least-common-multiple based calculation and instead pack as much data into segments of the array. This greatly simplifies the API of the container which hides as much of the implementation details as possible. For instance, we calculate the number of elements we need for the each segment internally in the Array instead of making it part of the type. With the changes here, we're able to get a measurable improvement on the performance of profiling mode on top of what D48879 already provides. Depends on D48879. Reviewers: kpw, eizan Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D49363 llvm-svn: 337343
* [XRay][compiler-rt] Simplify Allocator ImplementationDean Michael Berris2018-07-1810-216/+245
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This change simplifies the XRay Allocator implementation to self-manage an mmap'ed memory segment instead of using the internal allocator implementation in sanitizer_common. We've found through benchmarks and profiling these benchmarks in D48879 that using the internal allocator in sanitizer_common introduces a bottleneck on allocating memory through a central spinlock. This change allows thread-local allocators to eliminate contention on the centralized allocator. To get the most benefit from this approach, we also use a managed allocator for the chunk elements used by the segmented array implementation. This gives us the chance to amortize the cost of allocating memory when creating these internal segmented array data structures. We also took the opportunity to remove the preallocation argument from the allocator API, simplifying the usage of the allocator throughout the profiling implementation. In this change we also tweak some of the flag values to reduce the amount of maximum memory we use/need for each thread, when requesting memory through mmap. Depends on D48956. Reviewers: kpw, eizan Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D49217 llvm-svn: 337342
* [XRay][compiler-rt] FDR Mode: Allow multiple runsDean Michael Berris2018-07-182-33/+126
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-177-21/+55
| | | | | | | | | | | | | | | | | | | 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
* [builtins] Implement the __chkstk function for ARM for MinGWMartin Storsjo2018-07-172-0/+35
| | | | | | | | | | This function is available for linking in from kernel32.dll, but it's not allowed to link that function from there in Windows Store apps. Differential Revision: https://reviews.llvm.org/D49055 llvm-svn: 337313
* libFuzzer: prevent irrelevant strings from leaking into auto-dictionaryMatt Morehouse2018-07-178-28/+20
| | | | | | | | | | | | | | | | 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-167-41/+5
| | | | 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
* [CMake] Use cxx-headers as a depedency for C++ headersPetr Hosek2018-07-162-4/+4
| | | | | | | | | | | | We no longer pass CLANG_DEFAULT_CXX_STDLIB to the runtimes build as it was causing issues so we can no longer use this variable. We instead use cxx-headers as a dependency whenever this is available since both XRay and libFuzzer are built as static libraries so this is sufficient. Differential Revision: https://reviews.llvm.org/D49346 llvm-svn: 337199
* [libFuzzer] Mutation tracking and logging implemented.Max Moroz2018-07-167-5/+41
| | | | | | | | | | | | | | | | | | | 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
* [libFuzzer] Implement stat::stability_rate based on the percentage of ↵Max Moroz2018-07-169-0/+159
| | | | | | | | | | | | | | | | | | | | | unstable edges. Summary: Created a -print_unstable_stats flag. When -print_unstable_stats=1, we run it 2 more times on interesting inputs poisoning unstable edges in an array. On program termination, we run PrintUnstableStats() which will print a line with a stability percentage like AFL does. Patch by Kyungtak Woo (@kevinwkt). Reviewers: metzman, Dor1s, kcc, morehouse Reviewed By: metzman, Dor1s, morehouse Subscribers: delcypher, llvm-commits, #sanitizers, kcc, morehouse, Dor1s Differential Revision: https://reviews.llvm.org/D49212 llvm-svn: 337187
* Revert r337175 (https://reviews.llvm.org/D49212) due to unintentional format ↵Max Moroz2018-07-169-190/+31
| | | | | | changes. llvm-svn: 337180
* Fix warnings in a static assert added to CFI.Chandler Carruth2018-07-161-1/+2
| | | | llvm-svn: 337178
* Test commitHenry Zhu2018-07-161-1/+1
| | | | llvm-svn: 337176
* [libFuzzer] Implement stat::stability_rate based on the percentage of ↵Max Moroz2018-07-169-31/+190
| | | | | | | | | | | | | | | | | | | | | unstable edges. Summary: Created a -print_unstable_stats flag. When -print_unstable_stats=1, we run it 2 more times on interesting inputs poisoning unstable edges in an array. On program termination, we run PrintUnstableStats() which will print a line with a stability percentage like AFL does. Patch by Kyungtak Woo (@kevinwkt). Reviewers: metzman, Dor1s, kcc, morehouse Reviewed By: metzman, Dor1s, morehouse Subscribers: delcypher, llvm-commits, #sanitizers, kcc, morehouse, Dor1s Differential Revision: https://reviews.llvm.org/D49212 llvm-svn: 337175
* [gcov] Add a test showing differences in line counts when building with or ↵Marco Castelluccio2018-07-163-0/+48
| | | | | | | | without exceptions enabled. Test for https://bugs.llvm.org/show_bug.cgi?id=38066. llvm-svn: 337174
* [cfi] Don't pass a uint16_t to memset. Make sure the 16-bit constant is ↵Filipe Cabecinhas2018-07-161-1/+4
| | | | | | | | | | | | appropriate for us. Reviewers: eugenis, pcc, kcc Subscribers: delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D49252 llvm-svn: 337170
* Add a test with __gcov_flush called before terminating the program.Marco Castelluccio2018-07-163-0/+43
| | | | | | Test for https://bugs.llvm.org/show_bug.cgi?id=38067. llvm-svn: 337150
* [XRay][compiler-rt] Use `SANITIZER_CXX_ABI_LIBRARY` for XRay unit testsDean Michael Berris2018-07-161-2/+2
| | | | | | | | | | | | | | | | | | Summary: Fix a TODO in CMake config for XRay tests to use the detected C++ ABI library in the tests. Also make the tests depend on the llvm-xray target when built in-tree. Reviewers: kpw, eizan Reviewed By: eizan Subscribers: mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D49358 llvm-svn: 337142
* [CMake] Change the flag to use compiler-rt builtins to booleanPetr Hosek2018-07-152-12/+9
| | | | | | | | | | | | This changes the name and the type to what it was prior to r333037 which matches the name of the flag used in other runtimes: libc++, libc++abi and libunwind. We don't need the type to be a string since there's only binary choice between libgcc and compiler-rt unlike in the case of C++ library where there're multiple options. Differential Revision: https://reviews.llvm.org/D49325 llvm-svn: 337116
* [UBSan] Followup for silence_unsigned_overflow flag to handle negate overflows.Max Moroz2018-07-132-1/+6
| | | | | | | | | | | | | | | | | | | | Summary: That flag has been introduced in https://reviews.llvm.org/D48660 for suppressing UIO error messages in an efficient way. The main motivation is to be able to use UIO checks in builds used for fuzzing as it might provide an interesting signal to a fuzzing engine such as libFuzzer. See https://github.com/google/oss-fuzz/issues/910 for more information. Reviewers: morehouse, kcc Reviewed By: morehouse Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D49324 llvm-svn: 337068
* Fix for Darwin buildbot failure due to r337037Vlad Tsyrklevich2018-07-131-2/+3
| | | | | | | Duplicate __get_unsafe_stack_bottom instead of using an alias for platforms that don't suppport it like Darwin. llvm-svn: 337044
* SafeStack: Add builtins to read unsafe stack top/bottomVlad Tsyrklevich2018-07-131-1/+10
| | | | | | | | | | | | | | | | | | | | Summary: Introduce built-ins to read the unsafe stack top and bottom. The unsafe stack top is required to implement garbage collection scanning for Oilpan. Currently there is already a built-in 'get_unsafe_stack_start' to read the bottom of the unsafe stack, but I chose to duplicate this API because 'start' is ambiguous (e.g. Oilpan uses WTF::GetStackStart to read the safe stack top.) Reviewers: pcc Reviewed By: pcc Subscribers: llvm-commits, kcc Differential Revision: https://reviews.llvm.org/D49152 llvm-svn: 337037
* [CMake] Don't use CLANG_DEFAULT_* valuesPetr Hosek2018-07-131-7/+2
| | | | | | | | | | | | | | These are not necessarily correct, just because Clang is configured to use libc++ or compiler-rt as defaults doesn't mean that the host compiler uses these as defaults as well. A more correct solution would be to test the host compiler to check what the default actually is as attempted in D46857. Part of PR-38025. Differential Revision: https://reviews.llvm.org/D49272 llvm-svn: 337033
* [sanitizer] Use -Wl,-z,global on AndroidKostya Kortchinsky2018-07-133-28/+8
| | | | | | | | | | | | | | | | | | | | | | | Summary: Use `-Wl,-z,global` for all Sanitizer shared libraries on Android. We want them to be in the global group (https://android.googlesource.com/platform/bionic/+/master/android-changes-for-ndk-developers.md#changes-to-library-search-order) to avoid any alloc/dealloc mismatch between the libc allocator & said library. `audioserver` was one of the binary that exhibited the problem with Scudo, this seems to fix it. [edited for accuracy] Reviewers: eugenis, alekseyshl Reviewed By: eugenis Subscribers: kubamracek, srhines, mgorny, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D49198 llvm-svn: 337010
* Add a test with multiple BBs on the same lineMarco Castelluccio2018-07-133-0/+67
| | | | | | Test for https://bugs.llvm.org/show_bug.cgi?id=38065. llvm-svn: 336996
* Remove `tsan/Darwin/gcd-after-null.mm` test.Dan Liew2018-07-131-23/+0
| | | | | | | | | | | | | | | | | Summary: This test invokes undocumented behaviour that could change in the future. Given this, it's probably best to just remove the test. rdar://problem/42022283 Reviewers: kubamracek Subscribers: llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D49269 llvm-svn: 336977
* [XRay][compiler-rt] Add PID field to llvm-xray tool and add PID metadata ↵Dean Michael Berris2018-07-138-40/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | record entry in FDR mode Summary: llvm-xray changes: - account-mode - process-id {...} shows after thread-id - convert-mode - process {...} shows after thread - parses FDR and basic mode pid entries - Checks version number for FDR log parsing. Basic logging changes: - Update header version from 2 -> 3 FDR logging changes: - Update header version from 2 -> 3 - in writeBufferPreamble, there is an additional PID Metadata record (after thread id record and tsc record) Test cases changes: - fdr-mode.cc, fdr-single-thread.cc, fdr-thread-order.cc modified to catch process id output in the log. Reviewers: dberris Reviewed By: dberris Subscribers: hiraditya, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D49153 llvm-svn: 336974
* [XRay][compiler-rt] Profiling Mode: Flush logs on exitDean Michael Berris2018-07-135-36/+81
| | | | | | | | | | | | | | | | | Summary: This change adds support for writing out profiles at program exit. Depends on D48653. Reviewers: kpw, eizan Reviewed By: kpw Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D48956 llvm-svn: 336969
* [fuzzer] [tests] Increase the number of iterations for three-bytes.testGeorge Karpenkov2018-07-131-1/+1
| | | | | | | | The test is flaky otherwise on some of our macOS machines in the test fleet. Differential Revision: https://reviews.llvm.org/D49277 llvm-svn: 336966
* [CMake] Fix a typo in the variable used to retrieve source file namesDan Liew2018-07-121-2/+1
| | | | | | | | for the `RTHwasan_dynamic` target. Differential Revision: https://reviews.llvm.org/D49178 llvm-svn: 336944
* Simplify instrprof-dlopen-dlclose-gcov.test to avoid failures on Aarch64.Marco Castelluccio2018-07-126-6/+6
| | | | | | The test for a function with an if block in a single line (https://bugs.llvm.org/show_bug.cgi?id=38065) will be moved to a separate test. llvm-svn: 336942
* [SanitizerCoverage] Add associated metadata to 8-bit counters.Matt Morehouse2018-07-121-1/+3
| | | | | | | | | | | | | | | | | | | | Summary: This allows counters associated with unused functions to be dead-stripped along with their functions. This approach is the same one we used for PC tables. Fixes an issue where LLD removes an unused PC table but leaves the 8-bit counter. Reviewers: eugenis Reviewed By: eugenis Subscribers: llvm-commits, hiraditya, kcc Differential Revision: https://reviews.llvm.org/D49264 llvm-svn: 336941
* [libFuzzer] If LLD available, require it to build first.Matt Morehouse2018-07-121-0/+3
| | | | | | | Since we now have a test that requires LLD, make sure it is built before that test runs. llvm-svn: 336932
* [libFuzzer] Use lld-available for gc-sections.test.Matt Morehouse2018-07-121-2/+2
| | | | | | | The lld feature is never available for libFuzzer tests, so gc-sections.test never actually runs. llvm-svn: 336926
* [CMake] Remove unnecesary list of source files for Xray unit tests.Dan Liew2018-07-122-40/+39
| | | | | | | | | | | The list duplicates information already available in the parent directory so use that instead. It is unclear to me why we need to spell out the dependencies explicitly but fixing that should be done in a separate patch. Differential Revision: https://reviews.llvm.org/D49177 llvm-svn: 336905
* [CMake] Rename `SANITIZER_HEADERS` to `SANITIZER_IMPL_HEADERS` under ↵Dan Liew2018-07-122-11/+11
| | | | | | | | | | | | | `lib/sanitizer_common`. The variable name `SANITIZER_HEADERS` is already used for the list of public headers in `include/CMakeLists.txt`. Although the previous implementation worked it's probably best to avoid shadowing global variables to avoid confusion. Differential Revision: https://reviews.llvm.org/D49176 llvm-svn: 336904
OpenPOWER on IntegriCloud