637 Commits

Author SHA1 Message Date
Juergen Ributzka
26cbef5f44 [libfuzzer] Remove XFAIL for OutOfMemory test.
This test is now passing on Darwin.

See rdar://problem/31282257.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298886 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-27 22:33:05 +00:00
Vitaly Buka
cc4a0d11e4 [libFuzzer] Fix test on Windows.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298757 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-25 01:19:45 +00:00
Kostya Serebryany
2061be0b30 [libFuzzer] read asan's dedup_token while minimizing a crash and stop minimization if another bug was found during minimization (https://github.com/google/oss-fuzz/issues/452)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298755 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-25 00:56:08 +00:00
Kostya Serebryany
e1646b6e51 [libFuzzer] be more careful when calling strlen of strcmp parameters, PR32357
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298746 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-24 22:19:52 +00:00
Kostya Serebryany
a149d64a7e [libFuzzer] honor -exact_artifact_path for all intermediate files during crash minimization (https://github.com/google/oss-fuzz/issues/250)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298740 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-24 21:09:16 +00:00
Kostya Serebryany
3519a8a96e [libFuzzer] split two tests to get more parallelism in test runs
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298673 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-24 00:51:18 +00:00
Kostya Serebryany
300f834d9e [libFuzzer] increase kFeatureSetSize to 2^21 and make InputCorpus scale to that size. This will potentially make libFuzzer more sensitive on targets with lots of signals
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298671 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-24 00:45:15 +00:00
Kostya Serebryany
ce68a403f2 [libFuzzer] fix non-linux build
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298666 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-23 23:48:47 +00:00
Kostya Serebryany
550e23d356 [libFuzzer] create experimental support for user-provided coverage signal
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298654 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-23 22:43:12 +00:00
Kostya Serebryany
5db3fb7fb6 [libFuzzer] add two experimental flags to make corpus merging more scalable: -save_coverage_summary/-load_coverage_summary. This is still WIP, the documentation will come later if these flags survive
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298548 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-22 20:32:44 +00:00
Kostya Serebryany
31c659fd54 [libFuzzer] inline the code of __sanitizer_cov_trace_pc_guard into it
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298032 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-17 01:45:15 +00:00
Kostya Serebryany
2362f32e0e [libFuzzer] Experimenting with dictionary minimization.
Summary:
Tracking issue: https://github.com/google/oss-fuzz/issues/331


Reviewers: kcc

Reviewed By: kcc

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298031 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-17 01:40:09 +00:00
Kostya Serebryany
6ee36bcf11 [libFuzzer] add a test with two different bugs
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298030 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-17 01:33:16 +00:00
Kostya Serebryany
e79427160e [libFuzzer] add a dummy LLVMFuzzerMutate to afl/afl_driver.cpp (https://github.com/google/oss-fuzz/issues/460)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297919 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-15 23:54:40 +00:00
Kostya Serebryany
e6224abb77 [libFuzzer] call __sanitizer_print_memory_profile with two params
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297916 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-15 23:27:53 +00:00
Vitaly Buka
83daa29a86 Revert "[libFuzzer] Use ChooseUnitIdxToMutate to pick item for crossover."
Fails LLVMFuzzer.LLVMFuzzer.value-profile-strncmp.test.

This reverts commit r297891.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297912 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-15 23:08:18 +00:00
Vitaly Buka
e925a388a3 [libFuzzer] Use ChooseUnitIdxToMutate to pick item for crossover.
Differential Revision: https://reviews.llvm.org/D30683

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297891 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-15 20:59:27 +00:00
Kostya Serebryany
3785710791 [libFuzzer] remove even more stale code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297797 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-15 00:39:06 +00:00
Kostya Serebryany
59249af18d [libFuzzer] simplify code a bit
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297796 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-15 00:34:25 +00:00
Kostya Serebryany
ae8f1d8b85 [libFuzzer] remove more stale code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297785 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-14 21:47:52 +00:00
Kostya Serebryany
05628fa8ff [libFuzzer] don't clear Counters in TracePC::CollectFeatures since they will be cleared anyway in ResetMaps
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297783 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-14 21:40:53 +00:00
Kostya Serebryany
d18970b6b1 [libFuzzer] remove stale code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297781 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-14 21:30:14 +00:00
Vitaly Buka
f6fe3416fb [libFuzzer] Reorder includes in test
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297692 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-13 23:49:00 +00:00
Vitaly Buka
29082d9fca [libFuzzer] Fix compilation of CustomCrossOverAndMutateTest on Windows
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297690 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-13 23:46:30 +00:00
Kostya Serebryany
cef724571c [libFuzzer] add more iterations to LLVMFuzzer-Memcmp64BytesTest
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297554 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-11 05:14:49 +00:00
Kostya Serebryany
fbfddad6eb [libFuzzer] reduce the number of vector resizes during merge (https://github.com/google/oss-fuzz/issues/445)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297551 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-11 02:50:47 +00:00
Kostya Serebryany
3bc8c19932 [libFuzzer] print how much memory is consumed by the outer merge process (https://github.com/google/oss-fuzz/issues/445)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297546 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-11 02:26:20 +00:00
Kostya Serebryany
47ec3386d2 [libFuzzer] add test/LargeTest.cpp, mostly for manual experiments with large number of edges, not yet suitable for unit testing
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297544 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-11 01:54:06 +00:00
Kostya Serebryany
f0f231aaf9 [libFuzzer] remove fuzzer-jobs.test which is flaky and not very useful
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297543 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-11 01:48:54 +00:00
Vitaly Buka
c3e4809203 [fuzzer] Don't crash if LLVMFuzzerMutate was called by CustomCrossOver
Reviewers: kcc

Subscribers: llvm-commits, mgorny

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297202 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-07 20:37:38 +00:00
Kuba Mracek
66193c91b4 Un-XFAIL Fuzzer/test/dump_coverage.test. This now passes on Darwin (after r297094).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297110 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-07 01:01:38 +00:00
Mike Aizatsky
a5015a4186 [libfuzzer] do not use xargs for shell expansion
Summary:
After https://reviews.llvm.org/rL296904 xargs shouldn't be necesssary.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297094 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-06 23:42:14 +00:00
Mehdi Amini
a5db565998 un-Xfail Fuzzer test that decided to pass on Green Dragon
It may be flacky, I'll turn it into unsupported if it fails again.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296913 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-03 21:28:05 +00:00
Kostya Serebryany
27a5a29184 [libFuzzer] remove usage of the old coverage instrumentation
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296536 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-28 23:23:48 +00:00
Mehdi Amini
00684f5d0c Mark some libFuzzer tests as XFAIL'd on Darwin
We're bringing up a bot on Green Dragon right now:

http://green.lab.llvm.org/green/view/Experimental/job/libFuzzer

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296526 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-28 21:45:59 +00:00
Justin Bogner
af8c7cedc1 [libFuzzer] Update traces hooks test after r293741
This test now passes on darwin.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295902 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-22 23:12:36 +00:00
Justin Bogner
28c53fa4a0 [libFuzzer] Mark a test that infinite loops as unsupported
We need to investigate this, but for now it just causes too much
headache when trying to run these tests.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295900 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-22 23:05:17 +00:00
Kostya Serebryany
8a5fe4855b [libFuzzer] increase the size of FixedWord from 27 to 64, see PR31950
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295117 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-14 23:02:37 +00:00
Kostya Serebryany
36924d4080 Use "%zd" format specifier for printing number of testcases executed.
Summary:
This helps to avoid signed integer overflow after running a fast fuzz target for several hours, e.g.:

<...>
Done -1097903291 runs in 54001 second(s)



Reviewers: kcc

Reviewed By: kcc

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295112 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-14 22:14:36 +00:00
Marcos Pividori
fc4c8411e4 [libFuzzer] Use stoull instead of stol to ensure 64 bits.
Differential revision: https://reviews.llvm.org/D29831

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294769 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-10 18:44:14 +00:00
Eric Fiselier
a61fc423f3 [CMake] Fix pthread handling for out-of-tree builds
LLVM defines `PTHREAD_LIB` which is used by AddLLVM.cmake and various projects
to correctly link the threading library when needed. Unfortunately
`PTHREAD_LIB` is defined by LLVM's `config-ix.cmake` file which isn't installed
and therefore can't be used when configuring out-of-tree builds. This causes
such builds to fail since `pthread` isn't being correctly linked.

This patch attempts to fix that problem by renaming and exporting
`LLVM_PTHREAD_LIB` as part of`LLVMConfig.cmake`. I renamed `PTHREAD_LIB`
because It seemed likely to cause collisions with downstream users of
`LLVMConfig.cmake`.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294690 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-10 01:59:20 +00:00
Marcos Pividori
671eb85b72 [libFuzzer] Export external functions on tests.
We need to export external functions so they are found when calling
GetProcAddress() on Windows. But we can't use `__declspec(dllexport)` because
we want the targets to be completely independent from the fuzz engines and don't
depend on other header files. Also, we don't want to include platform specific
code managed with conditional macros.
So, the solution is to add the exported symbols with linker flags in cmake.

Differential revision: https://reviews.llvm.org/D29752

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294688 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-10 01:40:28 +00:00
Marcos Pividori
d9191ae5c6 [libFuzzer] Use dynamic loading for External Functions on Windows.
Replace weak aliases with dynamic loading.
Weak aliases were generating some problems when linking for MT on Windows. For
MT, compiler-rt's libraries are statically linked to the main executable the
same than libFuzzer, so if we use weak aliases, we are providing two different
default implementations for the same weak function and the linker fails.

In this diff I re implement ExternalFunctions() using dynamic loading, so it
works in both cases (MD and MT). Also, dynamic loading is simpler, since we are
not defining any auxiliary external function, and we don't need to deal with
weak aliases.
This is equivalent to the implementation using dlsym(RTLD_DEFAULT, FnName) for
Posix.

Differential revision: https://reviews.llvm.org/D29751

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294687 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-10 01:35:46 +00:00
Marcos Pividori
2ee8a5f7b7 [libFuzzer] Use long long to ensure 64 bits.
We should always use unsigned long long to ensure 64 bits. On Windows, unsigned
long is 4 bytes. This was the reason why value-profile-cmp4.test was failing on
Windows.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294390 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-08 00:03:31 +00:00
Marcos Pividori
7a5e009266 [libFuzzer] Use custom target instead of list of binaries for tests.
Update cmake to use a custom target TestBinaries instead of a list of targets.
This simplifies cmake, and fix some errors. This way, we don't have to propagate
the values into parents directories. We only need to use add_dependencies.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294389 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-08 00:03:26 +00:00
Marcos Pividori
f80dc2a04d [libFuzzer] Properly use Handle instead of FD on Windows.
For Windows, sanitizers work with Handles, not with posix file descriptors,
because they use the windows-specific API. So we need to convert the fds to
handles before passing them to the sanitizer library.
After this change, close_fd_mask is fixed for Windows (this fix some tests too).

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294388 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-08 00:03:18 +00:00
Marcos Pividori
255eed0380 [libFuzzer] Change Uninstrumented test name.
On Windows, executables with the word "uninst" included in their names are
associated with administrator privileges.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294387 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-08 00:03:13 +00:00
Marcos Pividori
ec59eb9d58 [libFuzzer] fuzzer-jobs requires posix.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294386 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-08 00:03:07 +00:00
Marcos Pividori
1ff471105f [libFuzzer] Update fuzzer.test to properly set environment variables.
Use env to set environment variables, so it works on Windows and Linux.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294385 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-08 00:03:03 +00:00
Marcos Pividori
155c4aab57 [libFuzzer] Don't add newline character when using echo in tests.
Add the option "-n", so we don't add a new line character at the end of the file
when using echo. (on Windows this means 2 characters).

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294384 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-08 00:02:59 +00:00