Commit Graph

676 Commits

Author SHA1 Message Date
jonathanmetzman 8c4ad095e9
[CIFuzz] Refactor in preparation for filestore (#5841)
1. Moving the _create_config and create_config functions from build_fuzzers_test.py and run_fuzzers_test.py into test_helpers.py (which is now part of cifuzz instead of infra) and share code between them.
2. Rename artifacts_dir to crashes_dir in run_fuzzers.py. "artifacts" is ambiguous.
3. Make some small changes to pytest.ini to improve debugging.
2021-05-26 09:45:22 -07:00
Evgeny Vereshchagin ff25180bd7
infra: stop patching llvm-symbolizer (#5839)
* infra: stop patching llvm-symbolizer

to prevent it from failing to start up with
```
NEW_FUNC[1/1]: llvm-symbolizer: symbol lookup error: /tmp/not-out/instrumented_libraries/lib/x86_64-linux-gnu/libz.so.1: undefined symbol: __msan_va_arg_overflow_size_tls
==45==WARNING: external symbolizer didn't start up correctly!
```

Closes https://github.com/google/oss-fuzz/issues/5349

* infra: reformat patch_build.py with yapf

to make the presubmit check happy
2021-05-25 23:06:59 +00:00
Fabian Meumertzheim 6defe8c725
[infra] File-level coverage for JVM projects (#5822)
* Exclude Jazzer classes from coverage reports

* Generate file-level coverage data for Java

Adds per-file coverage information to llvm-cov style *.json files for
Java targets.

This provides full CI Fuzz support for "jvm" projects.
2021-05-25 08:05:16 -07:00
Mohammed Al Sahaf f43928cf47
[infra] fix handling Go's SIV in coverage santizer (#5813) 2021-05-25 07:52:11 -07:00
van Hauser 878a05a092
afl++: increase forkserver timeout (#5784) 2021-05-24 13:43:34 -07:00
Fabian Meumertzheim f053e761ec
[infra] Allow shell script targets for all languages (#5802)
For proper support of Bazel's runfiles tree, a shell script wrapper is
also needed for C++ targets, see
https://github.com/bazelbuild/rules_fuzzing/pull/149.

This commit allows shell script fuzz targets for all languages. This
also helps to consolidate the various fuzz target checks in OSS-Fuzz
by removing a dependence on fuzzing_language.
2021-05-24 09:16:32 -07:00
Catena cyber 7004ced0d3
Right copy for rust std lib for coverage (#5791) 2021-05-17 18:55:53 +00:00
Fabian Meumertzheim f08e98d176
[infra][jvm] Create per-target summary.json (#5778) 2021-05-17 07:25:10 -07:00
Catena cyber beee192ed3
Rust coverage: copy stdlib to the referenced directory (#5776)
using rustc commit-hash version
2021-05-16 14:32:33 -07:00
Fabian Meumertzheim 88f76bc641
[infra] Make `targets_list` detect JVM/Python targets (#5775)
* [infra] Make `targets_list` detect JVM/Python targets

`targets_list` should not detect `jazzer_driver` and `jazzer_driver_asan` as fuzz targets, but should consider shell scripts that contain `LLVMFuzzerTestOneInput`.

@inferno-chromium This should fix https://github.com/google/oss-fuzz/pull/5770#issuecomment-841851786.

* Fix
2021-05-16 18:37:55 +00:00
jonathanmetzman 8221561c34
Fix coverage script issues (#5764)
Make sure to install MarkupSafe==0.23 instead of >=0.23 which breaks.
Probably the solution is to upgrade Jinja upstream.
Fixes #5763
2021-05-13 15:32:42 +00:00
Fabian Meumertzheim 466787d4f5
[infra] Fix base-runner build (#5756)
Builds of base-runner fail as the Chromium coverage helper script has a
transitive dependency on MarkupSafe, which as of version 2.0 requires
additional python packaging tools to be installed.

This commit installs python3-setuptools and wheels, which fixes the
build.
2021-05-12 07:13:22 -07:00
Fabian Meumertzheim 124db941a7
[infra] Fix java coverage (#5747)
* Filter non-fuzz target binaries in coverage script

* Filter non-fuzz target binaries in helper.py

* Fix fuzz target executable bit check in helper.py

Python and JVM fuzz target executables created via the docs template
set the exectuable via `chmod u+x` as the root user, which means that
os.access checks in infra/helper.py don't see the exectuable bit if
not run as root locally.

With this commit, the check now looks for any of the three exectuable
bits.
2021-05-11 10:10:54 -07:00
Fabian Meumertzheim 5cfb074ae5
Add Java coverage support (#5733)
Coverage is collected by running the fuzz targets with the JaCoCo agent
in Jazzer's no instrumentation mode.

Since JaCoCo does not support llvm-cov style coverage reports, a simple
Python helper creates it using the information contained in the JaCoCo
XML report.

As the Java build process does not maintain a mapping between source
files and build artifacts and JaCoCo needs to be passed the root folder
of the package tree, we use the Maven directory layout convention to
heuristically detect these roots.
2021-05-10 20:33:07 -07:00
van Hauser e31055e486
fix afl++ for pie targets (#5691)
* output afl++ setup

* update commit id

* update afl++ commit id

* asan + cmplog fix

* update commit id

* update and enhance afl++

* update afl++ commit id, better run asan options

* fix linter

* add debug_afl script

* Update debug_afl

* Update compile_afl

* fix for karchive

* put debug_afl in the docker container

* asan poison fix

* fix asan settings for zeek

* update afl++ commit id

* fix

* update afl++ commit id

* final touches

* remove map size

* remove old comment

* llvm 13 fix

* enhance documentation

* fix capstone build.sh

* update doc

* add afl++ ctx-2 coverage option

* set to 30% chance for ctx-2

* fix afl++ pie targets

* gracefuly fail for qemu hook

Co-authored-by: jonathanmetzman <31354670+jonathanmetzman@users.noreply.github.com>
2021-04-30 07:51:40 -07:00
Fabian Meumertzheim f393c97b11
Add missing Java AWT dependency (#5644)
The library libXext.so.6 is required by some Java AWT classes even in
headless environments.

This fixes a crash in apache-commons:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=33489
2021-04-20 21:10:13 +01:00
Abhishek Arya 33ae18cc44
Enable generated dict in AFL++ (#5591)
This was accidently disabled.
2021-04-09 08:16:07 +10:00
Caolán McNamara 0f02ca5a56
retry sequentially if multiprocessing do_bad_build_check detects fail… (#5578)
* retry sequentially if multiprocessing do_bad_build_check detects failures

https://github.com/google/oss-fuzz/issues/5441

The error seen in the build log is:

Whoops, the target binary crashed suddenly, before receiving any input
from the fuzzer!

suggesting that the fuzzer crashed before it got to do anything.
Debugging locally what I tend to see is that

a) in src/afl-forkserver.c afl_fsrv_start the read_s32_timed call
returns 0 and that triggers kill(fsrv->fsrv_pid, fsrv->kill_signal);
(SIGKILL)
b) read_s32_timed returns 0 because *stop_soon_p is non-zero at
restart_read:
c) *stop_soon_p becomes non-zero in handle_stop_sig of
src/afl-fuzz-init.c due to receiving SIGINT
d) that SIGINT is sent by the timeout script used in bad_build_check so
it is that "outer" timeout process which is sending SIGINT which then
triggers afl-forkserver's internal SIGKILL to kill the process

I get improved results if I retry the killed off fuzzers sequentially

* Remove unneeded semicolons to fix presubmit

Co-authored-by: Abhishek Arya <inferno@chromium.org>
2021-04-05 12:50:15 -07:00
Stefan Bucur 008c7ec1f5
Switch the cel-cpp project to the new Bazel build script. This reduces the build.sh file to a single line. (#5549) 2021-04-02 20:01:49 -07:00
van Hauser 4afd7f9c55
afl++: add CTX-2 coverage option (#5567) 2021-04-02 07:02:26 -07:00
Stefan Bucur 8c1a588bef
Implement the Bazel building recipe as a stand-alone script that can be invoked from build.sh. (#5548) 2021-03-31 19:45:00 +00:00
jonathanmetzman 8539aadb65
[CIFuzz] Fix repo detection for repos downloaded through "go get". (#5481)
Superseeds: #5463
Fixes: #3670
2021-03-23 11:01:02 -07:00
jonathanmetzman e34a03385f
Delete unneeded files from cargo-fuzz install (100MB) (#5436) 2021-03-22 12:29:23 -07:00
jonathanmetzman 0fba276516
[NFC][base-builder] Fix order so comment is in right place (#5445) 2021-03-21 07:02:30 -07:00
van Hauser 2b4af8f24a
[AFL++] llvm 13 fix (#5454) 2021-03-19 18:45:54 +00:00
jonathanmetzman cb083cb365
[base-builder] Fix temp dir deletion for atheris (#5434)
Add back /tmp dir deletion that was accidentally removed before #5344 was committed.
2021-03-19 08:36:14 -07:00
Catena cyber 58d5848b0f
Fix typo in path equilavence for golang coverage (#5444) 2021-03-19 06:34:21 -07:00
van Hauser df6dc548a9
remove map size for afl++ (#5433)
* output afl++ setup

* update commit id

* update afl++ commit id

* asan + cmplog fix

* update commit id

* update and enhance afl++

* update afl++ commit id, better run asan options

* fix linter

* add debug_afl script

* Update debug_afl

* Update compile_afl

* fix for karchive

* put debug_afl in the docker container

* asan poison fix

* fix asan settings for zeek

* update afl++ commit id

* fix

* update afl++ commit id

* final touches

* remove map size

* remove old comment

Co-authored-by: jonathanmetzman <31354670+jonathanmetzman@users.noreply.github.com>
2021-03-18 14:49:58 +00:00
jonathanmetzman ccea7f4ad9
[base-clang] Reduce base-clang size by deleting unneeded binaries+libraries (#5282)
Delete unneeded LLVM tools, clang libraries and testing tools.

This reduces the image size from 1.71 GB to 901 MB.
It may be possible to improve on this by deleting some LLVM
libraries though I don't know which ones we should delete
because AFL++ might use some).

Related https://github.com/google/oss-fuzz/issues/5170
2021-03-18 06:38:46 -07:00
Catena cyber 8b15e28751
Go coverage : use gofuzz tag by default (#5425)
as is done by gofuzz build
2021-03-17 07:42:12 -07:00
Catena cyber e71e49d721
Golang coverage summary updated to version 2.0.1 (#5346) 2021-03-17 06:53:19 -07:00
van Hauser a1135d001e
update afl++ commit id (#5402)
* output afl++ setup

* update commit id

* update afl++ commit id

* asan + cmplog fix

* update commit id

* update and enhance afl++

* update afl++ commit id, better run asan options

* fix linter

* add debug_afl script

* Update debug_afl

* Update compile_afl

* fix for karchive

* put debug_afl in the docker container

* asan poison fix

* fix asan settings for zeek

* update afl++ commit id

* fix

* update afl++ commit id

* final touches

Co-authored-by: jonathanmetzman <31354670+jonathanmetzman@users.noreply.github.com>
2021-03-16 20:05:21 +00:00
Catena cyber 5c174c7e36
Golang coverage: use absolute paths (#5407) 2021-03-16 12:19:02 -07:00
Catena cyber 92cea13c5d
Rust coverage : do not trigger debug assertions (#5385) 2021-03-14 15:53:16 -07:00
Catena cyber b000f70a7a
Golang coverage: build binary instead of bash script (#5377) 2021-03-14 08:29:13 -07:00
Catena cyber be203e38a5
More generic target directory for rust coverage (#5366)
* More generic target directory for rust coverage

* Rust coverage cargo does not change PATH
2021-03-12 08:52:54 -08:00
Abhishek Arya 53e9531551
Don't rpath patch llvm-symbolizer. (#5357)
Should fix https://github.com/google/oss-fuzz/issues/5349
2021-03-10 12:24:57 -08:00
Abhishek Arya 90b3d55f36
Fix unzip regression on base-runner. (#5356)
* Fix unzip regression on base-runner.

* Dont rpath patch llvm-symbolizer.

Should fix https://github.com/google/oss-fuzz/issues/5349

* Revert "Dont rpath patch llvm-symbolizer."

This reverts commit fdd881dea2.
2021-03-10 10:46:58 -08:00
jonathanmetzman 0475bfa16a
[base-builder] Remove unnecessary python files (58 MB) (#5348)
Related: #5170
2021-03-09 18:30:31 -08:00
Catena cyber 632f5ec0cb
Rust coverage : source remap after changing dir (#5345) 2021-03-09 20:57:46 +00:00
jonathanmetzman 1233505600
[base-builder] Delete unneeded files from atheris install (#5344) 2021-03-09 12:08:09 -08:00
jonathanmetzman 92bb205b50
[infra] Remove minijail. (#5343)
We don't need minijail tooling anymore since we aren't using it
on OSS-Fuzz.
2021-03-09 19:57:33 +00:00
jonathanmetzman c3124a0843
[base-runner] Reduce size by ~200 MB by using apt better (#5339)
Don't install recommended packages if it means installing an
entire gcc toolchain. We don't need it in the runner.
2021-03-09 18:06:44 +00:00
Catena cyber fb8b2e25bf
Golang coverage ok with package in $SRC (#5325) 2021-03-09 06:07:33 -08:00
van Hauser 498b771b72
fix afl++ asan options (#5336) 2021-03-09 06:05:13 -08:00
Catena cyber be915129e1
Golang coverage with go 1.16 and modules (#5321)
* Fixes go coverage with modules

* Golang coverage html report turning off modules

Otherwise, we get the error
working directory is not part of a module
2021-03-08 21:26:19 +00:00
jonathanmetzman 8fe74c1f72
[base-runner] Fix go issue and remove uneeded rust stuff. (#5319)
Go needs the toolchain for now, so add it back to base-runner.
We don't actually need the rust toolchain so get rid of it
(saving about 1GB).
2021-03-08 09:43:44 -08:00
Catena cyber c41e46ffc8
Rust coverage report (for Suricata) (#4697)
* Rust coverage test

* Workaround to get rust coverage for Suricata
2021-03-08 07:05:35 -08:00
van Hauser 6f19531812
add asan poison check to afl++ cmplog (#5311)
* output afl++ setup

* update commit id

* update afl++ commit id

* asan + cmplog fix

* update commit id

* update and enhance afl++

* update afl++ commit id, better run asan options

* fix linter

* add debug_afl script

* Update debug_afl

* Update compile_afl

* fix for karchive

* put debug_afl in the docker container

* asan poison fix

Co-authored-by: jonathanmetzman <31354670+jonathanmetzman@users.noreply.github.com>
2021-03-06 07:02:29 -08:00
van Hauser 7bd9da63c8
fix karchive build for afl++ (#5305)
* output afl++ setup

* update commit id

* update afl++ commit id

* asan + cmplog fix

* update commit id

* update and enhance afl++

* update afl++ commit id, better run asan options

* fix linter

* add debug_afl script

* Update debug_afl

* Update compile_afl

* fix for karchive

* put debug_afl in the docker container

Co-authored-by: jonathanmetzman <31354670+jonathanmetzman@users.noreply.github.com>
2021-03-05 07:10:34 -08:00