summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/fuzzer
Commit message (Collapse)AuthorAgeFilesLines
...
* [libFuzzer] extend the -fork=1 functionality. Still not fully usable, but ↵Kostya Serebryany2019-02-1211-35/+108
| | | | | | good enough for the first unit test llvm-svn: 353775
* [Fuzzer] Fix function prototype in fuzzer::ExternalFunctions. [NFC]David L. Jones2019-02-091-1/+1
| | | | | | | | | | | | | | The __sanitizer_acquire_crash_state function has int return type, but the fuzzer's external function definitions give it bool. Places where __sanitizer_acquire_crash_state is declared: include/sanitizer_common/sanitizer_interface_defs.h lib/sanitizer_common/sanitizer_interface_internal.h lib/sanitizer_common/sanitizer_common.cc lib/fuzzer/FuzzerExtFunctions.def (this is the only bool) llvm-svn: 353596
* [libFuzzer] more refactoring; change some of the exit codes (timeout, OOM, ↵Kostya Serebryany2019-02-096-39/+57
| | | | | | interrupt) so that the parent process can distinguish those llvm-svn: 353584
* [libFuzzer] refactor the merging code, NFCKostya Serebryany2019-02-083-37/+52
| | | | llvm-svn: 353576
* [libFuzzer] remove two unused experimental flagsKostya Serebryany2019-02-085-64/+4
| | | | llvm-svn: 353573
* [libFuzzer] introduce an experimental mode -fork=1, where fuzzing happens in ↵Kostya Serebryany2019-02-087-52/+89
| | | | | | a subprocess (still running multiple inputs per process), thus making the fuzzing more resilient to timeouts and OOMs. This is just a skeleton of the code, and some associated refactoring, not a fully working feature yet. llvm-svn: 353570
* [libFuzzer] refactor the way we choose the element to cross-over with, NFC ↵Kostya Serebryany2019-02-086-19/+43
| | | | | | (expected1); add a flag -seed_inputs= to pass extra seed inputs as file paths, not dirs llvm-svn: 353494
* [libFuzzer][Windows] Clean up RawPrintJonathan Metzman2019-02-041-2/+1
| | | | | | | | | | | | | | | | Summary: Use `_write` instead of the deprecated alias `write` on Windows. Also, remove comment saying RawPrint is untested on Windows. Reviewers: vitalybuka Reviewed By: vitalybuka Subscribers: vitalybuka Differential Revision: https://reviews.llvm.org/D57589 llvm-svn: 353108
* [fuzzer] Use RawPrint instead of Printf for instrumentation warningJonathan Metzman2019-01-312-7/+11
| | | | | | | | | | | | | | | Summary: Use RawPrint instead of Printf for instrumentation warning because Printf doesn't work on Win when instrumentation is being initialized (since OutputFile is not yet initialized). Reviewers: kcc Reviewed By: kcc Differential Revision: https://reviews.llvm.org/D57531 llvm-svn: 352789
* Revert r352732: [libFuzzer] replace slow std::mt19937 with a much faster ↵Jeremy Morse2019-01-311-3/+3
| | | | | | | | | | std::minstd_rand This causes a failure on the following bot as well as our internal ones: http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fuzzer/builds/23103 llvm-svn: 352747
* [libFuzzer] replace slow std::mt19937 with a much faster std::minstd_randKostya Serebryany2019-01-311-3/+3
| | | | llvm-svn: 352732
* [libFuzzer] set libFuzzer's own SEGV handler even one is already present, ↵Kostya Serebryany2019-01-314-13/+18
| | | | | | but call that handler from ours (unless we are unprotecting lazy counters). Call ProtectLazyCounters later, so that it runs after the initialization code in the target. llvm-svn: 352713
* [libFuzzer] Set default sanitizer options in fuzzer testsJulian Lettner2019-01-311-2/+3
| | | | | | | | | | | | | | | | | | | | | Summary: Set default `ASAN_OPTIONS` when running libFuzzer tests. This allows us to remove special casing in code for Darwin where we usually pass `abort_on_error=0` to override platform defaults for tests. A previous commit changed the code to make the tests pass: https://github.com/llvm/llvm-project/commit/7764a04af007eca68eafcf5caaea560ed05e35a9 Adapted a few tests to use `%env_asan_opts=` instead of directly setting the environment variable. rdar://problem/47515276 Reviewers: kcc, george.karpenkov Differential Revision: https://reviews.llvm.org/D57465 llvm-svn: 352711
* [libFuzzer] experimental performance optimization -lazy_counters, off by ↵Kostya Serebryany2019-01-3111-1/+78
| | | | | | default. Posix-only for now, tested on Linux llvm-svn: 352700
* [libFuzzer] remove stale code, NFCKostya Serebryany2019-01-309-346/+0
| | | | llvm-svn: 352604
* [libFuzzer] refactor the handling of instrumentation counters so that they ↵Kostya Serebryany2019-01-303-47/+107
| | | | | | are grouped in regions one full page each. Needed for future optimization. NFC llvm-svn: 352603
* [libFuzzer] remove stale code Kostya Serebryany2019-01-296-113/+3
| | | | llvm-svn: 352571
* [libFuzzer] revert an accidental commitKostya Serebryany2019-01-291-3/+35
| | | | llvm-svn: 352567
* [libFuzzer] remove deprecated support for -fsanitize-coverage=trace-pc[-guard]Kostya Serebryany2019-01-291-35/+3
| | | | llvm-svn: 352566
* [libFuzzer] remove deprecated support for -fsanitize-coverage=trace-pc[-guard]Kostya Serebryany2019-01-291-9/+12
| | | | llvm-svn: 352564
* [libFuzzer][Windows] Use dllexport for all declarations in FuzzerInterface.hJonathan Metzman2019-01-281-1/+1
| | | | | | | | | | | | | | | | | Summary: Use dllexport for all declarations in FuzzerInterface.h Use it for clang even though clang supports default visibility attribute to prevent a warning from being thrown when LLVMFuzzerMutate is defined with dllexport. This makes `FUZZER_INTERFACE_VISIBILITY` (FuzzerInterface.h) consistent with `ATTRIBUTE_INTERFACE` (FuzzerDefs.h) when using clang on Windows. Reviewers: vitalybuka, morehouse Reviewed By: morehouse Differential Revision: https://reviews.llvm.org/D57305 llvm-svn: 352395
* [fuzzer][afl] Remove AFL_DRIVER_EXTRA_STATS_FILENAMEJonathan Metzman2019-01-281-165/+4
| | | | | | | | | | | | | | Summary: Remove this feature as it is unused, buggy, and not worth correcting since the forkserver makes it difficult. Reviewers: morehouse, jfb Reviewed By: morehouse Differential Revision: https://reviews.llvm.org/D57308 llvm-svn: 352392
* [libFuzzer] print uncovered functions when doing -print_coverage=1Kostya Serebryany2019-01-261-6/+6
| | | | llvm-svn: 352263
* [libFuzzer][MSVC] Disable exceptions in MSVC headersJonathan Metzman2019-01-251-3/+4
| | | | | | | | | | | | | | | | Summary: Disable exceptions in MSVC headers using -D_HAS_EXCEPTIONS=0 to silence compiler warning instead of using /Ehsc. Reviewers: rnk, morehouse, metzman Reviewed By: rnk, morehouse, metzman Subscribers: rnk, morehouse, mgorny Differential Revision: https://reviews.llvm.org/D57119 llvm-svn: 352144
* [libFuzzer] more agressive value profiling and CMP tracing for switch statementsKostya Serebryany2019-01-241-11/+31
| | | | llvm-svn: 352107
* Fix building sanitizers for MinGWMartin Storsjo2019-01-231-1/+1
| | | | | | The /EHsc flag is MSVC specific, not generic to the windows target. llvm-svn: 351927
* [libFuzzer][MSVC] Enable building libFuzzer with MSVCJonathan Metzman2019-01-224-6/+13
| | | | | | | | | | | | | | | Summary: Enable building libFuzzer with MSVC. * Don't try to include <endian.h> in FuzzerSHA1.cpp. MSVC doesn't have this header, and WINDOWS is always little endian (even on ARM) Subscribers: srhines, mgorny, javed.absar, kristof.beyls Differential Revision: https://reviews.llvm.org/D56510 llvm-svn: 351855
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-1954-214/+162
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* [libFuzzer][MSVC] Make attribute-use compatible with MSVCJonathan Metzman2019-01-177-24/+46
| | | | | | | | | | | | | | Summary: Replace attributes with macros that use equivalent declspecs for MSVC. Reviewers: vitalybuka Reviewed By: vitalybuka Differential Revision: https://reviews.llvm.org/D56512 llvm-svn: 351456
* [libFuzzer] Remove unstable edge handlingJonathan Metzman2019-01-158-158/+9
| | | | | | | | | | Summary: Remove code for handling unstable edges from libFuzzer since it has not been found useful. Differential Revision: https://reviews.llvm.org/D56730 llvm-svn: 351262
* [libFuzzer][MSVC] Use alternatename for ext functionsJonathan Metzman2019-01-153-57/+84
| | | | | | | | | | | | | | | | | Summary: Use alternatename for external functions only when using MSVC since Clang doesn't support it and MSVC doesn't support Clang's method (weak aliases). Reviewers: morehouse Reviewed By: morehouse Subscribers: rnk, thakis, mgorny Differential Revision: https://reviews.llvm.org/D56514 llvm-svn: 351152
* [libfuzzer][MSVC] Make calls to builtin functions work with MSVCJonathan Metzman2019-01-096-25/+127
| | | | | | | | | | | | | | | | | | Summary: Replace calls to builtin functions with macros or functions that call the Windows-equivalents when targeting windows and call the original builtin functions everywhere else. This change makes more parts of libFuzzer buildable with MSVC. Reviewers: vitalybuka Reviewed By: vitalybuka Subscribers: mgorny, rnk, thakis Differential Revision: https://reviews.llvm.org/D56439 llvm-svn: 350766
* [libFuzzer] make len_control less aggressiveKostya Serebryany2018-12-141-1/+1
| | | | llvm-svn: 349210
* [test] Add missing cmake include for building libFuzzer aloneMichal Gorny2018-12-061-0/+2
| | | | | | | | | | | | | | Include CompilerRTCompile in fuzzer tests explicitly. Otherwise, when building only libFuzzer, CMake fails due to: CMake Error at cmake/Modules/AddCompilerRT.cmake:395 (sanitizer_test_compile): Unknown CMake command "sanitizer_test_compile". Call Stack (most recent call first): lib/fuzzer/tests/CMakeLists.txt:53 (generate_compiler_rt_tests) Differential Revision: https://reviews.llvm.org/D55378 llvm-svn: 348524
* [fuzzer] Read files as binaryJonathan Metzman2018-11-062-3/+3
| | | | | | | | | | | | Summary: Read corpus files as binary to avoid automatic conversions Reviewers: Dor1s, morehouse Reviewed By: Dor1s, morehouse Differential Revision: https://reviews.llvm.org/D54180 llvm-svn: 346279
* Follow Windows' approach for NetBSD in AlarmCallback()Kamil Rytarowski2018-11-061-1/+2
| | | | | | | NetBSD's current behavior needs to ignore check for InFuzzingThread() in Fuzzer::AlarmCallback(). llvm-svn: 346194
* [compiler-rt][Fuzzer] Fix the fuzzer test buildPetr Hosek2018-11-021-2/+2
| | | | | | | | | This fixes the issue introduced in r345765 which changed the way in which the embedded libc++ is being built but omitted tests. Differential Revision: https://reviews.llvm.org/D54058 llvm-svn: 346052
* [compiler-rt][Fuzzer] Use the new C++ ABI namespace CMake supportPetr Hosek2018-10-311-1/+1
| | | | | | | | | libc++ now supports customizing the ABI namespace directly from the CMake build so we no longer need to rely on custom CFLAGS. Differential Revision: https://reviews.llvm.org/D53939 llvm-svn: 345765
* [libfuzzer][Windows] Silence linker warning in unittestJonathan Metzman2018-10-141-3/+1
| | | | | | | | | | | | | | | | Summary: Silence warning when linking unittest binary by not passing -lstdc++ to the linker since it is ignored. Reviewers: morehouse Reviewed By: morehouse Subscribers: mgorny Differential Revision: https://reviews.llvm.org/D53225 llvm-svn: 344480
* [libFuzzer] Generalize the code for getting the previous offset for ↵George Karpenkov2018-10-101-13/+33
| | | | | | | | | | | | | different architectures Without this change, tests in coverage.test and dump_coverage.test are failing on non-x86_64 platforms. The diff is copied from sanitizer_common library, an alternative would be to link it together with libFuzzer. Differential Revision: https://reviews.llvm.org/D53040 llvm-svn: 344104
* [lib/fuzzer] Fix logging for FuchsiaPetr Hosek2018-10-022-8/+17
| | | | | | | | | | | | | | | | | This change fixes two aspects of logging on Fuchsia: 1. When logging to stdout, the output file descriptor should not be closed in ExecuteCommand, as it prevent fdio_spawn_etc from succeeding in subsequent calls. 2. When logging to a file in anything other than standalone Zircon, the log file needs to be created in mutable storage. The best indicator where this is relative to the Fuchsia component will be given by '-artifact_prefix=...', so save the log file relative to that path. Patch by: aarongreen Differential Revision: https://reviews.llvm.org/D52562 llvm-svn: 343607
* [fuzzer] Replace FuzzerExtFunctionsDlsymWin.cpp with ↵Jonathan Metzman2018-09-202-63/+1
| | | | | | | | | | | | | | | | | | | | | FuzzerExtFunctionsWeakAlias.cpp Summary: Replace FuzzerExtFunctionsDlsymWin.cpp with FuzzerExtFunctionsWeakAlias.cpp to get externally defined functions (eg: LLVMFuzzerInitialize, LLVMFuzzerCustomMutator, etc) working again. Also enable tests that depended on these functions (on windows) Reviewers: rnk, morehouse Reviewed By: rnk, morehouse Subscribers: rnk, morehouse, mgorny Differential Revision: https://reviews.llvm.org/D51700 llvm-svn: 342698
* [libFuzzer] Avoid fuzzer symbols being hidden.Matt Morehouse2018-09-171-1/+1
| | | | | | | | Fixes https://bugzilla.mozilla.org/show_bug.cgi?id=1490845#c5. Patch By: Mike Hommey llvm-svn: 342423
* [libFuzzer] [Windows] Include windows.h and psapi.h with lowercaseMartin Storsjo2018-09-112-3/+3
| | | | | | | | | | | | | This fixes building on a case sensitive filesystem with mingw-w64 headers, where all headers are lowercase, and matches how these headers are included elsewhere in compiler-rt. Also include these headers with angle brackets, as they are system headers. Differential Revision: https://reviews.llvm.org/D51913 llvm-svn: 341983
* [libFuzzer] Enable tests on WindowsMatt Morehouse2018-09-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Enable tests on Windows and make check-fuzzer pass on it. Make check-fuzzer pass on Windows by fixing libFuzzer, fixing tests, and by disabling tests on Windows. Most of these are disabled temporarily as support for the tests and the features they test will be added incrementally. Other tests will not be enabled since they require things that are not on Windows (eg: afl_driver tests). Every test that was explicitly disabled on Windows has a comment explaining why (unless obvious like merge-posix.test). The lit.cfg file was modified to support running tests on windows. fuzzer-dirs.test was fixed by making the Windows implementation print the same error message as the posix version. merge-control-file.test was fixed by making the test binary end with the ".exe" extension (on all platforms). Patch By: metzman Reviewers: morehouse Reviewed By: morehouse Subscribers: srhines, mgorny Differential Revision: https://reviews.llvm.org/D51549 llvm-svn: 341385
* [libFuzzer] Port to WindowsMatt Morehouse2018-08-309-12/+48
| | | | | | | | | | | | | | | | | | | | Summary: Port libFuzzer to windows-msvc. This patch allows libFuzzer targets to be built and run on Windows, using -fsanitize=fuzzer and/or fsanitize=fuzzer-no-link. It allows these forms of coverage instrumentation to work on Windows as well. It does not fix all issues, such as those with -fsanitize-coverage=stack-depth, which is not usable on Windows as of this patch. It also does not fix any libFuzzer integration tests. Nearly all of them fail to compile, fixing them will come in a later patch, so libFuzzer tests are disabled on Windows until them. Patch By: metzman Reviewers: morehouse, rnk Reviewed By: morehouse, rnk Subscribers: #sanitizers, delcypher, morehouse, kcc, eraman Differential Revision: https://reviews.llvm.org/D51022 llvm-svn: 341082
* [libFuzzer] Remove mutation stats and weighted mutation selection.Max Moroz2018-08-296-99/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This was an experimental feature. After evaluating it with: 1) https://github.com/google/fuzzer-test-suite/tree/master/engine-comparison 2) enabling on real world fuzz targets running at ClusterFuzz and OSS-Fuzz The following conclusions were made: 1) With fuzz targets that have reached a code coverage plateau, the feature does not improve libFuzzer's ability to discover new coverage and may actually negatively impact it. 2) With fuzz targets that have not yet reached a code coverage plateau, the feature might speed up new units discovery in some cases, but it is quite rare and hard to confirm with a high level on confidence. Revert of https://reviews.llvm.org/D48054 and https://reviews.llvm.org/D49621. Reviewers: metzman, morehouse Reviewed By: metzman, morehouse Subscribers: delcypher, #sanitizers, llvm-commits, kcc Differential Revision: https://reviews.llvm.org/D51455 llvm-svn: 340976
* Revert "[libFuzzer] Port to Windows"Matt Morehouse2018-08-299-48/+12
| | | | | | This reverts r340949 due to bot breakage again. llvm-svn: 340954
* [libFuzzer] Port to WindowsMatt Morehouse2018-08-299-12/+48
| | | | | | | | | | | | | | | | | | Summary: Port libFuzzer to windows-msvc. This patch allows libFuzzer targets to be built and run on Windows, using -fsanitize=fuzzer and/or fsanitize=fuzzer-no-link. It allows these forms of coverage instrumentation to work on Windows as well. It does not fix all issues, such as those with -fsanitize-coverage=stack-depth, which is not usable on Windows as of this patch. It also does not fix any libFuzzer integration tests. Nearly all of them fail to compile, fixing them will come in a later patch, so libFuzzer tests are disabled on Windows until them. Reviewers: morehouse, rnk Reviewed By: morehouse, rnk Subscribers: #sanitizers, delcypher, morehouse, kcc, eraman Differential Revision: https://reviews.llvm.org/D51022 llvm-svn: 340949
* Revert "[libFuzzer] Port to Windows"Matt Morehouse2018-08-289-48/+12
| | | | | | This reverts commit r340860 due to failing tests. llvm-svn: 340867
OpenPOWER on IntegriCloud