Commit Graph

276 Commits

Author SHA1 Message Date
AdamKorcz 63c99caae9
Refactor infra of Go 1.18 fuzzers (#8937)
`go-118-fuzz-build` is undergoing refactoring to fix some runtime issues
affecting Rekor and other projects. Currently none of Rekors fuzzers
run. This PR has been tested on all of Rekors fuzzers that will run with
this PR.

This PR modifies the infra OSS-Fuzz build script to adapt to the
upstream changes.

Cloning the `dev` branch of `go-118-fuzz-build` is a temporary solution
until it gets merged into `main` upstream.
Cloning go-118-fuzz-build in each build script is also a temporary
measure until `dev` gets merged into `main`.

Signed-off-by: AdamKorcz <adam@adalogics.com>

Signed-off-by: AdamKorcz <adam@adalogics.com>
2022-11-21 17:55:11 +00:00
DavidKorczynski 9452275da3
fuzztest integration (#8784)
Signed-off-by: David Korczynski <david@adalogics.com>

Cross referencing https://github.com/google/fuzztest/pull/69

Signed-off-by: David Korczynski <david@adalogics.com>
Co-authored-by: Oliver Chang <oliverchang@users.noreply.github.com>
2022-11-14 13:34:29 +11:00
DavidKorczynski c12585c056
infa: add python fuzz-introspector support (#8865)
Adds necessary logic for running fuzz-introspector's Python frontend.

Signed-off-by: David Korczynski <david@adalogics.com>

Signed-off-by: David Korczynski <david@adalogics.com>
2022-11-01 11:51:50 -07:00
jonathanmetzman 474411cbb0
[base-runner] Fix build so that go layer isn't saved. (#8861) 2022-10-26 15:59:09 -04:00
Dongge Liu 947683a594
More thorough build checks for Centipede (#8697)
Solves the CI failure in #8690, and uses the chance to add more thorough
tests for the sanitized target binary and the unsanitized target binary
for `Centipede`, which is something we thought about but did not have
the chance to implement:
1. When building sanitized binaries with `helper.py` (i.e., local or
GitHub CI): Unsanitized ones will be built automatically into the same
docker container. Now bad_build_check tests both
* a) If main fuzz targets can run with the auxiliary sanitized binaries,
and
    * b) If the auxiliaries are built with the correct sanitizers.
3. When In the Trial build and production build: Two kinds of binaries
will be in separate buckets / docker containers. Now Script
bad_build_check tests either
* a) If the unsanitized binaries can run without the sanitized ones, or
* b) If the sanitized binaries are built with the correct sanitizers.

Co-authored-by: Jonathan Metzman <metzman@chromium.org>
2022-10-17 12:48:04 +11:00
Catena cyber 16cdd32578
Runner without go (#8703)
For #8701 cc @jonathanmetzman
2022-10-12 14:55:49 -04:00
Fabian Meumertzheim 7765e4d548
infra: Update Jazzer to fix coverage build failures (#8495)
Fixes #8241
2022-09-20 13:37:22 -04:00
Dongge Liu 97a68b049b
Update Centipede to fix SegFault (#8507)
Update `Centipede` to fix [the SegFault when using `AddressSanitizer`
with
`address_space_limit_mb`](https://github.com/google/centipede/issues/166).
Also set `address_space_limit_mb` as the issue has been fixed.
2022-09-16 12:33:20 +10:00
Dongge Liu 2fa71e3c7f
Centipede's CI build, trial build, and build tests (#8422)
Adding CI build, trial build, and build tests.

Co-authored-by: Oliver Chang <oliverchang@users.noreply.github.com>
2022-09-16 09:25:49 +10:00
DavidKorczynski dc5adbf754
infra: add support for netdriver fuzzing with honggfuzz (#7351)
Adds an example with the mongoose webserver
2022-09-12 11:58:12 +10:00
Dongge Liu 22488896f6
Centipede integration (#8046)
* Add Centipede as a fuzzer

* Specify dictionary param of Centipede

* Update docs

* Mark Centipede as experimental

* More accurate description

* Remove garbage

* Simplify code

* Move mkdir to dockerfile

* Add the weak.c trick

* Install deps with Centipede's script & uninstall new deps

* Fix doc

* Reuse libweak_sancov_stubs.so

* Reorganise flags

* format

* Consistent file type

* Reuse the weak references defined in Centipede

* Replace the shared library of weak symbols with a static one

* Correct the place to call mkdir

* Allow 2G of SHM for Centipede

* Create dirs in run_fuzzer

* Keep Centipede up-to-date

* Avoid duplicating Centipede's binary

* The params of Centipede and their explanations

* The engine info of centipede

* Save the target binary (with san) in a subdir of the project

* Set the target (with san) dir in check_build

* Create the target (with san) first to avoid side-effects

* Fic clone

* Fix format

* Add periods

* Fix comments

* Fix dirs

* Fix parameters

* Adding Centipede as a fuzzing engine for Scarecrow

* Add CI support

* Represent sanitizer with a variable

* Remove the unnecessary definition of FUZZER_OUT

* Reorganise binary directories

* format

* A minor note

* Present issues with dirs that alread exist

* Use os.path.join to join path

* Make a function to get the out/ in check build

* Reusing existing flags in .bazel

* Avoid hardcoding sanitizer, set rss_limit_mb=4096, leave address_space_limit_mb disabled

* Better ways to add bazel build options

* A better way to add bazel flags

* Remove redundant --bazelrc

* Better Cohesion

* Avoid code duplication

* Simplify code

* Exit on crash
2022-09-06 02:34:58 +00:00
jonathanmetzman c113501247
Upgrade to codeqlv2 to avoid warning (#8272)
* Upgrade to codeqlv2 to avoid warning

* debug
2022-08-16 17:08:56 -07:00
jonathanmetzman 29848637e2
Fix bad build check breakage (#8198)
fix
2022-08-09 18:52:46 -04:00
jonathanmetzman a4c1193050
Support building base-runner on aarch64. (#8186)
Related: #8164
2022-08-09 04:10:55 +00:00
jonathanmetzman ac9a50c7a3
Support AArch64 in bad_build_check (#8188)
* Support AArch64 in bad_build_check

Related: #8164

* UNdo uneeded
2022-08-08 19:40:11 -04:00
Jonathan Metzman 8d5c72d77a [wycheproof] Support wycheproof in bad_build_check.
Related #8040
2022-07-20 14:45:50 -04:00
jonathanmetzman 0975cbfc0a
Remove build support for dataflow sanitizer. (#7972)
Related: #7964
2022-07-12 15:51:03 +02:00
Catena cyber 74762513ad
infra: have timeout per fuzz target for coverage (#7831)
* infra: have timeout per fuzz target for coverage

As is done for other languages

* ngolo-fuzzing: remove temporary workaround

now that https://github.com/golang/go/issues/53190 is closed

* ngolo-fuzzing: use built go toolchain in its directory

without copying it to /root/.go/

in order to get coverage for std lib in the end

* infra: ability to get coverage for additional golang package

And uses it with ngolo-fuzzing :
ngolo-fuzzing fuzz targets live in a different repository than
the code being fuzzed, and we we want to get the coverage, for
both the fuzz target and the package being fuzzed

* fixup bash unbound

* fixup ngolo-fuzzing only match at beginning for std package

* stricter check for every additional go package
2022-07-07 17:00:39 +02:00
DavidKorczynski cf816c3244
infra: fix per-target coverage html generation (#7927)
* infra: fix per-target coverage html generation

When generating coverage reports for single targets we should not
include all fuzz targets (in the $objects var), but only the object
(binary file) for the given target.

Ref: https://github.com/ossf/fuzz-introspector/issues/340

* coverage: remove potential race condition
2022-06-30 18:06:42 +10:00
jonathanmetzman 1189d2c7f1
Reland #7850 (#7868) 2022-06-15 10:40:10 -05:00
jonathanmetzman 747d86a02d
Revert "infra: let honggfuzz verify crashes" (#7867)
Revert "infra: let honggfuzz verify crashes (#7850)"

This reverts commit d0d88aad6d.
2022-06-15 09:08:03 -04:00
Evgeny Vereshchagin d0d88aad6d
infra: let honggfuzz verify crashes (#7850)
to make it easier to catch issues like
https://github.com/google/honggfuzz/issues/465.

With -V when unreproducible crashes are triggered honggfuzz shows something like
```
[2022-06-10T15:21:12+0000][W][2373157] subproc_checkTimeLimit():532 pid=2374490 took too much time (limit 30 s). Killing it with SIGKILL
Sz:280 Tm:30,021,052us (i/b/h/e/p/c) New:0/0/0/0/0/3, Cur:0/0/0/0/0/591
Launching verifier for HASH: 1b859677dd (iteration: 1 out of 5)
[2022-06-10T15:21:13+0000][E][2373157] fuzz_runVerifier():280 Verifier stack mismatch: (original) 1b859677dd != (new) 0
```
2022-06-15 09:07:27 -04:00
Evgeny Vereshchagin a4befa22a0
[base-runner] no longer fail silently in test_one.py (#7776)
It should make it easier to figure out why exactly
`./infra/helper.py check_build project fuzz-target` fails
by turning
```
INFO: performing bad build checks for /tmp/not-out/tmpa4lph9dr/fuzz-bus-message
ERROR:root:Check build failed.
```
into something like
```
INFO: performing bad build checks for /tmp/not-out/tmpa4lph9dr/fuzz-bus-message
BAD BUILD: /tmp/not-out/tmpa4lph9dr/fuzz-bus-message seems to have either startup crash or exit:
/tmp/not-out/tmpa4lph9dr/fuzz-bus-message -rss_limit_mb=2560 -timeout=25 -seed=1337 -runs=4 < /dev/null
/tmp/not-out/tmpa4lph9dr/fuzz-bus-message: error while loading shared libraries: libcap.so.2: cannot open shared object file: No such file or directory

ERROR:root:Check build failed.
```
2022-05-31 17:07:52 -04:00
DavidKorczynski a615678670
infra: use only valid targets for python coverage (#7746)
* infra: use only valid targets for python coverage

Some python coverage reports gets clobbered because non-fuzz targets are
included in FUZZ_TARGETS. The consequence of this is that some reports
will have erroneous data. This commit ensures only valid targets are
used when running coverage, which consequently fixes the reports.

* Move executable logic into python fuzzer builder instead
2022-05-26 14:52:30 +10:00
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