oss-fuzz/infra/experimental/chronos
DavidKorczynski 51e01dcebc
infra: add script to capture replayable commands (#12608)
Giving
https://github.com/google/oss-fuzz/pull/12592#issuecomment-2415803665 a
go using `bashlex`

Will place a script in `/out/replay-build-script.sh` with the script
that can be used for replaying.

This is still poc and will need some adjustments, e.g. we need some more
handling on the bash script's ast to reason about loops.

---------

Signed-off-by: David Korczynski <david@adalogics.com>
Co-authored-by: Oliver Chang <ochang@google.com>
2024-11-06 13:00:19 +11:00
..
Dockerfile Add cloudbuild for building chronos images for all C++. (#12549) 2024-10-02 11:07:39 +10:00
README.md Fix entrypoint for chronos images. (#12677) 2024-11-01 14:42:45 +11:00
build_all.sh infra: add script to capture replayable commands (#12608) 2024-11-06 13:00:19 +11:00
build_on_cloudbuild.sh infra: add script to capture replayable commands (#12608) 2024-11-06 13:00:19 +11:00
chronos.sh Let recompile become compile if Chronos did not intercept any command (#12458) 2024-09-06 16:44:58 +10:00
cloudbuild.yaml infra: add script to capture replayable commands (#12608) 2024-11-06 13:00:19 +11:00
cloudbuild_all.yaml Add cloudbuild for building chronos images for all C++. (#12549) 2024-10-02 11:07:39 +10:00
e2e-replay-build.sh infra: add script to capture replayable commands (#12608) 2024-11-06 13:00:19 +11:00
match_artifacts.sh infra: add script to capture replayable commands (#12608) 2024-11-06 13:00:19 +11:00
prepare-ccache infra: add script to capture replayable commands (#12608) 2024-11-06 13:00:19 +11:00
prepare-replay-rebuild infra: add script to capture replayable commands (#12608) 2024-11-06 13:00:19 +11:00

README.md

Usage

Under OSS-Fuzz root directory:

export PROJECT=libiec61850
export FUZZ_TARGET=fuzz_mms_decode.c
export FUZZING_LANGUAGE=c

infra/experimental/chronos/prepare-recompile "$PROJECT" "$FUZZ_TARGET" "$FUZZING_LANGUAGE"
python infra/helper.py build_image "$PROJECT"
# AddressSanitizer.
docker run -ti --entrypoint="/bin/sh" --env SANITIZER="address" --name "${PROJECT}-origin-asan" "gcr.io/oss-fuzz/${PROJECT}" -c "compile && rm -rf /out/*"
docker commit --change 'CMD ["compile"] --change 'ENTRYPOINT /bin/sh' "${PROJECT}-origin-asan" "gcr.io/oss-fuzz/${PROJECT}-ofg-cached-asan"
docker run -ti --entrypoint="recompile" "gcr.io/oss-fuzz/${PROJECT}-ofg-cached-asan"

# Coverage measurement.
docker run -ti --entrypoint="/bin/sh" --env SANITIZER="coverage" --name "${PROJECT}-origin-cov" "gcr.io/oss-fuzz/${PROJECT}" -c "compile && rm -rf /out/*"
docker commit --change 'CMD ["compile"] --change 'ENTRYPOINT /bin/sh' "${PROJECT}-origin-cov" "gcr.io/oss-fuzz/${PROJECT}-ofg-cached-cov"
docker run -ti --entrypoint="recompile" "gcr.io/oss-fuzz/${PROJECT}-ofg-cached-cov"

Assumptions

  1. Fuzzer: Chronos assumes libFuzzer. Other fuzzers are not well-supported, but may work by setting ENV FUZZING_ENGINE in project's Dockerfile.
  2. Sanitizer: Chronos assumes AddressSanitizer. Other sanitizers may work by adding setting ENV SANITIZER in project's Dockerfile.