summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/fuzzer/FuzzerIO.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [libFuzzer] Fix fd check in DupAndCloseStderr.Marco Vanotti2019-11-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This commit fixes the check in the return value from the `DuplicateFile` function, which returns a new file descriptor. `DuplicateFile` can return 0 if that file descriptor is available (for example, if stdin has already been closed). In particular, this could cause a bug with the `-close_fd_mask` flag in some platforms: just call the fuzzer with stdin closed and the `-close_fd_mask=2` flag, and stderr will not be muted. Example fuzzer: ``` extern "C" int LLVMFuzzerTestOneInput(const uint8_t* Data, size_t Size) { fprintf(stderr, "STDERR\n"); fprintf(stdout, "STDOUT\n"); return 0; } ``` Invocation (muting both stderr and stdout): ``` ./test -close_fd_mask=3 -runs=1 0<&- INFO: Seed: 1155116940 INFO: Loaded 1 modules (1 inline 8-bit counters): 1 [0x48b020, 0x48b021), INFO: Loaded 1 PC tables (1 PCs): 1 [0x478dc8,0x478dd8), INFO: -max_len is not provided; libFuzzer will not generate inputs larger than 4096 bytes STDERR INFO: A corpus is not provided, starting from an empty corpus STDERR Done 2 runs in 0 second(s) ``` Reviewers: mcgrathr, jakehehrlich, phosek, kcc, aarongreen Subscribers: #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D68775
* [libFuzzer] Replace -seed_corpus to better support fork mode on WinJonathan Metzman2019-04-301-0/+5
| | | | | | | | | | | | | | | | | | 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
* [libFuzzer] add -features_dir= flag to dump unique input features on diskKostya Serebryany2019-04-131-1/+5
| | | | llvm-svn: 358317
* 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
* [libFuzzer] form mode: add -ignore_crashes flag, honor the max_total_time ↵Kostya Serebryany2019-02-151-1/+1
| | | | | | flag, print the number of ooms/timeouts/crashes, fix a typo llvm-svn: 354175
* [libFuzzer] a bit of refactoring of the fork modeKostya Serebryany2019-02-131-5/+5
| | | | llvm-svn: 353910
* [libFuzzer] move the implementation of the fork mode into a separate fileKostya Serebryany2019-02-121-1/+7
| | | | llvm-svn: 353891
* [libFuzzer] make the fork mode less verboseKostya Serebryany2019-02-121-0/+9
| | | | llvm-svn: 353794
* [libFuzzer] extend the -fork=1 functionality. Still not fully usable, but ↵Kostya Serebryany2019-02-121-0/+7
| | | | | | good enough for the first unit test llvm-svn: 353775
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | 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
* [fuzzer] Read files as binaryJonathan Metzman2018-11-061-2/+2
| | | | | | | | | | | | 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
* [libFuzzer] Port to WindowsMatt Morehouse2018-08-301-8/+0
| | | | | | | | | | | | | | | | | | | | 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
* Revert "[libFuzzer] Port to Windows"Matt Morehouse2018-08-291-0/+8
| | | | | | This reverts r340949 due to bot breakage again. llvm-svn: 340954
* [libFuzzer] Port to WindowsMatt Morehouse2018-08-291-8/+0
| | | | | | | | | | | | | | | | | | 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-281-0/+8
| | | | | | This reverts commit r340860 due to failing tests. llvm-svn: 340867
* [libFuzzer] Port to WindowsMatt Morehouse2018-08-281-8/+0
| | | | | | | | | | | | | | | | | | | | 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: morehouse, kcc, eraman Differential Revision: https://reviews.llvm.org/D51022 llvm-svn: 340860
* [libFuzzer] initial implementation of -data_flow_trace. It parses the data ↵Kostya Serebryany2018-06-061-0/+8
| | | | | | flow trace and prints the summary, but doesn't use the information in any other way yet llvm-svn: 334058
* [libFuzzer] factor out some code into GetSizedFilesFromDir; NFCKostya Serebryany2017-09-121-0/+9
| | | | llvm-svn: 313081
* [libFuzzer] Use custom allocators for STL containers in libFuzzer.George Karpenkov2017-08-271-2/+2
| | | | | | | | Avoids ODR violations causing spurious ASAN warnings. Differential Revision: https://reviews.llvm.org/D37086 llvm-svn: 311866
* Revert "[libFuzzer] Use custom allocators for STL containers in libFuzzer"George Karpenkov2017-08-261-2/+2
| | | | | | This reverts commit 3539efc2f2218dba2bcbd645d0fe276f2b5cf588. llvm-svn: 311831
* [libFuzzer] Use custom allocators for STL containers in libFuzzerGeorge Karpenkov2017-08-261-2/+2
| | | | | | | | Avoids ODR violations causing spurious ASAN container overflow warnings. Differential Revision: https://reviews.llvm.org/D37086 llvm-svn: 311830
* Move libFuzzer to compiler_rt.George Karpenkov2017-08-211-0/+120
Resulting library binaries will be named libclang_rt.fuzzer*, and will be placed in Clang toolchain, allowing redistribution. Differential Revision: https://reviews.llvm.org/D36908 llvm-svn: 311407
OpenPOWER on IntegriCloud