summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* [NFC][Sanitizer] Remove GetRealFunctionAddress and replace usagesJulian Lettner2019-04-274-46/+11
| | | | | | | | Reviewers: vitalybuka Differential Revision: https://reviews.llvm.org/D61205 llvm-svn: 359362
* Revert "[sanitizer] NFC: add static_assert to confirm that we use optimal ↵JF Bastien2019-04-261-7/+3
| | | | | | | | | | | | | | | | | ByteMap type" Fails on bots with: /Users/buildslave/jenkins/workspace/clang-stage1-cmake-RA-expensive/llvm/projects/compiler-rt/lib/sanitizer_common/sanitizer_allocator_primary32.h:69:3: error: static_assert failed due to requirement 'TwoLevelByteMapSize1 > 128' "TwoLevelByteMap should be used" static_assert(TwoLevelByteMapSize1 > 128, "TwoLevelByteMap should be used"); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~ /Users/buildslave/jenkins/workspace/clang-stage1-cmake-RA-expensive/llvm/projects/compiler-rt/lib/sanitizer_common/sanitizer_allocator_combined.h:29:34: note: in instantiation of template class '__sanitizer::SizeClassAllocator32<__sanitizer::AP32>' requested here typename PrimaryAllocator::AddressSpaceView>::value, ^ http://green.lab.llvm.org/green/job/clang-stage1-cmake-RA-expensive/13960/console llvm-svn: 359352
* [Sanitizer][Windows] Speculative fix for broken build on WindowsJulian Lettner2019-04-261-2/+7
| | | | llvm-svn: 359339
* [Sanitizer] Fix testJulian Lettner2019-04-261-0/+2
| | | | | | | I broke the build, panicked and applied the wrong fix in my previous commit. The ASSERT was obsolete, but not the call INTERCEPT_FUNCTION. llvm-svn: 359336
* [Sanitizer] Fix compliation error in testJulian Lettner2019-04-261-2/+0
| | | | | | | Remove obsolete assert. I missed this in my previous patch: https://reviews.llvm.org/D61145 llvm-svn: 359335
* Implement __sanitizer::conditional<B, T, F>Vitaly Buka2019-04-262-0/+24
| | | | llvm-svn: 359334
* [sanitizer] NFC: add static_assert to confirm that we use optimal ByteMap typeVitaly Buka2019-04-261-3/+7
| | | | | | | | | | | | | | Summary: If bots work we can replace #ifs with template specialization by TwoLevelByteMapSize1. Reviewers: eugenis Subscribers: kubamracek, #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D61200 llvm-svn: 359333
* [NFC][Sanitizer] Change "return type" of INTERCEPT_FUNCTION to voidJulian Lettner2019-04-263-8/+18
| | | | | | | | | | | | This temporary change tells us about all the places where the return value of the INTERCEPT_FUNCTION macro is actually used. In the next patch I will cleanup the macro and remove GetRealFuncAddress. Reviewed By: vitalybuka Differential Revision: https://reviews.llvm.org/D61145 llvm-svn: 359325
* [NFC] Remove ::kForTest from AP64, it does not use it.Vitaly Buka2019-04-262-8/+8
| | | | llvm-svn: 359323
* [asan_symbolize] Teach `asan_symbolize.py` to symbolicate using a module mapDan Liew2019-04-261-0/+243
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* [lsan] Use SANITIZER_WORDSIZE when selecting ByteMapVitaly Buka2019-04-265-13/+34
| | | | | | | Originally this code was added for 64-bit platform and it was never update. Add static_assert to validate type of ByteMap. llvm-svn: 359286
* Revert "[lsan] Use SANITIZER_WORDSIZE when selecting ByteMap"Vitaly Buka2019-04-265-34/+13
| | | | | | | | New static_assert fails on a bot. This reverts commit r359269. llvm-svn: 359276
* NFC: Clang-format msan_allocator.ccVitaly Buka2019-04-261-61/+61
| | | | llvm-svn: 359270
* [lsan] Use SANITIZER_WORDSIZE when selecting ByteMapVitaly Buka2019-04-265-13/+34
| | | | | | | Originally this code as added for 64-bit platform and was never changed. Add static_assert to make sure that we have correct map on all platforms. llvm-svn: 359269
* [libFuzzer] Disable MSan interceptors in SIGINT handler.Matt Morehouse2019-04-261-1/+2
| | | | | | | | | | | | | | | | | | | | | | 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
* [NFC][Sanitizer] Extract GetFuncAddr from GetRealFunctionAddressJulian Lettner2019-04-253-9/+20
| | | | | | | | | | | | | | Summary: Hopefully, this will enable cleanup/removal of GetRealFunctionAddress in follow-up commits. Subscribers: #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D61110 llvm-svn: 359213
* [scudo][standalone] Introduce the SizeClassMapKostya Kortchinsky2019-04-255-1/+190
| | | | | | | | | | | | | | | | | | | | | | Summary: As with the sanitizer_common allocator, the SCM allows for efficient mapping between sizes and size-classes, table-free. It doesn't depart significantly from the original, except that we allow the use of size-class 0 for other purposes (as opposed to chunks of size 0). The Primary will use it to hold TransferBatches. Reviewers: vitalybuka, eugenis, hctim, morehouse Reviewed By: vitalybuka Subscribers: srhines, mgorny, delcypher, #sanitizers, llvm-commits Tags: #llvm, #sanitizers Differential Revision: https://reviews.llvm.org/D61088 llvm-svn: 359199
* [sanitizer_common] Remove some old commented-out printf statements, and ↵Mitch Phillips2019-04-241-6/+1
| | | | | | fixed up the order of includes. llvm-svn: 359150
* [compiler-rt] NFC fixed [whitespace/braces] LINT warningVitaly Buka2019-04-241-1/+1
| | | | llvm-svn: 359133
* [compiler-rt] Fix warning about virtual destructor in sanitizer_flag_parser.hVitaly Buka2019-04-241-0/+3
| | | | llvm-svn: 359125
* [llvm-symbolizer] Quick fix for broken sanitizer botMitch Phillips2019-04-241-0/+1
| | | | | | | | | | | | | | | | | | | (sanitizer-x86_64-linux) until I can triage the issue properly. The build has been broken due to the symbolizer build checks failing. As the symbolizer build script relies on the old svn repo layout, it may take a little while longer to find the responsible patch for the breakage. This may be a completely valid fix, but I will need to confirm it. For now, it unbreaks the build. Tracking data: Build where the break first occurred: http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux/builds/21211 Changelist authors: @grimar, @maskray, @whitequark, @spatel, @dpreobra For the authors, no action needed (yet). Will follow up when I can identify the cause. llvm-svn: 359123
* [scudo][standalone] Introduce the Secondary allocatorKostya Kortchinsky2019-04-2414-88/+476
| | | | | | | | | | | | | | | | | | | | | | | | Summary: The Secondary allocator wraps the platform allocation primitives. It is meant to be used for larger sizes that the Primary can't fullfill, as it will be slower, and sizes are multiple of the system page size. This also changes some of the existing code, notably the opaque platform data being passed to the platform specific functions: we can shave a couple of syscalls on Fuchsia by storing additional data (this addresses a TODO). Reviewers: eugenis, vitalybuka, hctim, morehouse Reviewed By: morehouse Subscribers: mgorny, delcypher, jfb, #sanitizers, llvm-commits Tags: #llvm, #sanitizers Differential Revision: https://reviews.llvm.org/D60787 llvm-svn: 359097
* The error message for mismatched value sites is very cryptic.Dmitry Mikulin2019-04-232-6/+6
| | | | | | | | Make it more readable for an average user. Differential Revision: https://reviews.llvm.org/D60896 llvm-svn: 359043
* [TSan] Support fiber API on macOSJulian Lettner2019-04-206-22/+56
| | | | | | | | | | | | | | 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
* [CMake] Add fuzzer as a component for runtime buildsChris Bieneman2019-04-191-0/+2
| | | | | | Calling `add_compiler_rt_component` sets up the component connection between runtime builds and the parent CMake configuration. Adding this call allows specifying `fuzzer` as a `LLVM_RUNTIME_DISTRIBUTION_COMPONENT`. llvm-svn: 358780
* [gn] Support dots in CMake paths in the sync scriptPetr Hosek2019-04-191-1/+0
| | | | | | | | Some file paths use dots to pick up sources from parent directories. Differential Revision: https://reviews.llvm.org/D60734 llvm-svn: 358774
* [libFuzzer] revert part of r358726 committed by mistake (oops)Kostya Serebryany2019-04-191-1/+0
| | | | llvm-svn: 358727
* [libFuzzer] in fork mode, make sure the child stats are always collected. ↵Kostya Serebryany2019-04-192-2/+4
| | | | | | This should fix the flakiness in fork-ubsan.test llvm-svn: 358726
* [builtins] Build x86_64 with GENERIC_TF_SOURCESYi Kong2019-04-181-0/+1
| | | | llvm-svn: 358706
* Summary:Jonathan Metzman2019-04-181-15/+75
| | | | | | | | | | | | | | | | | | | | | | 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] Workaround bug in old Python 2 versions.Dan Liew2019-04-181-2/+7
| | | | | | | | | | | | | | | | | | | | | The change landed in r358657 broke some of the buildbots because they use an older version of Python 2 that raises this error. ``` File "/Volumes/data/dev/llvm/upstream/master/src/projects/compiler-rt/lib/asan/scripts/asan_symbolize.py", line 509 exec(f.read(), globals_space, None) SyntaxError: unqualified exec is not allowed in function 'load_plugin_from_file' it contains a nested function with free variables ``` I can reproduce this problem when using Python 2.7.6. To workaround this some indirection has been added to prevent the broken (the line at fault would never be executed) SyntaxError error in old Python versions from being raised. rdar://problem/49476995 llvm-svn: 358682
* [asan_symbolize] Add a simple plugin architectureDan Liew2019-04-181-48/+235
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* [builtins] Add __cmpsf2 for ARM version of comparesf2Yi Kong2019-04-171-0/+5
| | | | | | | | | The generic version of comparesf2 defines __cmpsf2 alias for libgcc compatibility, but the ARM overlay is missing the alias. Differential Revision: https://reviews.llvm.org/D60805 llvm-svn: 358542
* [HWASan] Fixed slow DWARF unwinding.Mitch Phillips2019-04-161-3/+3
| | | | | | | | | | | | | | | | Summary: CFA was setup incorrectly, as there is an 8-byte gap at the top of the stack for SP 16-byte alignment purposes. Reviewers: eugenis Reviewed By: eugenis Subscribers: kubamracek, javed.absar, #sanitizers, llvm-commits, pcc Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D60798 llvm-svn: 358535
* [libFuzzer] Remove tautological compare.Matt Morehouse2019-04-161-2/+1
| | | | llvm-svn: 358510
* [libFuzzer] speedup the merge step in the fork mode by merging only the ↵Kostya Serebryany2019-04-132-8/+34
| | | | | | files that have unique features. llvm-svn: 358320
* [libFuzzer] add -features_dir= flag to dump unique input features on diskKostya Serebryany2019-04-139-6/+53
| | | | llvm-svn: 358317
* [libFuzzer] Fix DataFlow.cpp logic when tracing long inputs.Max Moroz2019-04-122-11/+18
| | | | | | | | | | | | | | | | | | | | | | | | | 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
* [libFuzzer] support -runs=N in the fork mode. Make sure we see one-line ↵Kostya Serebryany2019-04-121-1/+9
| | | | | | reports from ubsan in the fork mode. Test both llvm-svn: 358306
* [libFuzzer] Make MutateWithMask work when the Mask is shorter than the input.Max Moroz2019-04-111-3/+3
| | | | | | | | | | | | | | | | | | | Summary: Before this change, MutateWithMask used to assert that Mask should be of sufficient length (>= Size of the input). However, in real cases we may have inputs that are longer than the Mask they have inherited from the based inputs. Reviewers: kcc, morehouse Reviewed By: kcc Subscribers: delcypher, #sanitizers, llvm-commits Tags: #llvm, #sanitizers Differential Revision: https://reviews.llvm.org/D60571 llvm-svn: 358207
* Revert "tsan: Update test expectations."Matt Morehouse2019-04-111-2/+2
| | | | | | This reverts r357831 to go with r358113. llvm-svn: 358202
* [libFuzzer] Fallback to default Mutate when MutateWithMask fails.Max Moroz2019-04-112-1/+4
| | | | | | | | | | | | | | | | | | | | | | Summary: In case the current corpus input doesn't have bytes going into the focus function, MutateWithMask is useless and may fail gently, allowing the default mutation routine happen, rather than crashing on an assertion. For more context and the initial fix suggestion, see: https://github.com/google/oss-fuzz/issues/1632#issuecomment-481862879 Reviewers: kcc, morehouse Reviewed By: kcc Subscribers: delcypher, #sanitizers, llvm-commits Tags: #llvm, #sanitizers Differential Revision: https://reviews.llvm.org/D60567 llvm-svn: 358190
* [NFC] Use clearer naming for local variablesJF Bastien2019-04-102-16/+16
| | | | llvm-svn: 358145
* [scudo][standalone] Add flags & related parsersKostya Kortchinsky2019-04-099-0/+510
| | | | | | | | | | | | | | | | | | | | | | | Summary: As with other Sanitizers, and the current version of Scudo, we can provide flags in differents way: at compile time, through a weak function, through an environment variable. This change adds support for the configuration flags, and the string parsers. Those are fairly similar to the sanitizer_common way of doing things. Reviewers: morehouse, hctim, vitalybuka Reviewed By: morehouse, vitalybuka Subscribers: mgorny, delcypher, jdoerfert, #sanitizers, llvm-commits Tags: #llvm, #sanitizers Differential Revision: https://reviews.llvm.org/D59597 llvm-svn: 358011
* [asan_symbolize] Move argument parser epilog text into script doc comment.Dan Liew2019-04-091-3/+5
| | | | | | | | | | | | | | | | | | Summary: This will make it easier to expand on the documentation in the future that avoids cluttering the code. rdar://problem/49476995 Reviewers: kubamracek, yln, samsonov, dvyukov, vitalybuka Subscribers: #sanitizers, llvm-commits Tags: #llvm, #sanitizers Differential Revision: https://reviews.llvm.org/D60398 llvm-svn: 357978
* [asan_symbolize] Use proper logging infrastructure.Dan Liew2019-04-081-14/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The previous logging infrastructure had several problems: * Debugging output was emitted to standard output which is also where the symbolized output would go. Interleaving these two separate bits of information makes inspecting the output difficult and could potentially break tests. * Enabling debugging output requires modifying the script which is not very conveninent. * When debugging it isn't immediately obvious where the output is coming from. This patch uses the Python standard library logging infrastructure which fixes all of the above problems. Logging is controlled using two new options. * `--log-level` - Sets the logging level, default is `info`. * `--log-dest` - Set the logging destination, default is standard error. Some simple test cases for the feature are included. rdar://problem/49476995 Reviewers: kubamracek, yln, samsonov, dvyukov, vitalybuka Subscribers: #sanitizers, llvm-commits Tags: #llvm, #sanitizers Differential Revision: https://reviews.llvm.org/D60343 llvm-svn: 357951
* [Sanitizer] Fix a possible write to freed memory in the wcrtomb interceptorPavel Labath2019-04-081-7/+10
| | | | | | | | | | | | | | | | | | Summary: r357240 added an interceptor for wctomb, which uses a temporary local buffer to make sure we don't write to unallocated memory. This patch applies the same technique to wcrtomb, and adds some additional tests for this function. Reviewers: vitalybuka, eugenis Subscribers: kubamracek, delcypher, llvm-commits, #sanitizers Tags: #llvm, #sanitizers Differential Revision: https://reviews.llvm.org/D59984 llvm-svn: 357889
* tsan: Update test expectations.Peter Collingbourne2019-04-061-2/+2
| | | | llvm-svn: 357831
* [gn] Support for building compiler-rt builtinsPetr Hosek2019-04-051-81/+111
| | | | | | | | | | | | | | | | This is support for building compiler-rt builtins, The library build should be complete for a subset of supported platforms, but not all CMake options have been replicated in GN. We always use the just built compiler to build all the runtimes, which is equivalent to the CMake runtimes build. This simplifies the build configuration because we don't need to support arbitrary host compiler and can always assume the latest Clang. With GN's toolchain support, this is significantly more efficient than the CMake runtimes build. Differential Revision: https://reviews.llvm.org/D60331 llvm-svn: 357821
* Use binary write mode in WriteToFile function to avoid appended \r ↵Vitaly Buka2019-04-051-1/+1
| | | | | | | | | | | | | | | | | | | | | characters on Windows Summary: When using libfuzzer on Windows, in the contents of a crash sample, bytes that can be mistaken for a \n are replaced by a \r\n sequence. As a consequence, crashes are not reproducible. This patch will open files in binary mode to fix this issue. The patch does not affect POSIX systems. Patch by tuktuk Reviewers: kcc, vitalybuka Reviewed By: vitalybuka Subscribers: dexonsmith, jdoerfert, llvm-commits, #sanitizers Tags: #llvm, #sanitizers Differential Revision: https://reviews.llvm.org/D60008 llvm-svn: 357807
OpenPOWER on IntegriCloud