oss-fuzz/infra/base-images/base-builder
DavidKorczynski 95a8398fb8
infra: fuzz-introspector; install matplotlib from binary (#8912)
This avoids compiling certain parts of matplotlib, which speeds up
runtime of fuzz-introspector runs locally by a significant (~5-10min)
time.

Ref:
https://github.com/ossf/fuzz-introspector/pull/579#issuecomment-1300339783
Ref: https://github.com/ossf/fuzz-introspector/issues/465

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

Signed-off-by: David Korczynski <david@adalogics.com>
2022-11-02 12:54:18 -07:00
..
test_data
Dockerfile Get rid of :introspector images. Build introspector in main images (#8868) 2022-10-27 08:27:12 -04:00
README.md
bazel.bazelrc Get rid of :introspector images. Build introspector in main images (#8868) 2022-10-27 08:27:12 -04:00
bazel_build_fuzz_tests Pass FuzzIntrospector environment variables to bazel builds (#7367) 2022-03-08 02:15:47 +00:00
bisect_clang.py
bisect_clang_test.py [infra][tests][NFC] Change mocked function prefix from "mocked_" to "mock_" (#6198) 2021-08-12 11:25:57 -07:00
cargo rust coverage: broader definition for remaps (#6595) 2021-10-19 15:50:08 -05:00
compile infra: fuzz-introspector; install matplotlib from binary (#8912) 2022-11-02 12:54:18 -07:00
compile_afl small afl++ bugfix (#7159) 2022-01-20 12:17:07 -05:00
compile_centipede Do not remove the symlink as they are used by `Centipede`'s `Bazel` build (#8486) 2022-09-14 02:54:49 +00:00
compile_go_fuzzer infra: have timeout per fuzz target for coverage (#7831) 2022-07-07 17:00:39 +02:00
compile_honggfuzz infra: add support for netdriver fuzzing with honggfuzz (#7351) 2022-09-12 11:58:12 +10:00
compile_libfuzzer
compile_native_go_fuzzer Always add `testing` package usage in native_go_fuzzer (#8546) 2022-09-21 10:49:21 -07:00
compile_python_fuzzer infa: add python fuzz-introspector support (#8865) 2022-11-01 11:51:50 -07:00
debug_afl
detect_repo.py
detect_repo_test.py
install_deps.sh Don't install git via ppa (#8470) 2022-09-13 08:37:38 +01:00
install_go.sh infra: bump Go to 1.19 (#8568) 2022-09-22 11:59:15 -07:00
install_go_CodeIntelligenceTesting.sh Add Code Intelligence go114-fuzz-build fork (#7221) 2022-02-07 22:51:36 +11:00
install_java.sh infra: Update Jazzer to fix coverage build failures (#8495) 2022-09-20 13:37:22 -04:00
install_javascript.sh Prepare for JavaScript fuzzing (#8325) 2022-08-23 17:41:42 -04:00
install_python.sh Upgrade Atheris (#8886) 2022-10-31 10:27:27 -07:00
install_rust.sh [language builders] Get rid of base-builder-new (#6361) 2021-09-01 13:36:17 -07:00
install_swift.sh Use Swift 5.7.0. (#8501) 2022-09-19 18:40:00 -04:00
llvmsymbol.diff Swift ideal integration (#6312) 2021-09-02 14:56:01 -07:00
ossfuzz_coverage_runner.go
precompile_afl
precompile_centipede Don't use centipede's install script (#8870) 2022-10-26 18:52:22 -04:00
precompile_honggfuzz
python_coverage_helper.py infra: enable argument passing to compile_python_fuzzer (#7628) 2022-04-28 09:38:43 +01:00
srcmap
write_labels.py handle wildcard label applying to all fuzz targets in a project (#7359) 2022-03-04 14:59:08 +11:00

README.md

base-builder

Abstract base image for project builders.

Every project image supports multiple commands that can be invoked through docker after the image is built:

docker run --rm -ti gcr.io/oss-fuzz/$project <command> <arguments...>

Supported Commands

Command Description
compile (default) build all fuzz targets
/bin/bash drop into shell, execute compile script to start build.

Build Configuration

A single build image can build same set of fuzzers in many configurations. The configuration is picked through one or more environment variables.

Env Variable Description
$SANITIZER ("address") Specifies predefined sanitizer configuration to use. address or memory or undefined.
$SANITIZER_FLAGS Specify compiler sanitizer flags directly. Overrides $SANITIZER.
$COVERAGE_FLAGS Specify compiler flags to use for fuzzer feedback coverage.
$BUILD_UID User id to use while building fuzzers.

Examples

  • building sqlite3 fuzzer with UBSan (SANITIZER=undefined):
docker run --rm -ti -e SANITIZER=undefined gcr.io/oss-fuzz/sqlite3

Image Files Layout

Location Env Description
/out/ $OUT Directory to store build artifacts (fuzz targets, dictionaries, options files, seed corpus archives).
/src/ $SRC Directory to checkout source files
/work/ $WORK Directory for storing intermediate files
/usr/lib/libFuzzingEngine.a $LIB_FUZZING_ENGINE Location of prebuilt fuzzing engine library (e.g. libFuzzer) that needs to be linked with all fuzz targets.

While files layout is fixed within a container, the environment variables are provided to be able to write retargetable scripts.

Compiler Flags

You must use special compiler flags to build your project and fuzz targets. These flags are provided in following environment variables:

Env Variable Description
$CC The C compiler binary.
$CXX, $CCC The C++ compiler binary.
$CFLAGS C compiler flags.
$CXXFLAGS C++ compiler flags.

Most well-crafted build scripts will automatically use these variables. If not, pass them manually to the build tool.

Child Image Interface

Sources

Child image has to checkout all sources that it needs to compile fuzz targets into $SRC directory. When the image is executed, a directory could be mounted on top of these with local checkouts using docker run -v $HOME/my_project:/src/my_project ....

Other Required Files

Following files have to be added by child images:

File Location Description
$SRC/build.sh build script to build the project and its fuzz targets