Commit Graph

191 Commits

Author SHA1 Message Date
Kostya Serebryany
fb614ec4d4 [libFuzzer] re-enable test for -abort_on_timeout=1, this time protecting from ASAN_OPTIONS set outside
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@259263 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-29 23:19:00 +00:00
Ivan Krasin
79890da71d Temporary disable broken fuzzer/timeout tests.
Reviewers: kcc

Differential Revision: http://reviews.llvm.org/D16543

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258702 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-25 19:05:45 +00:00
Kostya Serebryany
d75ddafc2f [libFuzzer] add -abort_on_timeout option
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258631 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-23 19:34:19 +00:00
Kostya Serebryany
21a169fad1 [libFuzzer] add more fields to DictionaryEntry to count the number of uses and successes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258589 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-22 23:55:14 +00:00
Ivan Krasin
da57df2854 Use std::piecewise_constant_distribution instead of ad-hoc binary search.
Summary:
Fix the issue with the most recently discovered unit receiving much less attention.

Note: this is the second attempt (prev: r258473). Now, libc++ build is fixed.

Reviewers: aizatsky, kcc

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D16487

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258571 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-22 22:28:27 +00:00
Ivan Krasin
55b3567cb1 Revert r258473 as it's breaking the build with libc++
Reviewers: kcc

Differential Revision: http://reviews.llvm.org/D16441

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258479 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-22 03:21:52 +00:00
Ivan Krasin
3e0fdb8944 Use std::piecewise_constant_distribution instead of ad-hoc binary search.
Summary:
Fix the issue with the most recently discovered unit receiving much less attention.

Note: I had to change the seed for one test to make it pass. Alternatively,
the number of runs could be increased. I believe that the average time of
'foo' discovery is not increased, just seed=1 was particularly convenient
for the previous PRNG scheme used.

Reviewers: aizatsky, kcc

Subscribers: llvm-commits, kcc

Differential Revision: http://reviews.llvm.org/D16419

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258473 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-22 01:32:34 +00:00
Kostya Serebryany
75da488104 [libFuzzer] don't do expensive memmem if the result will not be used
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258462 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-22 01:04:58 +00:00
Kostya Serebryany
7e85cfa5be [libFuzzer] don't use std::vector in one more hot path
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258380 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-21 01:52:14 +00:00
Mike Aizatsky
b1020e3809 [libfuzzer] use %p for printing addresses
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258370 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-21 00:02:09 +00:00
Kostya Serebryany
429a7edf9b [libFuzzer] use std::mt19937 for generating random numbers by default. Fix MyStoll to handle negative values. Use std::any_of instead of std::find_if
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258178 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-19 20:33:57 +00:00
Kostya Serebryany
baa00e52a5 [libFuzzer] replace vector with a simpler data structure in the Dictionaries to avoid memory allocations on hot path
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257985 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-16 03:53:32 +00:00
Kostya Serebryany
1e595319e3 [libFuzzer] introduce LLVMFuzzerInitialize
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257980 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-16 01:23:12 +00:00
Kostya Serebryany
f7dd1d2c0c [libFuzzer] move some code from public interface header to a non-public header. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257963 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-16 00:04:36 +00:00
Kostya Serebryany
f1af856009 [libFuzzer] do mutations based on memcmp/strcmp interceptors under a separate flag (-use_memcmp, default=1)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257873 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-15 06:24:05 +00:00
Kostya Serebryany
9039b1ff4e [libFuzzer] use custom stol; also introduce __libfuzzer_is_present so that users can check for its presence.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257848 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-15 00:17:37 +00:00
Kostya Serebryany
a416b73b12 [libFuzzer] suggest a dictionary to the user of some of the trace-based dictionary entries were successful
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257736 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-14 02:36:44 +00:00
Kostya Serebryany
92e8dcd607 [libFuzzer] make CurrentUnit a POD object instead of vector to avoid extra allocations
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257713 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-13 23:46:01 +00:00
Kostya Serebryany
3888fb079a [libFuzzer] make sure we find buffer overflow in the input buffer. Previously, re-using the same vector object was hiding buffer overflows (unless we used annotated vector)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257701 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-13 23:02:30 +00:00
Kostya Serebryany
43a24b5d93 [libFuzzer] make sure to update CurrentUnit when drilling
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257560 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-13 01:58:27 +00:00
Kostya Serebryany
53ff84bf11 [libFuzzer] add a macro LLVM_FUZZER_DEFINES_SANITIZER_WEAK_HOOOKS
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257482 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-12 16:50:18 +00:00
Kostya Serebryany
7b0624d17e [libFuzzer] when a new unit is discovered using a dictionary, print all used dictionary entries
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257435 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-12 02:36:59 +00:00
Kostya Serebryany
71afbb96dc [libFuzzer] add various debug prints. Also don't mutate based on a cmp trace like (a eq a) or (a neq a)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257434 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-12 02:08:37 +00:00
Kostya Serebryany
d89bfb65a8 [libFuzzer] extend the weak memcmp/strcmp/strncmp interceptors to receive the result of the computations. With that, don't do any mutations if memcmp/etc returned 0
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257423 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-12 00:43:42 +00:00
Kostya Serebryany
38c36e3216 [libFuzzer] debug prints in tracing
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257249 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-09 03:46:08 +00:00
Kostya Serebryany
7fddde9543 [libFuzzer] change the way trace-based mutations are applied. Instead of a custom code just rely on the automatically created dictionary
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257248 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-09 03:08:58 +00:00
Kostya Serebryany
295ef47f9e [libFuzzer] don't limit memcmp tracing with 8 bytes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257245 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-09 01:39:55 +00:00
Kostya Serebryany
461ac91112 [libFuzzer] refactor the way we collect cmp traces (don't use std::vector, don't limit with 8 bytes)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257239 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-09 00:38:40 +00:00
Kostya Serebryany
ab240104f0 [libFuzzer] add a position hint to the dictionary-based mutator
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257013 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-07 01:49:35 +00:00
Kostya Serebryany
92ec084eaf [libFuzzer] extend the dictionary mutator to optionally overwrite data with the dict entry
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@256900 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-06 02:13:04 +00:00
Mike Aizatsky
1cea7723fa [libfuzzer] print_new_cov_pcs experimental option.
Differential Revision: http://reviews.llvm.org/D15901

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@256882 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-06 00:21:22 +00:00
Kostya Serebryany
325442be58 [libFuzzer] make trace-based fuzzing not crash in presence of threads
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@256876 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-06 00:03:35 +00:00
Kostya Serebryany
7482ffbe49 [libFuzzer] add AFL-style dictionary for C++, remove the old file with tokens
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@256229 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-22 01:50:51 +00:00
Kostya Serebryany
62663ee66e [libFuzzer] deprecate -save_minimized_corpus, -merge can be used instead
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@256086 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-19 03:42:16 +00:00
Kostya Serebryany
cf686ded44 [libFuzzer] split the tests to run them in parallel, remove one redundant test
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@256085 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-19 03:35:30 +00:00
Kostya Serebryany
a1e5f35b02 [libFuzzer] make CrossOver just one of the other mutations
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@256081 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-19 02:49:09 +00:00
Kostya Serebryany
7ed616c150 [libFuzzer] print successfull mutations sequences
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@256071 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-19 01:09:49 +00:00
Peter Collingbourne
5b00f3232b Fuzzer: Fix library dependencies.
Newer versions of libstdc++ (4.9+), as well as libc++, depend directly on
libpthread from the standard library headers, so libfuzzer needs to declare
a standard library dependency.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@255745 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-16 02:14:57 +00:00
Mike Aizatsky
6d5ee5a800 [LibFuzzer] Introducing FUZZER_FLAG_UNSIGNED and using it for seeding.
Differential Revision: http://reviews.llvm.org/D15339

done

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@255296 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-10 20:41:53 +00:00
Kostya Serebryany
d33fc70ecf [libFuzzer] don't reload the corpus more than once every second
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254824 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-05 02:09:22 +00:00
Kostya Serebryany
3f8065b694 [libFuzzer] compute base64 in-process instead of using an external lib. Since libFuzzer should not depend on anything, just re-implement base64 encoder. PR25746
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254784 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-04 22:29:39 +00:00
Mike Aizatsky
ba2d199d49 Libfuzzer: do not pass null into user function
Differential Revision: http://reviews.llvm.org/D15098

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254558 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-02 22:43:53 +00:00
Kostya Serebryany
569415a25b [libFuzzer] add a test that is built with -fsanitize-coverage=trace-bb
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254484 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-02 02:49:37 +00:00
Kostya Serebryany
e8d7ae6209 [libFuzzer] add a flag -exact_artifact_path
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254100 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-25 21:40:46 +00:00
Kostya Serebryany
45ac8bc6fc [libFuzzer] don't crash when reporting a leak in test_single_input mode
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253761 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-21 03:46:43 +00:00
Kostya Serebryany
01400f4e22 [libFuzzer] remove default initializer as a workaround for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68399. Don't need it anyway.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253419 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-18 01:08:30 +00:00
Kostya Serebryany
ad9ec32c1f [libFuzzer] make libFuzzer build even with a compiler that does not have sanitizer headers
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253003 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-13 01:54:40 +00:00
Mike Aizatsky
c1a030fd64 output_csv libfuzzer option
Summary:
The option outputs statistics in CSV format preceded by 1 header line.
This is intended for machine processing of the output.
-verbosity=0 should likely be set.

Differential Revision: http://reviews.llvm.org/D14600

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252856 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-12 04:38:40 +00:00
Kostya Serebryany
1a42a60ebc [libFuzzer] experimental flag -drill (another search heuristic; Mike Aizatsky's idea)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252838 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-12 01:02:01 +00:00
Kostya Serebryany
f357e6fb5f [libFuzzer] add UninstrumentedTest.cpp (missing from a previous commit)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252658 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-10 22:02:56 +00:00