aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Fuzzer/FuzzerUtil.cpp
AgeCommit message (Collapse)AuthorFilesLines
2016-08-17[libFuzzer] when printing the reproducer input, also print the base input ↵Kostya Serebryany1-4/+8
and the mutation sequence llvm-svn: 278975
2016-08-12[LibFuzzer] Fix `-jobs=<N>` where <N> > 1 and the number of workers is > 1 ↵Dan Liew1-4/+0
on macOS. The original `ExecuteCommand()` called `system()` from the C library. The C library implementation of this on macOS contains a mutex which serializes calls to `system()`. This prevented the `-jobs=` flag from running copies of the fuzzing binary in parallel which is the opposite of what is intended. To fix this on macOS an alternative implementation of `ExecuteCommand()` is provided that can be used concurrently. This is provided in `FuzzerUtilDarwin.cpp` which is guarded to only compile code on Apple platforms. The existing implementation has been moved to a new file `FuzzerUtilLinux.cpp` which is guarded to only compile code on Linux. This commit includes a simple test to check that LibFuzzer is being executed in parallel when requested. Differential Revision: https://reviews.llvm.org/D22742 llvm-svn: 278544
2016-05-27[libFuzzer] make OOM-handling more portable. Instead of sending a signal to ↵Kostya Serebryany1-7/+0
the main fuzzing thread, print the message in the getrusage thread and exit. llvm-svn: 270945
2016-05-26[libFuzzer] reimplement the way we do -only_ascii to allow more 'const' in ↵Kostya Serebryany1-3/+5
function declarations. Add a test for -only_ascii. NFC intended llvm-svn: 270900
2016-05-20[LibFuzzer] Fix implementation of ``GetPeakRSSMb()`` on Mac OSX.Dan Liew1-1/+9
On Linux ``rusage.ru_maxrss`` is in KiB but on Mac OSX it is in bytes. Differential Revision: http://reviews.llvm.org/D20410 llvm-svn: 270173
2016-05-20[LibFuzzer] Fix ``NumberOfCpuCores()`` on Mac OSX.Dan Liew1-4/+29
The ``nprocs`` command does not exist under Mac OSX so use ``sysctl`` instead on that platform. Whilst I'm here * Use ``pclose()`` instead of ``fclose()`` which the ``popen()`` documentation says should be used. * Check for errors that were previously unhandled. Differential Revision: http://reviews.llvm.org/D20409 llvm-svn: 270172
2016-05-06[libFuzzer] enhance -rss_limit_mb and enable by default. Now it will print ↵Kostya Serebryany1-1/+15
the OOM reproducer. llvm-svn: 268821
2016-03-24[libFuzzer] handle SIGTERMKostya Serebryany1-0/+1
llvm-svn: 264338
2016-03-02libfuzzer: fix compiler warningsDmitry Vyukov1-5/+11
- unused sigaction/setitimer result (used in assert) - unchecked fscanf return value - signed/unsigned comparison llvm-svn: 262472
2016-03-01[libFuzzer] add generic signal handlers so that libFuzzer can report at ↵Kostya Serebryany1-5/+25
least something if ASan is not handlig the signals for us. Remove abort_on_timeout flag. llvm-svn: 262415
2016-02-26[libFuzzer] add -print_final_stats=1 flagKostya Serebryany1-0/+8
llvm-svn: 262084
2016-02-13[libFuzzer] remove std::vector operations from hot paths, NFCKostya Serebryany1-2/+3
llvm-svn: 260829
2016-01-16[libFuzzer] replace vector with a simpler data structure in the Dictionaries ↵Kostya Serebryany1-3/+5
to avoid memory allocations on hot path llvm-svn: 257985
2016-01-13[libFuzzer] make CurrentUnit a POD object instead of vector to avoid extra ↵Kostya Serebryany1-3/+8
allocations llvm-svn: 257713
2016-01-12[libFuzzer] when a new unit is discovered using a dictionary, print all used ↵Kostya Serebryany1-6/+19
dictionary entries llvm-svn: 257435
2015-12-04[libFuzzer] compute base64 in-process instead of using an external lib. ↵Kostya Serebryany1-0/+29
Since libFuzzer should not depend on anything, just re-implement base64 encoder. PR25746 llvm-svn: 254784
2015-11-12[libFuzzer] experimental flag -drill (another search heuristic; Mike ↵Kostya Serebryany1-2/+2
Aizatsky's idea) llvm-svn: 252838
2015-11-05[libFuzzer] print a bit fewer linesKostya Serebryany1-1/+0
llvm-svn: 252123
2015-10-16[libFuzzer] print a stack trace on timeoutKostya Serebryany1-0/+2
llvm-svn: 250571
2015-09-03[libFuzzer] adding a parser for AFL-style dictionaries + tests.Kostya Serebryany1-0/+74
llvm-svn: 246800
2015-09-02[libFuzzer] honour -only_ascii=1 when reading the initial corpus. Also, ↵Kostya Serebryany1-0/+6
remove ugly #ifdef llvm-svn: 246689
2015-08-11[libFuzzer] add -only_ascii flagKostya Serebryany1-0/+13
llvm-svn: 244559
2015-05-23[lib/Fuzzer] fully get rid of std::cerr in libFuzzerKostya Serebryany1-7/+6
llvm-svn: 238081
2015-05-18[lib/Fuzzer] when -sync_command=<CMD> is given, periodically execute 'CMD ↵Kostya Serebryany1-0/+4
CORPUS' to synchronize with other processes llvm-svn: 237617
2015-05-14[lib/Fuzzer] Add SHA1 implementation from public domain.Kostya Serebryany1-38/+9
Summary: This adds a SHA1 implementation taken from public domain code. The change is trivial, but as it involves third-party code I'd like a second pair of eyes before commit. LibFuzzer can not use SHA1 from openssl because openssl may not be available and because we may be fuzzing openssl itself. Using sha1sum via a pipe is too slow. Test Plan: n/a Reviewers: chandlerc Reviewed By: chandlerc Subscribers: majnemer, llvm-commits Differential Revision: http://reviews.llvm.org/D9733 llvm-svn: 237400
2015-05-12[lib/Fuzzer] use sha1sum for the file hashKostya Serebryany1-0/+30
llvm-svn: 237198
2015-05-12[lib/Fuzzer] guess the right number of workers if -jobs=N is given but ↵Kostya Serebryany1-0/+8
-workers=M is not. Update the docs. llvm-svn: 237163
2015-04-01[fuzzer] document the -tokens flag. Also change the diagnostic outputKostya Serebryany1-4/+7
llvm-svn: 233842
2015-03-31[fuzzer] Add support for token-based fuzzing (e.g. for C++). Allow string ↵Kostya Serebryany1-1/+1
flags. llvm-svn: 233745
2015-01-29Reverting r227452, which adds back the fuzzer library. Now excluding the ↵Aaron Ballman1-0/+61
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-61/+0
for MSVC users. This reverts: 227445, 227395, 227389, 227357, 227254, 227252 llvm-svn: 227452
2015-01-27Add a Fuzzer libraryKostya Serebryany1-0/+61
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