723 Commits

Author SHA1 Message Date
George Karpenkov
6795f26af5 [libFuzzer tests] Use substring comparison in libFuzzer tests
LIT launches executables with absolute, and not relative, path.
strncmp would try to do exact comparison and fail.

Differential Revision: https://reviews.llvm.org/D36242

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309889 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-02 21:38:50 +00:00
Kostya Serebryany
9e6b2e7f9d [libFuzzer] temporarty remove pc-tables and disable test/fuzzer-printcovpcs.test until this can be fixed on Windows
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309716 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-01 18:02:19 +00:00
Kostya Serebryany
c19eec3262 [libFuzzer] implement more correct way of computing feature index for Inline8bitCounters
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309647 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-01 01:16:26 +00:00
Kostya Serebryany
c6d173bbf6 [libFuzzer] enable -fsanitize-coverage=pc-table for all tests
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309646 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-01 00:48:44 +00:00
Kostya Serebryany
f15adebe75 [libFuzzer] implement __sanitizer_cov_pcs_init and add pc-table to build flags for one test (for now)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309615 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-31 20:20:59 +00:00
Kostya Serebryany
dfa17126d8 [libFuzzer] improve support for inline-8bit-counters (make it more correct and faster)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309443 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-28 22:00:56 +00:00
Kostya Serebryany
8330752796 [libFuzzer] don't disable msan for TracePC::CollectFeatures: this started to cause false positives in msan. No tests for libFuzzer+msan yet -- tests will need to wait until we move libFuzzer to compiler-rt
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309038 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-25 22:05:31 +00:00
Kostya Serebryany
74b6501bc4 [libFuzzer] make one test faster, fix compiler warnings in tests
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308945 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-25 02:09:46 +00:00
George Karpenkov
9bf22f2451 Revert "Revert "[libFuzzer] Add a dependency on symbolizer from libFuzzer tests""
This reverts commit 15425f2bc6eac6249ee957a2a280511306c07547.

Should work now that atos is a default symbolizer on Darwin.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308910 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-24 18:38:14 +00:00
Kostya Serebryany
5ae0dfe6b2 [libFuzzer] reimplement experimental_len_control=1: bump the temporary max_len every time we failed to find new coverage during the last 1000 runs and 1 second. Also fix FileToVector to not load unfinished files
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308811 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-22 00:10:29 +00:00
Matt Morehouse
5187ebbe87 Generate error reports when a fuzz target exits.
Summary:
Implements https://github.com/google/sanitizers/issues/835.

Flush stdout before exiting in test cases.

Since the atexit hook is used for exit reports, pending prints to
stdout can be lost if they aren't flushed before calling exit().

Expect tests to have non-zero exit code if exit() is called.

Reviewers: vitalybuka, kcc

Reviewed By: kcc

Subscribers: eraman, llvm-commits, hiraditya

Differential Revision: https://reviews.llvm.org/D35602

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308669 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-20 20:43:39 +00:00
Kostya Serebryany
29fa98aa84 [libFuzzer] delete stale code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308663 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-20 20:15:13 +00:00
Kostya Serebryany
9dbc448fd9 [libFuzzer] make sure CheckExitOnSrcPosOrItem is called after the new input is saved to the corpus
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308653 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-20 18:53:25 +00:00
Kostya Serebryany
e531917082 [libFuzzer] prototype implementation of recursion-depth coverage features (commented out; real implementation needs to use inlined instrumentation)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308577 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-20 01:35:17 +00:00
Kostya Serebryany
6c825738bb [libFuzzer] add DeepRecursionTest, inspired by https://guidovranken.wordpress.com/2017/07/08/libfuzzer-gv-new-techniques-for-dramatically-faster-fuzzing/ (Stack-depth-guided fuzzing). libFuzzer does not solve it yet.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308571 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-20 00:37:08 +00:00
Reid Kleckner
77c923809c Try to deflake fuzzer-oom.test on Windows
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308568 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-20 00:11:39 +00:00
Kostya Serebryany
b905fdae0c [libFuzzer] simplify two more tests
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308560 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-19 23:52:54 +00:00
Kostya Serebryany
0199c64787 [libFuzzer] change several tests to not limit the max len: with reduce_inputs=1 they are now fast enough even w/o this
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308553 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-19 23:45:46 +00:00
Reid Kleckner
9ed8bad9d6 Fix fuzzer-flags.test on Windows
The optional external function callbacks have to be exported in order
for them to be called. The test was failing because libFuzzer wasn't
calling LLVMFuzzerInitialize.

We can reconsider if this is the best way to mark these optional
callbacks exported later.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308548 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-19 23:22:06 +00:00
Kostya Serebryany
a575cf69b3 [libFuzzer] enable reduce_inputs=1 by default (seems to be a big win usually)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308541 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-19 22:10:30 +00:00
Kostya Serebryany
9c21c1e832 [libFuzzer] when adding a reduced input print REDUCED instead of NEW
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308336 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-18 18:47:36 +00:00
Kostya Serebryany
0bc92aded8 [libFuzzer] improve -reduce_inputs=1: now only consider the unique features of very input (seems to work much better)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308253 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-18 01:36:50 +00:00
Kostya Serebryany
9505afab47 [libFuzzer] disable fuzzer-flags.test on windows to fix the bots
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308246 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-18 01:00:28 +00:00
George Karpenkov
a5a016b3e9 Revert "[libFuzzer] Add a dependency on symbolizer from libFuzzer tests"
This reverts commit 546e006a023cccd0fd32afd442ab992d3515d4b8.

Reverting until I can figure out llvm-symbolizer breakages on mac os.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308202 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-17 18:18:03 +00:00
Kostya Serebryany
2cf034ebb7 [libFuzzer] remove stale code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308075 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-15 01:31:40 +00:00
Justin Bogner
948973b73f [libFuzzer] Allow non-fuzzer args after -ignore_remaining_args=1
With this change, libFuzzer will ignore any arguments after a sigil
argument, but it will preserve these arguments at the end of the
command line when launching subprocesses. Using this, its possible to
handle positional and single-dash arguments to the program under test
by discarding everything up to -ignore_remaining_args=1 in
LLVMFuzzerInitialize.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308069 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-14 23:33:04 +00:00
Kostya Serebryany
7bdecb4953 [libFuzzer] fix stats during merge
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308061 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-14 21:48:19 +00:00
Kostya Serebryany
ac4ebc9acc [libFuzzer] update the comments in afl/afl_driver.cpp
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307981 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-14 00:18:37 +00:00
Kostya Serebryany
12ab215732 [libFuzzer] remove stale code; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307980 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-14 00:16:23 +00:00
Kostya Serebryany
06e0ac200b [libFuzzer] simplify the handling of memmem/strstr
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307977 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-14 00:06:27 +00:00
Kostya Serebryany
2ead42c658 [libFuzzer] move code around; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307973 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-13 22:30:23 +00:00
Kostya Serebryany
a204f09272 [libFuzzer] make sure that -reduce_inputs=1 deletes redundant files in the corpus
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307875 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-13 01:56:37 +00:00
Kostya Serebryany
bb9605f1d6 [libFuzzer] experimental feature -reduce_inputs (off by default) that tries to replace elements in the corpus with smaller ones that have the same feature set. Still needs tuning
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307873 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-13 01:08:53 +00:00
Kostya Serebryany
30f6cbbbb1 [libFuzzer] relax test/shrink.test a bit (got broken on windows)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307862 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-12 23:22:32 +00:00
Kostya Serebryany
73136ba7e5 [libFuzzer] remove include <sanitizer/coverage_interface.h>, not needed any more
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307858 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-12 22:22:36 +00:00
Kostya Serebryany
8848feb6a9 [libFuzzer] refactoring in preparation for -reduce_inputs; NFC intended
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307857 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-12 22:20:04 +00:00
George Karpenkov
a4790a341b [libFuzzer] Add a dependency on symbolizer from libFuzzer tests
Some libFuzzer tests on Linux would fail with bizarre error messages
unless llvm-symbolizer binary is present.

Differential Revision: https://reviews.llvm.org/D35313

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307826 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-12 18:17:34 +00:00
George Karpenkov
43e65bfc21 [libFuzzer] NFC Declare LIBFUZZER_FLAGS_BASE outside of an if-block
The current code relies on the assumption that tests are included only
if LLVM_USE_SANITIZE_COVERAGE is enabled.
This commit makes it easier to relax the assumption in the future, as
the variable LIBFUZZER_FLAGS_BASE is used further in libFuzzer tests.

Differential Revision: https://reviews.llvm.org/D35314

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307825 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-12 18:16:09 +00:00
George Karpenkov
053573f613 [libFuzzer] Do not use LLVM ostream in tests
Differential Revision: https://reviews.llvm.org/D35312

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307824 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-12 18:14:19 +00:00
Dan Liew
f8b3ea82d0 [LibFuzzer] Fix -Wcomment warning emitted by GCC.
```
./FuzzerIOWindows.cpp:185:1: warning: multi-line comment [-Wcomment]
 // Parse a directory ending in separator, like: SomeDir\
 ^
./FuzzerIOWindows.cpp:200:1: warning: multi-line comment [-Wcomment]
 // Parse a servername and share, like: SomeServer\SomeShare\
 ^
```

Differential Revision: https://reviews.llvm.org/D35244

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307687 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-11 18:27:52 +00:00
Dan Liew
09b7b2c66c [LibFuzzer] Fix -Wpedantic warning reported by Eric Christopher.
The warning is reproducible with GCC 4.8. Thanks to David Blaikie for
the suggested fix.

The reported warning was

```
/usr/local/google/home/echristo/sources/llvm/lib/Fuzzer/FuzzerExtFunctions.def:29:10: warning: ISO C++ forbids casting between pointer-to-function and pointer-to-object [-Wpedantic]
 EXT_FUNC(__lsan_enable, void, (), false);
          ^
/usr/local/google/home/echristo/sources/llvm/lib/Fuzzer/FuzzerExtFunctionsWeak.cpp:44:24: note: in definition of macro ‘EXT_FUNC’
   CheckFnPtr((void *)::NAME, #NAME, WARN);
                        ^
```

Differential Revision: https://reviews.llvm.org/D35243

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307686 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-11 18:27:48 +00:00
Matthias Braun
44a5145435 FuzzerUtilDarwin.cpp: We need to pass modifiable strings to posix_spawn
This fixes a bug where unmodifiable strings where passed to posix_spawn.

This is an attempt to unbreak the greendragon libFuzzer bot.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307424 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-07 18:53:24 +00:00
Kostya Serebryany
93a987eb3e [libFuzzer] change the default max_len from 64 to 4096. This will affect cases where libFuzzer is run w/o initial corpus or with a corpus of very small items.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305521 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-15 22:43:40 +00:00
George Karpenkov
4cbdf0eab2 Fixing section name for Darwin platforms for sanitizer coverage
On Darwin, section names have a 16char length limit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305429 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-14 23:40:25 +00:00
Kostya Serebryany
f1e76735cd [libFuzzer] really restrict the new test to Linux (fails on Mac/Windows currently)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305346 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-14 00:34:42 +00:00
Kostya Serebryany
41342f536d [libFuzzer] restrict the new test to Linux (fails on Mac currently)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305335 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-13 23:09:11 +00:00
Kostya Serebryany
9070c3ab92 [libFuzzer] initial support of -fsanitize-coverage=inline-8bit-counters in libFuzzer. This is not fully functional yet, but simple tests work
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305331 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-13 22:31:21 +00:00
Chandler Carruth
b428c9ffd2 Fix the includes in lib/Fuzzer on Windows that have ordering
dependencies and add comments to tell future maintainers about those
requirements.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@304843 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-06 23:28:01 +00:00
Chandler Carruth
e3e43d9d57 Sort the remaining #include lines in include/... and lib/....
I did this a long time ago with a janky python script, but now
clang-format has built-in support for this. I fed clang-format every
line with a #include and let it re-sort things according to the precise
LLVM rules for include ordering baked into clang-format these days.

I've reverted a number of files where the results of sorting includes
isn't healthy. Either places where we have legacy code relying on
particular include ordering (where possible, I'll fix these separately)
or where we have particular formatting around #include lines that
I didn't want to disturb in this patch.

This patch is *entirely* mechanical. If you get merge conflicts or
anything, just ignore the changes in this patch and run clang-format
over your #include lines in the files.

Sorry for any noise here, but it is important to keep these things
stable. I was seeing an increasing number of patches with irrelevant
re-ordering of #include lines because clang-format was used. This patch
at least isolates that churn, makes it easy to skip when resolving
conflicts, and gets us to a clean baseline (again).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@304787 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-06 11:49:48 +00:00
Mandeep Singh Grang
8c3abeed5e [llvm] Remove double semicolons
Reviewers: craig.topper, arsenm, mehdi_amini

Reviewed By: mehdi_amini

Subscribers: mehdi_amini, wdng, nhaehnle, javed.absar, llvm-commits

Differential Revision: https://reviews.llvm.org/D33924

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@304767 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-06 05:08:36 +00:00