Commit Graph

252 Commits

Author SHA1 Message Date
Navidem c5be869e4e
Add commands to collect branch coverage (#7709)
* Add commands to collect branch coverage

* Add -g flag

* Switch branch coverage option placement

* Set guarding env variable

Co-authored-by: Oliver Chang <oliverchang@users.noreply.github.com>
2022-05-24 16:10:38 +10:00
DavidKorczynski a2e63fdf7d
infra: enable run_fuzzer to accept multiple options (#7697)
The current run_fuzzer will fail when multiple libfuzzer options are
specificed in a .options file. Currently, if there are multiple options
then none of the options will be used, but rather an issue about a
"binary operator expected" will occur. One implication of this is that
check_build fails to use it and may, therefore, report erroneously. This
fixes it by enabling the use of zero, one and many libfuzzer options.
2022-05-11 16:32:00 +10:00
DavidKorczynski 74438324f8
infra: fix python coverage (#7641)
* infra: fix python coverage

The python coverage has not started working on oss-fuzz.com yet. This is
an effort to fix this.

* add logs and stats files

* log stderr too
2022-05-03 20:41:29 +10:00
DavidKorczynski d70fcb5e1b
infra: fix python coverage logic (#7616)
* infra: write python coverage to correct folder

Ref: https://github.com/google/oss-fuzz/issues/7615

* fix issues when atheris does not exit gracefully
2022-04-25 23:27:10 +01:00
DavidKorczynski 0cb820e5af
infra: add Python coverage support (#7298)
* infra: add Python coverage support

* update python coverage helper script

* nits

* switch from commands to python

* pin coverage package

* switch to single quote strings throughout

* nit

* fix style

* fix style

* fix ci

* fix ci
2022-04-06 10:31:34 -04:00
DavidKorczynski 8bad6b2c75
infra: make per-target coverage reports readable (#7505)
Similar to the main report make all target reports readable. This is
currently a blocker on fuzz-introspector for running locally.
2022-04-04 23:39:16 +01:00
Oliver Chang 6601b45b1f
Generate per-target coverage reports. (#7369)
* Generate per-target coverage reports.

First part of #7015.

The Cloud Build changes to upload these will come in another PR.

* comment
2022-03-14 10:13:15 +11:00
Fabian Meumertzheim 4261d526ad
[infra] Serve raw JaCoCo coverage reports (#7270)
Both the JaCoCo .exec file and the XML report are very useful for
automated analysis of coverage data and IDE integration, so serve them
just like the HTML report.
2022-03-10 13:16:55 -05:00
Oliver Chang 598198bdde
Use Go 1.18 beta 2 for base-runner to fix coverage reports. (#7282)
Fixes #7281.
2022-02-15 14:26:18 +11:00
AdamKorcz 4fdde05cff
[draft] Integrate native go fuzzing (#7055) 2022-02-09 06:57:00 +11:00
Navidem ad1ecf0c59
Make a separate dir to store covreport files (#7189)
* Make a separate dir to store covreport files used later by fuzz introspector

* Renaming dirs
2022-01-27 13:44:58 +11:00
Navidem 9e39d350e8
apply patches needed for fuzz introspector integration (#7122) 2022-01-20 12:22:27 +11:00
van Hauser 7921270476
Ignore fuzz setup problem detection during building with afl++ (#7127)
* update afl++ commit id

* update afl++ commit id

* fix for afl++

* attempt fix for curl

* allow easy reproducable afl++ builds

* new commit id

* fixes

* another afl++ commit increase

* not a relevant update, but why not

* two afl++ fixes

* add debug script

* update commit id (not relevant though)

* add wget

* update afl++ commit id

* just afl++ doc updates, but maybe this results in some attention

* ignore afl++ fuzz setup problems during building

* update afl++ commit id

* fix laf-intel implementation

* ensure fuzz tests are running without issues for afl++

* update afl++ commit id
2022-01-18 14:54:28 -05:00
jonathanmetzman 18a5b07b6b
[java][coverage] Make sure filenames is a string and not a list. (#6928)
* single quotes

* [java][coverage] Make sure filenames is a string and not a list.

Fixes: https://github.com/google/oss-fuzz/issues/6913

* fmt
2021-11-30 08:10:08 -05:00
Fabian Meumertzheim 6562f44c8a
Fix builds after Jazzer breaking change (#6622)
Follow-up to f043a72a0e, which became necessary due to
24069c3885
2021-10-20 17:24:25 +00:00
Catena cyber 10f34dd5e3
profraw: fix python uint64 for difference (#6603)
And use right column for section address
2021-10-14 12:03:16 -07:00
Catena cyber 077015dcde
profraw: bump up version to 8 (#6594)
* profraw: bump up version to 8

following https://reviews.llvm.org/D111123

* fixup format
2021-10-13 09:46:50 -07:00
Evgeny Vereshchagin 7ea0f5f91d
[selinux] also pass --no-install-recommends to apt-get (#6586)
* [selinux] also pass --no-install-recommends to apt-get

This should help to speed up that step a little.

Suggested by Christian Göttsche in https://github.com/SELinuxProject/selinux/pull/316#issuecomment-941011066

* [selinux] no longer install xmlto

xmlto is used to build the secilc manpages so it isn't
necessary to install it here.

Suggested by @doverride in https://github.com/SELinuxProject/selinux/pulls#issuecomment-941047449

* This partly reverts 0c5679cd24

The part where the fuzz targets were added is intact.

It should address https://github.com/google/oss-fuzz/issues/6585
2021-10-12 15:35:32 -04:00
Catena cyber 89d2bd5677
profraw_update: chmod +x (#6587) 2021-10-12 11:31:26 -07:00
Federico Maggi 0c5679cd24
Run multiple jobs/workers by setting env vars (#5924)
* Run multiple jobs/workers by setting env vars

```bash
$ infra/base-images/all.sh
$ python3 infra/helper.py run_fuzzer -e N_JOBS=4 -e N_WORKERS=4 --engine $ENGINE $PROJECT_NAME $FUZZ_TARGET
```

* Switched from N_JOBS/WORKERS to FUZZER_EXTRA_ARGS

* Added hashicorp/hcl/hclsyntax fuzzers

* Getting rid of FUZZER_EXTRA_ARGS
2021-10-11 13:20:15 -04:00
Catena cyber 7bda69cbeb
profraw: move from golang to python (#6565) 2021-10-11 12:52:33 -04:00
jonathanmetzman 1d588e62cd
clusterfuzzlite: Upload builds after bad build check. (#6531)
Fixes: #6525
Depends on: #6530
2021-10-04 15:21:28 +00:00
Catena cyber 657d3ddf64
rust coverage: fix binary ids padding (#6551) 2021-10-04 09:42:21 -04:00
Catena cyber 5c386a4858
Fix for rust and swift coverages (#6517)
* coverage: introduces llvm-cov-rel

Cf https://github.com/google/oss-fuzz/issues/6268

Latest clang-14 and clang-13 used by rust or swift have a slightly
different profraw file format

llvm-cov-rel is tool that will update the profraw file produced
by clang-13 to one readable by clang-14 llvm-cov tools

* Suricata as a rust project

* rust coverage: remaps every rust subdirectory in fuzz

So that projects not using default fuzz_targets subdir
get the good remap, and hence the good coverage report
2021-09-27 11:11:36 -04:00
jonathanmetzman dfbb678c93
[Ubuntu Upgrade] Raise threshold MSAN calls in for bad build check. (#6272)
Raise the threshold as honggfuzz builds in focal seem to have more
calls.
Related: #6180.
2021-08-23 16:48:38 +00:00
jonathanmetzman 01247be731
[infra][tests][NFC] Change mocked function prefix from "mocked_" to "mock_" (#6198)
Also rename mock_ functions to have impl suffix so we can use mock_ in place of mocked_
2021-08-12 11:25:57 -07:00
jonathanmetzman 866f387c7a
[cifuzz] Speculative fix for issue with seed corpus/backup corpus (#6175)
This should fix #6173
2021-08-05 22:22:59 +00:00
jonathanmetzman d01808333d
[cifuzz] Fuzz in cifuzz-base (#6142)
Fixes: #5926
2021-08-05 13:27:24 -07:00
Fabian Meumertzheim 84578fe2a3
Remove JDK dependency not available on ClusterFuzz (#6105)
While installing `libxext-dev` in `base-runner` makes it available for local fuzzing via `infra/helper.py run_fuzzer`, it is not installed in the image used by ClusterFuzz to run fuzz targets. ​Fuzz targets that rely on any JDK system dependency rather have to install it manually using the method described in https://google.github.io/oss-fuzz/further-reading/fuzzer-environment/#runtime-dependencies. 

By removing this package from `base-runner`, a failure to do so will already be detected via a local `check_build` rather than only during fuzzer execution on ClusterFuzz.
2021-07-27 11:57:33 -07:00
jonathanmetzman cdd78c464b
[cifuzz] Fix corpus usage in coverage reports (#6093)
Fixes #6089
2021-07-22 08:09:49 -07:00
jonathanmetzman 857e9c27d0
[CIFuzz][Coverage] Make coverage reports world readable (#6077)
This is needed to upload coverage reports.
Related: #6054
2021-07-20 11:50:27 -07:00
jonathanmetzman 86392ca2f4
[CIFuzz][ClusterFuzzLite] Prepare to support coverage reports for external users (#6074)
1. Make coverage script accept an env var that controls where the generated report is written to. Use this in generate_coverage_report.
2. Rename CoverageGetter to OSSFuzzCoverage
3. Make affected_fuzz_targets get coverage object from clusterfuzz_deployment.
4. Add stubbed FilesystemCoverage class that will be used by non-OSS-Fuzz users.
5. Make ClusterFuzzLite able to return coverage object by downloading old coverage report and returning a FilesystemCoverage object.
6. Add stub to ClusterFuzzLite for uploading coverage.

Related: #6054
2021-07-20 10:04:57 -07:00
Fabian Meumertzheim 360227e3b3
[infra] Do not close file descriptors also for JVM (#6002)
Keeps the JVM coverage libFuzzer args in sync with the change in https://github.com/google/oss-fuzz/pull/5999.
2021-07-06 10:16:48 +01:00
DavidKorczynski 581aa96454
do not close file descriptors in coverage runs. (#5999) 2021-07-05 19:31:56 -07:00
jonathanmetzman ae5e4228e8
[CIFuzz][ClusterFuzzLite] Implement batch fuzzing (#5963)
[ClusterFuzzLite] Support use of github actions as a filestore
2021-06-25 08:42:10 -07:00
Abhishek Arya 1bf9031854
Fix code coverage regression. (#5949)
Hardcode commit hash for chromium code coverage script, till
revert happens.
Fixes #5934
2021-06-19 16:48:24 -07:00
jonathanmetzman 624a294bff
[CIFuzz] Allow run_fuzzers to use a preexisting corpus. (#5928)
* [CIFuzz] Allow run_fuzzers to use a preexisting corpus.

Also improve comment in cifuzz-base/Dockerfile.

* improve comment

* Fix run_fuzzers
Add --cache option to helper.py's build_image command which
uses the docker image cache when building and use this in
ci/build.py.
Change build_image_impl's argument no_cache to cache for clarity.
Eliminate default argument cache in build_fuzzers_impl since no users
use it.
2021-06-17 08:32:20 -07:00
van Hauser 6ca95a1817
enhance afl++ performance (#5916) 2021-06-14 07:37:20 -07:00
Fabian Meumertzheim 73d78b8879
[infra][jvm] Add Jazzer UBSan support (#5898)
* [infra][jvm] Add Jazzer UBSan support

* [java-example] Reenable and plant UB

* [docs] Mention support for Java UBSan in docs

Also adds a link to the java-example build.sh to the docs.
2021-06-10 07:57:42 -07:00
Fabian Meumertzheim 770d590e13
[infra][jvm] Don't override jvm_args in coverage builds (#5862)
Specify --additional_jvm_args instead of --jvm_args so that custom
target JVM args (e.g. --enable-preview) are preserved in coverage runs.
2021-06-01 08:03:10 -07:00
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
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
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
Fabian Meumertzheim f08e98d176
[infra][jvm] Create per-target summary.json (#5778) 2021-05-17 07:25:10 -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