Kostya Serebryany
71ae15e6e7
[libFuzzer] remove dead code, NFC
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@291195 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-06 00:09:40 +00:00
Kostya Serebryany
93bacfd838
[libFuzzer] improve error handling during the merge (handle various IO failures)
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@291182 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-05 22:05:47 +00:00
Kostya Serebryany
3abdb9d382
[libFuzzer] use /tmp (or $TMPDIR, if present) to store temp files during merge
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@291078 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-05 04:32:19 +00:00
Kostya Serebryany
2aa90f609f
[libFuzzer] disable -print_pcs by default (was enabled by mistake)
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290899 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-03 18:51:28 +00:00
Kostya Serebryany
f178652c93
[libFuzzer] cleaner implementation of -print_pcs=1
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290739 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-30 01:13:07 +00:00
Reid Kleckner
1df399b264
Include <algorithm> for std::max etc
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290730 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-30 00:15:40 +00:00
Kostya Serebryany
e929bfc24b
[libFuzzer] make __sanitizer_cov_trace_switch more predictable
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290703 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-29 02:50:35 +00:00
Kostya Serebryany
d31ce373a9
[libFuzzer] add an experimental flag -experimental_len_control=1 that sets max_len to 1M and tries to increases the actual max sizes of mutations very gradually (second attempt)
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290637 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-27 23:24:55 +00:00
Kostya Serebryany
8f45dd30a7
[libFuzzer] don't create large random mutations when given an empty seed
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290634 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-27 22:15:04 +00:00
Kostya Serebryany
5249221f24
[libFuzzer] fix UB and simplify the computation of the RNG seed ( https://llvm.org/bugs/show_bug.cgi?id=31456 )
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290622 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-27 19:51:34 +00:00
Mike Aizatsky
d576930959
[libfuzzer] dump_coverage command line flag
...
Reviewers: kcc, vitalybuka
Differential Revision: https://reviews.llvm.org/D27942
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290138 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-19 22:18:08 +00:00
Daniel Jasper
a21e8a0091
Revert "[libFuzzer] add an experimental flag -experimental_len_control=1 that sets max_len to 1M and tries to increases the actual max sizes of mutations very gradually. Also remove a bit of dead code"
...
This reverts commit r289998.
See comment:
https://reviews.llvm.org/rL289998
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290043 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-17 12:27:49 +00:00
Kostya Serebryany
cc82ac2f3b
[libFuzzer] use less memory for merge
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290039 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-17 08:20:24 +00:00
Kostya Serebryany
dbf288304b
[libFuzzer] speed up __sanitizer_cov_trace_switch a bit more (remove DIV)
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290034 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-17 02:23:35 +00:00
Kostya Serebryany
99cbf23989
[libFuzzer] remove stale test
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290033 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-17 02:18:59 +00:00
Kostya Serebryany
fdff3a8925
[libFuzzer] when tracing switch statements, handle only one case at a time (to make things faster). Also ensure that the signals from value profile do not intersect with the regular coverage
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290031 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-17 02:03:34 +00:00
Mike Aizatsky
48d47ae3d9
[libfuzzer] removing experimental FuzzerFnAdapter
...
Summary: This is superceded by protobuf mutation work.
Reviewers: kcc
Subscribers: mgorny
Differential Revision: https://reviews.llvm.org/D27865
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290018 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-17 00:12:13 +00:00
Kostya Serebryany
c7ab3c7402
[libFuzzer] avoid msan false positives in more cases
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289999 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-16 22:45:25 +00:00
Kostya Serebryany
eb30028464
[libFuzzer] add an experimental flag -experimental_len_control=1 that sets max_len to 1M and tries to increases the actual max sizes of mutations very gradually. Also remove a bit of dead code
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289998 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-16 22:42:05 +00:00
Marcos Pividori
4682af7773
[libFuzzer] Fix index error in SearchMemory() implementation for Windows.
...
Differential Revision: https://reviews.llvm.org/D27731
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289966 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-16 17:35:25 +00:00
Marcos Pividori
37ea43a17c
[libFuzzer] Remove unnecessary includes of posix headers.
...
Remove includes of "unistd.h" header, which is missing in non posix
systems.
Differential Revision: https://reviews.llvm.org/D277300
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289965 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-16 17:35:21 +00:00
Marcos Pividori
1c5866fe6b
[libFuzzer] Update tests to use more general functions instead of posix specific.
...
Replace sleep() posix function by a more portable sleep_for() function
from std. Also, ignore memmem() and strcasestr() on Windows.
Differential Revision: https://reviews.llvm.org/D27729
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289964 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-16 17:35:13 +00:00
Kostya Serebryany
abe2ee53b6
[libFuzzer] enable the failure-resistant merge by default (with trace-pc-guard only)
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289772 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-15 06:21:21 +00:00
Kostya Serebryany
d400714375
[libFuzzer] disable msan for one more hook that reads target's data that might be uninitialized
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289680 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-14 18:13:02 +00:00
Kostya Serebryany
57d813c8da
[libFuzzer] fix an UB (invalid shift) spotted by ubsan. The code worked fine by luck, because the way shifts actually work on clang+x86
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289607 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-13 22:49:14 +00:00
Marcos Pividori
ebaf57b14f
[libFuzzer] Add missing header needed for Windows.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289564 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-13 17:46:48 +00:00
Marcos Pividori
fae92e9e69
[libFuzzer] Avoid name collision with Windows API.
...
Windows uses some macros to replace DeleteFile() by DeleteFileA() or
DeleteFileW(). This was causing an error at link time.
DeleteFile was renamed to RemoveFile().
Differential Revision: https://reviews.llvm.org/D27577
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289563 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-13 17:46:40 +00:00
Marcos Pividori
fed659a90c
[libFuzzer] Implement DirName() for Windows.
...
Implement DirName from scratch to avoid dependencies on external libraries.
It's based on MSDN documentation for Naming Files, Paths, and Namespaces.
The algorithm can't simply start from the end and look backwards for the
first separator, because we need to preserve the prefix that represent
the root location. We shouldn't remove anything there. In Windows we
have many different options, like:
\\Server\Share\ , \ , C: , C:\ , \\?\C:\ , \\?\UNC\Server\Share\
We remove the last separator in the rest of the path, if it exists.
It was implemented to have a similar behaviour to dirname() in linux,
removing trailing separators, returning "." when the path doesn't
contain separators, etc.
Differential Revision: https://reviews.llvm.org/D27579
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289562 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-13 17:46:32 +00:00
Marcos Pividori
f2c03c3bb0
[libFuzzer] Fix bug in detecting timeouts when input string is empty.
...
I added a new flag RunningCB to know if the Fuzzer's main thread is
running the CB function, instead of using (!CurrentUnitSize).
(!CurrentUnitSize) doesn't work properly. For example, in FuzzerLoop.cpp,
inside ShuffleAndMinimize() function, we execute the callback with an
empty string (size=0). Previous implementation failed to detect timeouts
in that execution.
Also, I add a regression test for that case.
Differential Revision: https://reviews.llvm.org/D27433
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289561 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-13 17:46:25 +00:00
Marcos Pividori
f51c50474c
[libFuzzer] Clean up headers and file formatting of LibFuzzer files.
...
Reorganize #includes to follow LLVM Coding Standards.
Include some missing headers. Required to use `Printf()`.
Aside from that, this patch contains no functional change.
It is purely a re-organization.
Differential Revision: https://reviews.llvm.org/D27363
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289560 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-13 17:46:11 +00:00
Marcos Pividori
611506b936
[libFuzzer] Properly use unsigned for workers, jobs and NumberOfCpuCores.
...
std:🧵 :hardware_concurrency() returns an unsigned, so I modify
NumberOfCpuCores() to return unsigned too.
The number of cpus is used to define the number of workers, so I decided
to update the worker and jobs flags to be declared as unsigned too.
Differential Revision: https://reviews.llvm.org/D27685
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289559 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-13 17:45:53 +00:00
Marcos Pividori
0ca1e73f19
[libFuzzer] Properly use unsigned for Process ID.
...
Use unsigned for PID instead of signed int. GetCurrentProcessId() returns
an unsigned (DWORD) so we must be sure we can deal with all possible values.
I use a long unsigned to be sure it can hold a 32 bit unsigned (DWORD).
Differential Revision: https://reviews.llvm.org/D27281
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289558 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-13 17:45:44 +00:00
Marcos Pividori
9fb21ea4f5
[libFuzzer] Improve Signal Handler interface.
...
Add new flags to FuzzingOptions to represent the different conditions
on the signal handling. These options are passed when calling
SetSignalHandler().
This changes simplify the implementation of Windows's exception
handling. Now we can define a unique handler for all the exceptions.
Differential Revision: https://reviews.llvm.org/D27238
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289557 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-13 17:45:20 +00:00
Kostya Serebryany
d7b8181022
[libFuzzer] don't require extra flags with -minimize_crash=1 (default to -max_total_time=600). Also respect exact_artifact_path when outputting the end result
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289506 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-13 00:40:47 +00:00
Marcos Pividori
beb753026a
[libFuzzer] Implement Timers for Windows.
...
Implemented timeouts for Windows using TimerQueueTimers.
Timers are used to supervise the time of execution of the
callback function that is being fuzzed.
Differential Revision: https://reviews.llvm.org/D27237
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289495 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-12 23:25:11 +00:00
Kostya Serebryany
6e5e12ede9
[libFuzzer] split one slow test into several, for more parallel testing
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289481 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-12 22:55:25 +00:00
Kostya Serebryany
3e014d06f7
[libFuzzer] make SimpleCmpTest a bit simpler to crack and more verbose
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289477 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-12 22:39:33 +00:00
Kostya Serebryany
851cd4f9a2
[libFuzzer] build libFuzzer itself with asan
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289469 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-12 20:58:10 +00:00
Kostya Serebryany
3937d703a6
[libFuzzer] respect -max_len during merge
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289467 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-12 20:39:35 +00:00
Kostya Serebryany
d123ac5f20
[libFuzzer] don't depend on time in a test
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289368 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-11 06:28:09 +00:00
Kostya Serebryany
d27bd04048
[libFuzzer] test cleanup (3)
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289314 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-10 02:48:42 +00:00
Kostya Serebryany
5cb386d1cd
[libFuzzer] test cleanup (2)
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289313 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-10 02:47:00 +00:00
Kostya Serebryany
9c5c57d05a
[libFuzzer] test cleanup
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289312 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-10 02:45:56 +00:00
Kostya Serebryany
1b6cd25422
[libFuzzer] switch all libFuzzer tests to use -fsanitize-coverage=trace-pc-guard. Support for the previosly used instrumentation will be removed in the following changes
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289311 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-10 02:26:23 +00:00
Kostya Serebryany
bd9186853d
[libFuzzer] use __sanitizer_get_module_and_offset_for_pc to get the module name while printing the coverage
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289310 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-10 01:19:35 +00:00
Kostya Serebryany
a3def13005
[libFuzzer] implement crash-resistant merge ( https://github.com/google/sanitizers/issues/722 ). This is a first experimental variant that needs some more testing, thus not yet adding a lit test (but there are unit tests).
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289166 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-09 01:17:24 +00:00
Kostya Serebryany
152208fcde
[libFuzzer] include FuzzerIO.h and hopefully fix the Mac build. reported by Dejan Mircevski
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288979 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-07 21:02:48 +00:00
Kostya Serebryany
fe3cc4d2c5
[libFuzzer] refactor the code to allow collecting features in different ways. Also initialize a couple of Fuzzer:: members that might have been used uninitialized :(
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288731 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-05 23:35:22 +00:00
Zachary Turner
1a45ade2ce
Resubmit "[LibFuzzer] Split FuzzerUtil for Posix and Windows."
...
This resubmits r288529, which was resubmitted because it broke a
fuzzer bot. According to kcc@ the test that broke was flakey
and it is unlikely to be a result of this patch.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288549 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-02 23:02:01 +00:00
Zachary Turner
609477eea7
Revert "[LibFuzzer] Split FuzzerUtil for Posix and Windows."
...
This reverts commit r288529, as it seems to introduce some
problems on the Linux bots.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288533 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-02 20:54:56 +00:00