aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Fuzzer/FuzzerIO.cpp
AgeCommit message (Collapse)AuthorFilesLines
2016-06-07[LibFuzzer] Declare and use sanitizer functions in ``fuzzer::ExternalFunctions``Dan Liew1-6/+3
This fixes linking problems on OSX. Unfortunately it turns out we need to use an instance of the ``fuzzer::ExternalFunctions`` object in several places so this commit also replaces all instances with a single global instance. It also turns out initializing a global ``fuzzer::ExternalFunctions`` before main is entered (i.e. letting the object be initialised by the global initializers) is not safe (on OSX the call to ``Printf()`` in the CTOR crashes if it is called from a global initializer) so we instead have a global ``fuzzer::ExternalFunctions*`` and initialize it inside ``FuzzerDriver()``. Multiple unit tests depend also depend on the ``fuzzer::ExternalFunctions*`` global so a ``main()`` function has been added that initializes it before running any tests. Differential Revision: http://reviews.llvm.org/D20943 llvm-svn: 272072
2016-05-27[libFuzzer] use __sanitizer_set_report_fd with -close_fd_mask. This allows ↵Kostya Serebryany1-0/+6
us to keep asan reports when closing target's stderr llvm-svn: 271053
2016-03-25[libFuzzer] use fflush after every PrintfKostya Serebryany1-0/+1
llvm-svn: 264459
2016-03-24[libFuzzer] use fdopen+vfprintf instead of fsnprintf+writeKostya Serebryany1-11/+10
llvm-svn: 264230
2016-03-18[libFuzzer] add a flag close_fd_mask so that we can silence spammy targets ↵Kostya Serebryany1-1/+17
by closing stderr/stdout llvm-svn: 263831
2016-03-18[libFuzzer] read corpus dirs recursivelyKostya Serebryany1-14/+16
llvm-svn: 263773
2016-03-15[libfuzzer] speeding up corpus loadMike Aizatsky1-8/+10
llvm-svn: 263591
2016-03-04[libFuzzer] log less when re-loading files; fix a silly bug: when running ↵Kostya Serebryany1-2/+4
single files actually run all of them, not just the first one llvm-svn: 262754
2016-02-18[libFuzzer] only read MaxLen bytes from every file in the corpus to speedup ↵Kostya Serebryany1-4/+10
loading the corpus llvm-svn: 261267
2016-02-17[libFuzzer] don't timeout when loading the corpus. Be a bit more verbose ↵Kostya Serebryany1-1/+5
when loading large corpus. llvm-svn: 261143
2016-02-02[libFuzzer] allow passing 1 or more files as individual inputsKostya Serebryany1-0/+7
llvm-svn: 259459
2016-02-02[libFuzzer] fail if the corpus dir does not existKostya Serebryany1-1/+1
llvm-svn: 259454
2015-12-04[libFuzzer] compute base64 in-process instead of using an external lib. ↵Kostya Serebryany1-5/+0
Since libFuzzer should not depend on anything, just re-implement base64 encoder. PR25746 llvm-svn: 254784
2015-11-13[libFuzzer] make libFuzzer build even with a compiler that does not have ↵Kostya Serebryany1-0/+1
sanitizer headers llvm-svn: 253003
2015-10-16[libFuzzer] When -test_single_input crashes the test it is not necessary to ↵Kostya Serebryany1-0/+4
write crash-file because input is already known to the user. Patch by Mike Aizatsky llvm-svn: 250564
2015-09-08[libFuzzer] be more robust when dealing with files on disk (e.g. don't crash ↵Kostya Serebryany1-4/+2
if a file was there but disappeared) llvm-svn: 247066
2015-08-26[libFuzzer] fix minor inefficiency, PR24584Kostya Serebryany1-1/+1
llvm-svn: 246087
2015-08-12[libFuzzer] use raw C IO to reduce the risk of a deadlock in a signal handler.Kostya Serebryany1-2/+5
llvm-svn: 244707
2015-07-18[libFuzzer] require the files and directories passed to the fuzzer to existKostya Serebryany1-2/+8
llvm-svn: 242596
2015-05-23[lib/Fuzzer] start getting rid of std::cerr. Sadly, these parts of C++ ↵Kostya Serebryany1-4/+9
library used in libFuzzer badly interract with the same code used in the target function and also with dfsan. It's easier to just not use std::cerr than to defeat these issues. llvm-svn: 238078
2015-05-18[lib/Fuzzer] when -sync_command=<CMD> is given, periodically execute 'CMD ↵Kostya Serebryany1-1/+1
CORPUS' to synchronize with other processes llvm-svn: 237617
2015-05-08[lib/Fuzzer] use -fsanitize-coverage=trace-cmp when building LLVM with ↵Kostya Serebryany1-4/+25
LLVM_USE_SANITIZE_COVERAGE; in lib/Fuzzer try to reload the corpus to pick up new units from other processes llvm-svn: 236906
2015-05-05[lib/Fuzzer] on crash print the contents of the crashy input as base64Kostya Serebryany1-0/+5
llvm-svn: 236548
2015-03-31[fuzzer] Add support for token-based fuzzing (e.g. for C++). Allow string ↵Kostya Serebryany1-0/+6
flags. llvm-svn: 233745
2015-02-04[fuzzer] make multi-process execution more verbose; fix mutation to actually ↵Kostya Serebryany1-0/+8
respect mutation depth and to never produce empty units llvm-svn: 228170
2015-01-29Reverting r227452, which adds back the fuzzer library. Now excluding the ↵Aaron Ballman1-0/+49
fuzzer library based on LLVM_USE_SANITIZE_COVERAGE being set or unset. llvm-svn: 227464
2015-01-29Temporarily reverting the fuzzer library as it causes too many build issues ↵Aaron Ballman1-49/+0
for MSVC users. This reverts: 227445, 227395, 227389, 227357, 227254, 227252 llvm-svn: 227452
2015-01-28[fuzzer] add option -save_minimized_corpusKostya Serebryany1-2/+7
llvm-svn: 227395
2015-01-27Add a Fuzzer libraryKostya Serebryany1-0/+44
Summary: A simple genetic in-process coverage-guided fuzz testing library. I've used this fuzzer to test clang-format (it found 12+ bugs, thanks djasper@ for the fixes!) and it may also help us test other parts of LLVM. So why not keep it in the LLVM repository? I plan to add the cmake build rules later (in a separate patch, if that's ok) and also add a clang-format-fuzzer target. See README.txt for details. Test Plan: Tests will follow separately. Reviewers: djasper, chandlerc, rnk Reviewed By: rnk Subscribers: majnemer, ygribov, dblaikie, llvm-commits Differential Revision: http://reviews.llvm.org/D7184 llvm-svn: 227252