Commit Graph

140 Commits

Author SHA1 Message Date
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
Fabian Meumertzheim cbc4293c37
[infra] Make mount location configurable in build_fuzzers (#5744)
Exposing the mount location for local sources to a command-line
argument makes it possible to reproduce findings with local source
even for umbrella projects with WORKDIR $SRC/.
2021-05-18 09:15:14 -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
jonathanmetzman 033a858be0
[infra] Set OSS_FUZZ_CI=1 in CI so build scripts can know (#5731)
This will help bitcoin use CI to verify the build works, because
the last step is trivial (so testing not really needed) but will
fill up the disk.
2021-05-07 07:46:11 -07:00
jonathanmetzman ffe4f892b1
[helper] Fix build_image --pull and refactor (#5642)
Fix behavior of build_image --pull (Fixes #5640)

Also refactor helper.py:

1. Change behavior of functions so that most return True on success and False on failure.
2. Only main will return 1 on failure and 0 on success now. Previous behavior was very error prone.
3. Rename _get_output_dir to _get_out_dir.
4. Make function docstrings use descriptive tense.
5. Make helper.py print help when no argument is specified.
2021-04-21 14:28:26 +00:00
Abhishek Arya 53a97ef111
build_image with pull should pull all images. (#5620)
* build_image with pull should pull all images.

right now, build_image with pull only pulled the build image,
and not the runner image. this led to
https://github.com/google/oss-fuzz/issues/5480
so, pull all images to match pull_images functionality.

* address review comment.
2021-04-15 03:27:56 +00:00
jonathanmetzman 6de9a3b187
[helper] Fix handling of gsutil's 2FA (#5482)
gsutil recently started asking daily for a security key jiggle for accounts
using it. This means if we don't print stderr in real time, users won't see
why a corpus isn't downloading and helper will hang until 2FA request times out.
2021-03-23 09:14:48 -07:00
jonathanmetzman 8a67befa1c
[infra/helper.py] Unittest shell base-runner-debug (#5470)
Make sure shell-base-runner-debug works.
2021-03-22 10:39:27 -07: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
Sebastian Rasmussen 16d66c9da4
[infra] Avoid adding fuzzing language for shell subcommand. (#5300) (#5301) 2021-03-05 07:31:58 -08:00
jonathanmetzman f5901265d1
[TSAN] Support TSAN (#5266)
We aren't planning on suppoting TSAN on ClusterFuzz.
But we can support in CIFuzz since Skia wants it.
2021-03-02 09:20:40 -08:00
jonathanmetzman a98d7f1ca4
[base-runner][NFC] Replace test_one with test_one.py (#5179) 2021-02-16 06:14:53 -08:00
Catena cyber 433ddc2337
Sets language env variable when running shell (#5007)
* Sets language env variable when running shell

* Always sets FUZZING_LANGUAGE
2021-01-19 14:20:39 -08:00
Abhishek Arya f359fd010f Allow none in engine for infra/helper.py 2020-12-17 19:47:03 -08:00
Abhishek Arya e06d7f0412
Fix incorrect calculation with gcs path for backup corpus. (#4863)
Fixes https://github.com/google/oss-fuzz/issues/4857
2020-12-17 10:57:32 -08:00
jonathanmetzman aecdd9c4e0
Fix helper.py (#4793)
Recently some python3-only code was added. Make code compatible with
Python2. Fixes https://github.com/google/oss-fuzz/issues/4792
2020-12-07 08:05:03 -08:00
jonathanmetzman c8d2319aa8
[test_all] Rewrite in Python (#4769)
Rewrite test_all in python.
Bash is quite annoying to write and test.
One issue with bash is it is even worse than Python for parallelism (which may be causing #4707).
Rewrite test_all in python and optimize base-runner/Dockerfile for fast development.
Also, combine some docker layers.
2020-12-03 12:52:34 -08:00
Jakub Jelen f533434871
[helper] Make sure directories are created before they are passed to container engine (podman) (#4763) 2020-12-01 09:12:30 -08:00
jonathanmetzman 640a9c2bcf
Fix test_all breakage (#4673)
Specify fuzzing language.
Intended to fix https://github.com/google/oss-fuzz/issues/4672
2020-11-20 07:24:06 -08:00
Catena cyber 07ea81ba3e
[infra] Add code coverage report generation for Go projects (#3142)
* Golang coverage report

* Enables golang coverage report for gonids and go-dns

* Generates summary for golang coverage reports

* Performance profile for golang projects
2020-11-19 00:14:30 -08:00
Max Moroz e4d3fb0f8c
[infra][docs] Be more explicit about code coverage being supported for C/C++ only (#4284). (#4303)
* [infra][docs] Be more explicit about code coverage being supported for C/C++ only (#4284).

* fix typos and pass env variable
2020-08-12 09:32:05 -07:00
Abhishek Arya dbeab81f5d
Add corpus-dir to run_fuzzer, for later use in coverage cmd. (#4191)
* Add corpus-dir to run_fuzzer, for later use in coverage cmd.

* Update as per comment.
2020-07-24 16:41:45 -07:00
Max Moroz 70d278bb53
[infra] Rename msan-builder to msan-libs-builder (#3388). (#4190)
* [infra] Rename msan-builder to msan-libs-builder and add (broken) dfsan-libs-builder (#3388).

* remove dfsan-libs-builder for now

* presubmit format
2020-07-24 12:38:00 -07:00
Max Moroz a9d0062a55
[infra] Rename base-msan-builder image to base-sanitizer-libs-builder (#3388). (#4187)
* [infra] Rename base-msan-builder image to base-sanitizer-builder (#3388).

* rename to base-sanitizer-libs-builder
2020-07-23 16:36:58 -07:00
Max Moroz 33295d69f7
[infra] Do not pass empty port value to docker. (#4110) 2020-07-10 15:49:46 -07:00
Oliver Chang 4a51ecb61f
build_specified_commit: Handle build.sh which are part of upstream repo. (#3932)
This is a best effort attempt to parse the relevant copy command from
the Dockerfile.

Also add a main function to build_specified_commit to make it easier to
test.
2020-06-10 17:12:28 +10:00
Oliver Chang e8ef609568
Relax project language requirement. (#3846)
This is necessary for the bisector to be able to build older revisions.

Print a warning instead.
2020-05-20 08:17:24 +10:00
Abhishek Arya 22443e5230
Parse project language and use in infra/helper.py (#3834)
* Parse project language and use in infra/helper.py

* Fix exception message.
2020-05-17 19:22:36 -07:00
Oliver Chang 1e83b88e95
Quick fix for helper.py build_fuzzers. (#3832) 2020-05-18 11:02:26 +10:00
Oliver Chang 2d972c9162
Add a better check for crash during bisection. (#3758) 2020-05-04 16:50:25 +10:00
Oliver Chang 6b79797ed3
helper: Clean /work as well if --clean is specified. (#3738) 2020-04-30 15:32:17 +10:00
Oliver Chang aa045b9b37
Bisector fixes. (#3601)
- Copy /src from host instead of checking out repo on host. This fixes
  issues with dependencies in the main repo.
- Add some more logging.
2020-04-14 11:38:23 +10:00
Abhishek Arya f4878b30fc
Add check_build for Honggfuzz targets, enable in travis. (#3596) 2020-04-08 14:24:34 -07:00
Leo Neat 4c01a56101
OSSFUZZ to OSS_FUZZ (#3535)
Changing the helper variable OSSFUZZ_DIR name to OSS_FUZZ_DIR as per request in #3516.
2020-03-24 10:04:27 -07:00
Jakub Jelen 3c248cdc57
[infra] helper: Add possibility to pass source directory to gdb/shell commands to ease local debugging (#3465)
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
2020-03-10 16:49:10 -07:00
jonathanmetzman db6b6e7fd2 [infra] helper: fix regression introducing attribute error when reproducing crashes (#3246) 2020-01-16 13:54:23 -08:00
jonathanmetzman bf3592de30
[infra] Make helper.py presubmit-clean (#3237) 2020-01-15 13:37:07 -08:00
Leo Neat 14582175d0 [infra] Scripts for building fuzzers with CIFuzz (#3207) 2020-01-15 13:30:57 -08:00
Leo Neat cca04a14f4 [infra] Fix env variable in the helper.py repoduce command (#3230) 2020-01-14 10:50:35 -08:00
jonathanmetzman 345d49adba
Reland Make bad_build_check more likely to catch hardcoding /out (#3180) (#3205)
This reverts commit 689c3f4b65.
2020-01-08 08:02:45 -08:00
jonathanmetzman 689c3f4b65
Revert "Make bad_build_check more likely to catch hardcoding /out (#3180)" (#3197)
Revert so that we don't get two errors in a row.

This reverts commit 14bdd9332c.
2020-01-07 08:23:13 -08:00
Leo Neat 9532d4781a [infra] Fixing bisection to work with more OSS-Fuzz projects (#3152)
* Max comments

* Added bisection tests

* Added test cases

* Docker run command added to build_specific commit

* Infer main repo uses docker image rather than docker file

* Added mores tests for repo infer

* With verbosity

* Formatting

* Bisection fixed

* Formatting updates

* Oliver small comments.

* Script infer main repo

* Detect repo and test module finished

* Detect main repo from script

* Regex searching

* Regex searching

* Max comments + bisector test script

* Oliver comments

* Max's comments

* String concat update

* Jonathan comments
2020-01-06 12:17:26 -08:00
jonathanmetzman 14bdd9332c
Make bad_build_check more likely to catch hardcoding /out (#3180) 2020-01-06 10:48:35 -08:00
Leo Neat 2c05fb229f [infra] Add support for Bisecting Git Commits Introducing Crashes(#3119) 2019-12-16 16:48:49 -08:00
jonathanmetzman a0b29b879f
Remove trailing whitespace (#3135) 2019-12-16 15:30:12 -08:00
Leo Neat 2dd2a0fdcc [infra] Add functionality to check out a specific commit for a project (#3092)
* Starting the git python API

* repo manager working with tests

* Docker repo manager working, can update image with specific commit

* Working bisection

* Formatting and linting

* Working bisection

* Specific commit checkout

* Specific commit checkout

* Removed bisector and updated helper

* remove branch bug

* Max comments

* Added tests for infer main repo

* Oliver comments

* helper.py function names change

* Oliver comments pt. 2

* Olivers comments

* Formatting updates

* Removing DockerRepoManager class

* Removing DockerRepoManager class

* Changing from copying repo to docker image to mounting repo on docker image

* Jonathan comments

* Build image from commit tests

* Oliver comments pt.3

* Oliver comments pt.4

* Linting

* Max comments pt. 2

* change check commit exists

* Max comments pt. 3

* Regex updated

* Formatting updates
2019-12-12 09:26:37 -08:00
jonathanmetzman c4202c2f48
Revert "Use "x86" instead of "i386" for better name recognition. (#2685)" (#2687)
This reverts commit 0c6cc5cae8.
2019-08-12 10:54:18 -07:00
jonathanmetzman 0c6cc5cae8
Use "x86" instead of "i386" for better name recognition. (#2685)
It seems more people understand x86 than i386, use this term instead.
2019-08-12 10:35:16 -07:00
Max Moroz 5dece89e3c
[infra] Add support for dataflow builds to the helper script and build check (#1632). (#2501)
* [infra] Add support for dataflow builds to the helper script and build check (#1632).

* Update travis config file.

* Address self-review comments and specify dataflow sanitizer for zstd as well.

* Fix fuzzing_engines in project.yaml

* Fix bad build check for DFSan.

* Use "hasattr" in helper.py to check the sanitizer argument.

* Address more review comments.

* Remove DataFlow config from zstd.

* fix a typo
2019-06-12 11:08:15 -07:00