1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-24 05:23:45 +02:00
Commit Graph

627 Commits

Author SHA1 Message Date
Kostya Serebryany
9dba50d07d [libFuzzer] inline the code of __sanitizer_cov_trace_pc_guard into it
llvm-svn: 298032
2017-03-17 01:45:15 +00:00
Kostya Serebryany
5a21721577 [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

llvm-svn: 298031
2017-03-17 01:40:09 +00:00
Kostya Serebryany
663216e6a6 [libFuzzer] add a test with two different bugs
llvm-svn: 298030
2017-03-17 01:33:16 +00:00
Kostya Serebryany
d2773b13e1 [libFuzzer] add a dummy LLVMFuzzerMutate to afl/afl_driver.cpp (https://github.com/google/oss-fuzz/issues/460)
llvm-svn: 297919
2017-03-15 23:54:40 +00:00
Kostya Serebryany
6644fe3b16 [libFuzzer] call __sanitizer_print_memory_profile with two params
llvm-svn: 297916
2017-03-15 23:27:53 +00:00
Vitaly Buka
82ec39d3c5 Revert "[libFuzzer] Use ChooseUnitIdxToMutate to pick item for crossover."
Fails LLVMFuzzer.LLVMFuzzer.value-profile-strncmp.test.

This reverts commit r297891.

llvm-svn: 297912
2017-03-15 23:08:18 +00:00
Vitaly Buka
d6a6681ebf [libFuzzer] Use ChooseUnitIdxToMutate to pick item for crossover.
Differential Revision: https://reviews.llvm.org/D30683

llvm-svn: 297891
2017-03-15 20:59:27 +00:00
Kostya Serebryany
488199d6cf [libFuzzer] remove even more stale code
llvm-svn: 297797
2017-03-15 00:39:06 +00:00
Kostya Serebryany
5b7352b9bb [libFuzzer] simplify code a bit
llvm-svn: 297796
2017-03-15 00:34:25 +00:00
Kostya Serebryany
ffd7bbf928 [libFuzzer] remove more stale code
llvm-svn: 297785
2017-03-14 21:47:52 +00:00
Kostya Serebryany
3421df1bbe [libFuzzer] don't clear Counters in TracePC::CollectFeatures since they will be cleared anyway in ResetMaps
llvm-svn: 297783
2017-03-14 21:40:53 +00:00
Kostya Serebryany
6845637d3c [libFuzzer] remove stale code
llvm-svn: 297781
2017-03-14 21:30:14 +00:00
Vitaly Buka
8e3839c39d [libFuzzer] Reorder includes in test
llvm-svn: 297692
2017-03-13 23:49:00 +00:00
Vitaly Buka
5c4b250aa0 [libFuzzer] Fix compilation of CustomCrossOverAndMutateTest on Windows
llvm-svn: 297690
2017-03-13 23:46:30 +00:00
Kostya Serebryany
631b1c7fb6 [libFuzzer] add more iterations to LLVMFuzzer-Memcmp64BytesTest
llvm-svn: 297554
2017-03-11 05:14:49 +00:00
Kostya Serebryany
537c4f4035 [libFuzzer] reduce the number of vector resizes during merge (https://github.com/google/oss-fuzz/issues/445)
llvm-svn: 297551
2017-03-11 02:50:47 +00:00
Kostya Serebryany
4005067c57 [libFuzzer] print how much memory is consumed by the outer merge process (https://github.com/google/oss-fuzz/issues/445)
llvm-svn: 297546
2017-03-11 02:26:20 +00:00
Kostya Serebryany
e6fdbfa76f [libFuzzer] add test/LargeTest.cpp, mostly for manual experiments with large number of edges, not yet suitable for unit testing
llvm-svn: 297544
2017-03-11 01:54:06 +00:00
Kostya Serebryany
f08772cd99 [libFuzzer] remove fuzzer-jobs.test which is flaky and not very useful
llvm-svn: 297543
2017-03-11 01:48:54 +00:00
Vitaly Buka
81f371398b [fuzzer] Don't crash if LLVMFuzzerMutate was called by CustomCrossOver
Reviewers: kcc

Subscribers: llvm-commits, mgorny

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

llvm-svn: 297202
2017-03-07 20:37:38 +00:00
Kuba Mracek
9f1233be38 Un-XFAIL Fuzzer/test/dump_coverage.test. This now passes on Darwin (after r297094).
llvm-svn: 297110
2017-03-07 01:01:38 +00:00
Mike Aizatsky
795e105c6e [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

llvm-svn: 297094
2017-03-06 23:42:14 +00:00
Mehdi Amini
b0f9528da5 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.

llvm-svn: 296913
2017-03-03 21:28:05 +00:00
Kostya Serebryany
77dcee447a [libFuzzer] remove usage of the old coverage instrumentation
llvm-svn: 296536
2017-02-28 23:23:48 +00:00
Mehdi Amini
7ba97a9871 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

llvm-svn: 296526
2017-02-28 21:45:59 +00:00
Justin Bogner
0fbb15aef6 [libFuzzer] Update traces hooks test after r293741
This test now passes on darwin.

llvm-svn: 295902
2017-02-22 23:12:36 +00:00
Justin Bogner
df27396295 [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.

llvm-svn: 295900
2017-02-22 23:05:17 +00:00
Kostya Serebryany
8c10b49e39 [libFuzzer] increase the size of FixedWord from 27 to 64, see PR31950
llvm-svn: 295117
2017-02-14 23:02:37 +00:00
Kostya Serebryany
d4443e589f 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

llvm-svn: 295112
2017-02-14 22:14:36 +00:00
Marcos Pividori
3f6b34a274 [libFuzzer] Use stoull instead of stol to ensure 64 bits.
Differential revision: https://reviews.llvm.org/D29831

llvm-svn: 294769
2017-02-10 18:44:14 +00:00
Eric Fiselier
db10580e9b [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`.

llvm-svn: 294690
2017-02-10 01:59:20 +00:00
Marcos Pividori
b58308ad4f [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

llvm-svn: 294688
2017-02-10 01:40:28 +00:00
Marcos Pividori
03ad19858d [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

llvm-svn: 294687
2017-02-10 01:35:46 +00:00
Marcos Pividori
f7fe49c66d [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

llvm-svn: 294390
2017-02-08 00:03:31 +00:00
Marcos Pividori
a987f5c9ea [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

llvm-svn: 294389
2017-02-08 00:03:26 +00:00
Marcos Pividori
0e996298b5 [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

llvm-svn: 294388
2017-02-08 00:03:18 +00:00
Marcos Pividori
f49239b668 [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

llvm-svn: 294387
2017-02-08 00:03:13 +00:00
Marcos Pividori
d95b3df910 [libFuzzer] fuzzer-jobs requires posix.
llvm-svn: 294386
2017-02-08 00:03:07 +00:00
Marcos Pividori
091ae16db7 [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

llvm-svn: 294385
2017-02-08 00:03:03 +00:00
Marcos Pividori
9378b085a2 [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

llvm-svn: 294384
2017-02-08 00:02:59 +00:00
Marcos Pividori
ab85d9d20e [libFuzzer] Disable ulimit test on windows.
Differential Revision: https://reviews.llvm.org/D29535

llvm-svn: 294383
2017-02-08 00:02:54 +00:00
Marcos Pividori
d0a8d0f32b [libFuzzer] Remove ? wildcard on tests.
We can not use the wildcard ? on Windows.

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

llvm-svn: 294382
2017-02-08 00:02:50 +00:00
Marcos Pividori
239e584cdd [libFuzzer] Update fuzzer-segv to set environment variables.
Use env to set environment variables, so it works on Linux and Windows.

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

llvm-svn: 294381
2017-02-08 00:02:45 +00:00
Marcos Pividori
87b8887c08 [libFuzzer] Properly configure tests for Windows.
This configuration is necessary, and is included in all tests suites.
We need to execute: `config.test_format = lit.formats.ShTest(False)`
Otherwise, lit will try to use bash, which generates many problems.

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

llvm-svn: 294380
2017-02-08 00:02:41 +00:00
Marcos Pividori
49baf48cc8 [libFuzzer] Simplify dump_coverage test.
Environment variables are handled differently on Windows. In this case it is not
necessary to use environment variables. So, I simplify the test to work on
Windows.

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

llvm-svn: 294379
2017-02-08 00:02:36 +00:00
Marcos Pividori
373b5f62d1 [libFuzzer] Update Load test to work on 32 bits.
We should ensure the size of the variable `a` is 8 bytes. Otherwise, this
generates a stack buffer overflow inside the memcpy call in 32 bits machines.
(We write more bytes than the size of a, when it is 4 bytes)

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

llvm-svn: 294378
2017-02-08 00:02:32 +00:00
Marcos Pividori
74432f4efe [libFuzzer] Update test to consider different exceptions.
Differential Revision: https://reviews.llvm.org/D29531

llvm-svn: 294377
2017-02-08 00:02:25 +00:00
Marcos Pividori
7f9b9089f9 [libFuzzer] Temporarily fix Shmem for Windows.
In this diff, I add stubs for shared memory on Windows. Now we can compile and
use libFuzzer without support for shared memory.

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

llvm-svn: 294376
2017-02-08 00:02:12 +00:00
Kostya Serebryany
46cf1b2be5 [libFuzzer] replace std::random_shuffle with std::shuffle as std::random_shuffle is being deprecated in C++17. Also simplify fuzzer::Random. NFC
llvm-svn: 294366
2017-02-07 22:37:34 +00:00
Kostya Serebryany
b408a28a3a [libFuzzer] make code less clever to avoid fallthrough in switch (and in turn avoid compiler warnings). NFC. Suggested by Christian Holler.
llvm-svn: 294239
2017-02-06 21:21:37 +00:00