Commit Graph

11 Commits

Author SHA1 Message Date
jonathanmetzman f939fcfa6f
[base-builder] Use builtin libFuzzer instead of recompling. (#4682)
Instead of recompiling libFuzzer each time we do a libFuzzer
build of a project, always use Clang's builtin version of libFuzzer.
Do this by copying the builtin libFuzzer to /usr/local/lib/FuzzingEngine.a.
This means that the projects that aren't using -fsanitize=fuzzer now also
use the builtin libFuzzer. And we no longer need to compile a sanitized
libFuzzer for them.

This change improves fuzzing performance and developer experience.
1. It improves developer experience by saving time spent compiling libFuzzer
when recompiling fuzzers.
The time saved is about 25 seconds on my machine.
This will make iterating on fuzzer integration much easier.
2. It improves fuzzer performance. The builtin libFuzzer isn't sanitized so it is faster.
In some cases (see [here](https://bugs.chromium.org/p/chromium/issues/detail?id=934639))
sanitized libFuzzers can waste 37% of the time running non-performant implementations
of code that the builtin-libFuzzer can do almost instantaneously (assembly vs C code).

The consequences of improving developer experience and 
fuzzer performance aren't so easy to measure (though 
we will look for perf consequences on ClusterFuzz).

But some of the consequences of saving time compiling libFuzzer 
are easy to figure out and quite important. They are:
1. Saving $14646 a year on build costs. Based on the following:
build time saved (on GCB): ~38 seconds
libFuzzer builds per day: 990
builds per year: >365
price per build-minute (32 core instance, https://cloud.google.com/build/pricing): 0.064
38/60*.064*990*365 = 14,646

2. Speeding up infra-tests.
Many of the integration tests build fuzzers and so building libFuzzer 
was a considerable bottleneck.
On my many-core machine the savings were good and noticeable 
(and are probably larger on the less performant CI machines).

|                            | With compiling libfuzzer | Without compiling libfuzzer |
| ---------------------- | ------------------------------- | ----------------------------------- |
| Parallel tests       | 45                                  | 34                                       | 
| Sequential tests  | 276                                | 190                                     | 

3. Speeding up CIFuzz.
CIFuzz needs to be fast but it spends about 40 seconds compiling libFuzzer.
In a run where no bugs are discovered which is intended to take about 20 minutes
compiling libFuzzer takes about 3% of the time (40/(20*60)*100).
Now we don't need to waste that time.
See https://github.com/google/oss-fuzz/issues/5180, which this partially fixes.

This bug fixes https://github.com/google/oss-fuzz/issues/2312 and  https://github.com/google/oss-fuzz/issues/4677.
2021-02-24 11:36:03 -08:00
jonathanmetzman ae9398deef
Change LIB_FUZZING_ENGINE to -fsanitize=fuzzer in libFuzzer builds (#2312) 2019-04-15 10:05:02 -07:00
Max Moroz 946d0603ba
[infra] Enabling DataFlow build configuration (#1632). (#2292)
* [infra] Enabling DataFlow build configuration (#1632).

* Copy all data flow scripts from the libFuzzer repo.
2019-04-09 07:25:14 -07:00
jonathanmetzman 2c9fa6a668
Allow preloading external libFuzzer functions using LD_PRELOAD (#2255) 2019-03-20 16:11:51 -07:00
Abhishek Arya bcf3d1dfa8
Revert "[infra] Compile fuzzing engine without SANITIZER_FLAGS unless MSan is used. (#1522)" (#1574)
This reverts commit 63d9392e59.
2018-06-26 13:08:14 -07:00
Max Moroz 63d9392e59
[infra] Compile fuzzing engine without SANITIZER_FLAGS unless MSan is used. (#1522)
* [infra] Compile fuzzing engine without SANITIZER_FLAGS unless MSan is used.

* Use an additional FUZZING_ENGINE_SANITIZER_FLAGS variable and simplify the script

* Use $FUZZING_ENGINE_SANITIZER_FLAGS in compile_libfuzzer.
2018-06-18 10:10:01 -07:00
Max Moroz 2c23c20d8c
[infra] enable -fsanitize=unsigned-integer-overflow in non-faulting mode (#910). (#927) 2017-10-27 14:13:11 -07:00
Abhishek Arya 499690c55f Enable UBSan without vptr for ffmpeg, disable vptr for libFuzzer. (#404) 2017-02-17 23:13:50 -08:00
Kostya Serebryany b74fe4041b build libFuzzer with -O2 (#335) 2017-01-30 20:43:00 -08:00
Mike Aizatsky 23b72b4130 [infra] afl fuzzing engine support (#128)
Use FUZZING_ENGINE="afl" to build fuzzers.
2017-01-05 13:40:45 -08:00
Mike Aizatsky 3d220f2588 [infra] renaming images: base->base-image, base-libfuzzer->base-builder
Continue publishing base-libfuzzer until images a built and
derived images migrated.

Issue #142
2016-12-29 13:39:41 -08:00