From 47fb2968d306f2936ed4e2731e40cc478e1ba6ea Mon Sep 17 00:00:00 2001 From: Adam Korczynski Date: Mon, 19 May 2025 13:32:40 +0100 Subject: [PATCH 1/4] gateway: fix broken coverage build Signed-off-by: Adam Korczynski --- .../base-builder/compile_native_go_fuzzer | 12 +---------- infra/base-images/base-runner/coverage | 20 ++++-------------- projects/gateway/Dockerfile | 3 ++- projects/gateway/build.sh | 21 ++++++++++++++++++- 4 files changed, 27 insertions(+), 29 deletions(-) diff --git a/infra/base-images/base-builder/compile_native_go_fuzzer b/infra/base-images/base-builder/compile_native_go_fuzzer index 7a7fa67df811..a4886ad0c46a 100755 --- a/infra/base-images/base-builder/compile_native_go_fuzzer +++ b/infra/base-images/base-builder/compile_native_go_fuzzer @@ -22,18 +22,8 @@ function build_native_go_fuzzer() { tags="-tags gofuzz" if [[ $SANITIZER == *coverage* ]]; then - current_dir=$(pwd) - mkdir $OUT/rawfuzzers || true - cd $abs_file_dir - go test $tags -c -run $fuzzer -o $OUT/$fuzzer -cover - cp "${fuzzer_filename}" "${OUT}/rawfuzzers/${fuzzer}" - fuzzed_repo=$(go list $tags -f {{.Module}} "$path") - abspath_repo=`go list -m $tags -f {{.Dir}} $fuzzed_repo || go list $tags -f {{.Dir}} $fuzzed_repo` - # give equivalence to absolute paths in another file, as go test -cover uses golangish pkg.Dir - echo "s=$fuzzed_repo"="$abspath_repo"= > $OUT/$fuzzer.gocovpath - - cd $current_dir + go-118-fuzz-build $tags -o $fuzzer -sanitizer=coverage -coverpkg=$fuzzed_repo/... -func $function $abs_file_dir else go-118-fuzz-build $tags -o $fuzzer.a -func $function $abs_file_dir $CXX $CXXFLAGS $LIB_FUZZING_ENGINE $fuzzer.a -o $OUT/$fuzzer diff --git a/infra/base-images/base-runner/coverage b/infra/base-images/base-runner/coverage index 585b4d457e75..e6da80282fed 100755 --- a/infra/base-images/base-runner/coverage +++ b/infra/base-images/base-runner/coverage @@ -137,30 +137,18 @@ function run_go_fuzz_target { export FUZZ_CORPUS_DIR="$CORPUS_DIR/${target}/" export FUZZ_PROFILE_NAME="$DUMPS_DIR/$target.perf" - # setup for native go fuzzers - cd $OUT - mkdir -p "testdata/fuzz/${target}" - cp -r "${FUZZ_CORPUS_DIR}" "testdata/fuzz/" - - # rewrite libFuzzer corpus to Std Go corpus if native fuzzing - grep "TestFuzzCorpus" $target > /dev/null 2>&1 && $SYSGOPATH/bin/convertcorpus $target "testdata/fuzz/${target}" - cd - - timeout $TIMEOUT $OUT/$target -test.coverprofile $DUMPS_DIR/$target.profdata &> $LOGS_DIR/$target.log if (( $? != 0 )); then echo "Error occured while running $target:" cat $LOGS_DIR/$target.log fi - # cleanup after native go fuzzers - rm -r "${OUT}/testdata/fuzz/${target}" - - # The Go 1.18 fuzzers are renamed to "*_fuzz_.go" during "infra/helper.py build_fuzzers". - # They are are therefore refered to as "*_fuzz_.go" in the profdata files. - # Since the copies named "*_fuzz_.go" do not exist in the file tree during + # The Go 1.18 fuzzers are renamed to "*libFuzzer.go" during "infra/helper.py build_fuzzers". + # They are are therefore refered to as "*_libFuzzer.go" in the profdata files. + # Since the copies named "*_libFuzzer.go" do not exist in the file tree during # the coverage build, we change the references in the .profdata files # to the original file names. - #sed -i "s/_test.go_fuzz_.go/_test.go/g" $DUMPS_DIR/$target.profdata + sed -i "s/_libFuzzer.go/_test.go/g" $DUMPS_DIR/$target.profdata # translate from golangish paths to current absolute paths cat $OUT/$target.gocovpath | while read i; do sed -i $i $DUMPS_DIR/$target.profdata; done # cf PATH_EQUIVALENCE_ARGS diff --git a/projects/gateway/Dockerfile b/projects/gateway/Dockerfile index ce0609ff6e22..5718def8b847 100644 --- a/projects/gateway/Dockerfile +++ b/projects/gateway/Dockerfile @@ -25,6 +25,7 @@ RUN wget https://go.dev/dl/go1.24.0.linux-amd64.tar.gz \ && apt-get update \ && apt-get install -y btrfs-progs libbtrfs-dev +RUN git clone --depth=1 --branch=november-backup https://github.com/AdamKorcz/go-118-fuzz-build RUN git clone --depth 1 https://github.com/envoyproxy/gateway.git -COPY build.sh $SRC/ \ No newline at end of file +COPY build.sh $SRC/ diff --git a/projects/gateway/build.sh b/projects/gateway/build.sh index 7bcf2a85896a..731ed95488e1 100644 --- a/projects/gateway/build.sh +++ b/projects/gateway/build.sh @@ -15,4 +15,23 @@ # ################################################################################ -$SRC/gateway/test/fuzz/oss_fuzz_build.sh +cd "$SRC"/go-118-fuzz-build +go build +rm "$GOPATH"/bin/go-118-fuzz-build +mv go-118-fuzz-build "$GOPATH"/bin/ + +cd "$SRC"/gateway + +set -o nounset +set -o pipefail +set -o errexit +set -x +printf "package envoygateway\nimport _ \"github.com/AdamKorcz/go-118-fuzz-build/testing\"\n" > register.go +go mod edit -replace github.com/AdamKorcz/go-118-fuzz-build="$SRC"/go-118-fuzz-build +go mod tidy + +# compile native-format fuzzers +compile_native_go_fuzzer github.com/envoyproxy/gateway/test/fuzz FuzzGatewayAPIToXDS FuzzGatewayAPIToXDS + +# add seed corpus +zip -j "$OUT"/FuzzGatewayAPIToXDS_seed_corpus.zip "$SRC"/gateway/test/fuzz/testdata/FuzzGatewayAPIToXDS/* From c157e31891e3b2df346640a1af9ffe0f29d6d36c Mon Sep 17 00:00:00 2001 From: Adam Korczynski Date: Mon, 19 May 2025 22:12:33 +0100 Subject: [PATCH 2/4] add gocovpath file Signed-off-by: Adam Korczynski --- infra/base-images/base-builder/compile_native_go_fuzzer | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/infra/base-images/base-builder/compile_native_go_fuzzer b/infra/base-images/base-builder/compile_native_go_fuzzer index a4886ad0c46a..74ac8a397d08 100755 --- a/infra/base-images/base-builder/compile_native_go_fuzzer +++ b/infra/base-images/base-builder/compile_native_go_fuzzer @@ -22,8 +22,11 @@ function build_native_go_fuzzer() { tags="-tags gofuzz" if [[ $SANITIZER == *coverage* ]]; then - fuzzed_repo=$(go list $tags -f {{.Module}} "$path") - go-118-fuzz-build $tags -o $fuzzer -sanitizer=coverage -coverpkg=$fuzzed_repo/... -func $function $abs_file_dir + fuzzed_repo=$(go list $tags -f {{.Module}} "$path") + go-118-fuzz-build $tags -o $fuzzer -sanitizer=coverage -coverpkg=$fuzzed_repo/... -func $function $abs_file_dir + abspath_repo=`go list -m $tags -f {{.Dir}} $fuzzed_repo || go list $tags -f {{.Dir}} $fuzzed_repo` + # give equivalence to absolute paths in another file, as go test -cover uses golangish pkg.Dir + echo "s=$fuzzed_repo"="$abspath_repo"= > $OUT/$fuzzer.gocovpath else go-118-fuzz-build $tags -o $fuzzer.a -func $function $abs_file_dir $CXX $CXXFLAGS $LIB_FUZZING_ENGINE $fuzzer.a -o $OUT/$fuzzer From efc8cb6241dc6ea8281ee17b19c1f86ab7522d26 Mon Sep 17 00:00:00 2001 From: Adam Korczynski Date: Tue, 27 May 2025 22:10:20 +0100 Subject: [PATCH 3/4] avoid breaking cert-managers coverage build Signed-off-by: Adam Korczynski --- projects/cert-manager/build.sh | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/projects/cert-manager/build.sh b/projects/cert-manager/build.sh index e6a7530611a3..32dd6d3bf4fd 100755 --- a/projects/cert-manager/build.sh +++ b/projects/cert-manager/build.sh @@ -15,6 +15,7 @@ # ################################################################################ + cp $SRC/pki_fuzzer.go $SRC/cert-manager/pkg/util/pki/ # These test files break the build, so removing; the fuzz tests don't need them @@ -32,14 +33,19 @@ go mod tidy go mod edit -replace github.com/AdamKorcz/go-118-fuzz-build=$SRC/go-118-fuzz-build go mod tidy compile_native_go_fuzzer github.com/cert-manager/cert-manager/internal/webhook/admission/certificaterequest/approval FuzzValidate FuzzValidate_approval -compile_native_go_fuzzer github.com/cert-manager/cert-manager/pkg/controller/certificates/trigger FuzzProcessItem FuzzProcessItem_trigger -compile_native_go_fuzzer github.com/cert-manager/cert-manager/pkg/controller/certificates/revisionmanager FuzzProcessItem FuzzProcessItem_revisionmanager -compile_native_go_fuzzer github.com/cert-manager/cert-manager/pkg/controller/certificates/issuing FuzzProcessItem FuzzProcessItem_issuing -compile_native_go_fuzzer github.com/cert-manager/cert-manager/pkg/controller/certificates/readiness FuzzProcessItem FuzzProcessItem_readiness -compile_native_go_fuzzer github.com/cert-manager/cert-manager/pkg/controller/certificates/keymanager FuzzProcessItem FuzzProcessItem_keymanager -compile_native_go_fuzzer github.com/cert-manager/cert-manager/pkg/controller/certificates/requestmanager FuzzProcessItem FuzzProcessItem_requestmanager -compile_native_go_fuzzer github.com/cert-manager/cert-manager/pkg/controller/certificaterequests/vault FuzzVaultCRController FuzzVaultCRController -compile_native_go_fuzzer github.com/cert-manager/cert-manager/pkg/controller/certificaterequests/venafi FuzzVenafiCRController FuzzVenafiCRController compile_go_fuzzer github.com/cert-manager/cert-manager/pkg/util/pki FuzzUnmarshalSubjectStringToRDNSequence FuzzUnmarshalSubjectStringToRDNSequence compile_go_fuzzer github.com/cert-manager/cert-manager/pkg/util/pki FuzzDecodePrivateKeyBytes FuzzDecodePrivateKeyBytes +# temporary fix until https://github.com/golang/go/pull/73824 has been merged +if [ "$SANITIZER" != "coverage" ] +then + compile_native_go_fuzzer github.com/cert-manager/cert-manager/pkg/controller/certificates/trigger FuzzProcessItem FuzzProcessItem_trigger + compile_native_go_fuzzer github.com/cert-manager/cert-manager/pkg/controller/certificates/revisionmanager FuzzProcessItem FuzzProcessItem_revisionmanager + compile_native_go_fuzzer github.com/cert-manager/cert-manager/pkg/controller/certificates/issuing FuzzProcessItem FuzzProcessItem_issuing + compile_native_go_fuzzer github.com/cert-manager/cert-manager/pkg/controller/certificates/readiness FuzzProcessItem FuzzProcessItem_readiness + compile_native_go_fuzzer github.com/cert-manager/cert-manager/pkg/controller/certificates/keymanager FuzzProcessItem FuzzProcessItem_keymanager + compile_native_go_fuzzer github.com/cert-manager/cert-manager/pkg/controller/certificates/requestmanager FuzzProcessItem FuzzProcessItem_requestmanager + compile_native_go_fuzzer github.com/cert-manager/cert-manager/pkg/controller/certificaterequests/vault FuzzVaultCRController FuzzVaultCRController + compile_native_go_fuzzer github.com/cert-manager/cert-manager/pkg/controller/certificaterequests/venafi FuzzVenafiCRController FuzzVenafiCRController +fi + From 916b078ed89349a47e1e523e336303d4eb922943 Mon Sep 17 00:00:00 2001 From: Adam Korczynski Date: Wed, 28 May 2025 13:22:07 +0100 Subject: [PATCH 4/4] fix coverage build of more projects Signed-off-by: Adam Korczynski --- projects/atomic/Dockerfile | 1 + projects/atomic/build.sh | 9 ++++++++- projects/clock/Dockerfile | 1 + projects/clock/build.sh | 9 ++++++++- projects/containerd/Dockerfile | 1 + projects/containerd/build.sh | 8 ++++++++ projects/demangle/Dockerfile | 1 + projects/demangle/build.sh | 9 ++++++++- projects/fasthttp/Dockerfile | 2 +- projects/fasthttp/build.sh | 12 +++++++++++- projects/fsnotify/Dockerfile | 1 + projects/fsnotify/build.sh | 10 ++++++++-- projects/gitea/Dockerfile | 1 + projects/gitea/build.sh | 12 +++++++++++- projects/go-cmp/Dockerfile | 1 + projects/go-cmp/build.sh | 7 +++++++ projects/go-humanize/Dockerfile | 1 + projects/go-humanize/build.sh | 10 ++++++++-- projects/go-readline/Dockerfile | 1 + projects/go-readline/build.sh | 10 ++++++++-- projects/go-shlex/Dockerfile | 1 + projects/go-shlex/build.sh | 9 +++++++-- projects/go-yaml/Dockerfile | 1 + projects/go-yaml/build.sh | 9 ++++++++- projects/gogo-protobuf/Dockerfile | 1 + projects/gogo-protobuf/build.sh | 10 ++++++++-- projects/gopsutil/Dockerfile | 1 + projects/gopsutil/build.sh | 9 ++++++++- projects/kyverno/Dockerfile | 1 + projects/kyverno/build.sh | 8 ++++++++ projects/lima/Dockerfile | 1 + projects/lima/build.sh | 8 ++++++++ projects/pborman-uuid/Dockerfile | 1 + projects/pborman-uuid/build.sh | 9 ++++++++- projects/scorecard-web/Dockerfile | 2 +- projects/scorecard-web/build.sh | 11 ++++++++++- projects/teleport/Dockerfile | 1 + projects/teleport/build.sh | 8 ++++++++ projects/volcano/Dockerfile | 1 + projects/volcano/build.sh | 8 ++++++++ 40 files changed, 186 insertions(+), 21 deletions(-) mode change 100644 => 100755 projects/gitea/build.sh diff --git a/projects/atomic/Dockerfile b/projects/atomic/Dockerfile index 03d554494b7b..058105a470cc 100644 --- a/projects/atomic/Dockerfile +++ b/projects/atomic/Dockerfile @@ -16,5 +16,6 @@ FROM gcr.io/oss-fuzz-base/base-builder-go RUN git clone --depth 1 https://github.com/uber-go/atomic +RUN git clone --depth=1 --branch=november-backup https://github.com/AdamKorcz/go-118-fuzz-build WORKDIR $SRC/atomic COPY build.sh fuzz_test.go $SRC/ diff --git a/projects/atomic/build.sh b/projects/atomic/build.sh index ddcd57854a52..f98b7f8cc2fb 100644 --- a/projects/atomic/build.sh +++ b/projects/atomic/build.sh @@ -15,8 +15,15 @@ # ################################################################################ +cd "$SRC"/go-118-fuzz-build +go build +rm "$GOPATH"/bin/go-118-fuzz-build +mv go-118-fuzz-build "$GOPATH"/bin/ + +cd "$SRC"/atomic + cp $SRC/fuzz_test.go ./ -go mod tidy printf "package atomic\nimport _ \"github.com/AdamKorcz/go-118-fuzz-build/testing\"\n" > register.go +go mod edit -replace github.com/AdamKorcz/go-118-fuzz-build="$SRC"/go-118-fuzz-build go mod tidy compile_native_go_fuzzer go.uber.org/atomic FuzzTest FuzzTest diff --git a/projects/clock/Dockerfile b/projects/clock/Dockerfile index d5ce9fb016ec..b48393ebbb08 100644 --- a/projects/clock/Dockerfile +++ b/projects/clock/Dockerfile @@ -16,5 +16,6 @@ FROM gcr.io/oss-fuzz-base/base-builder-go RUN git clone --depth 1 https://github.com/benbjohnson/clock +RUN git clone --depth=1 --branch=november-backup https://github.com/AdamKorcz/go-118-fuzz-build WORKDIR clock COPY build.sh fuzz_test.go $SRC/ diff --git a/projects/clock/build.sh b/projects/clock/build.sh index bac332f4ead8..3d35d0229363 100644 --- a/projects/clock/build.sh +++ b/projects/clock/build.sh @@ -15,7 +15,14 @@ # ################################################################################ +cd "$SRC"/go-118-fuzz-build +go build +rm "$GOPATH"/bin/go-118-fuzz-build +mv go-118-fuzz-build "$GOPATH"/bin/ + +cd "$SRC"/clock +printf "package clock\nimport _ \"github.com/AdamKorcz/go-118-fuzz-build/testing\"\n" > register.go +go mod edit -replace github.com/AdamKorcz/go-118-fuzz-build="$SRC"/go-118-fuzz-build mv $SRC/fuzz_test.go $SRC/clock/ go mod tidy -go get github.com/AdamKorcz/go-118-fuzz-build/testing compile_native_go_fuzzer github.com/benbjohnson/clock FuzzClock FuzzClock diff --git a/projects/containerd/Dockerfile b/projects/containerd/Dockerfile index e3626f7600c1..0833698c0bd8 100644 --- a/projects/containerd/Dockerfile +++ b/projects/containerd/Dockerfile @@ -18,5 +18,6 @@ FROM gcr.io/oss-fuzz-base/base-builder-go RUN apt-get update && apt-get install -y btrfs-progs libc-dev pkg-config libseccomp-dev gcc wget libbtrfs-dev RUN git clone --depth 1 https://github.com/containerd/containerd RUN git clone --depth=1 https://github.com/AdamKorcz/instrumentation +RUN git clone --depth=1 --branch=november-backup https://github.com/AdamKorcz/go-118-fuzz-build COPY build.sh $SRC/ WORKDIR $SRC/containerd diff --git a/projects/containerd/build.sh b/projects/containerd/build.sh index caeb6056fa28..d5462b9a1e52 100644 --- a/projects/containerd/build.sh +++ b/projects/containerd/build.sh @@ -15,4 +15,12 @@ # ################################################################################ +cd "$SRC"/go-118-fuzz-build +go build +rm "$GOPATH"/bin/go-118-fuzz-build +mv go-118-fuzz-build "$GOPATH"/bin/ + +cd "$SRC"/containerd +go mod edit -replace github.com/AdamKorcz/go-118-fuzz-build="$SRC"/go-118-fuzz-build + $SRC/containerd/contrib/fuzz/oss_fuzz_build.sh diff --git a/projects/demangle/Dockerfile b/projects/demangle/Dockerfile index 7f90867ba72f..6e7fd8d9142a 100644 --- a/projects/demangle/Dockerfile +++ b/projects/demangle/Dockerfile @@ -16,5 +16,6 @@ FROM gcr.io/oss-fuzz-base/base-builder-go RUN git clone --depth 1 https://github.com/ianlancetaylor/demangle +RUN git clone --depth=1 --branch=november-backup https://github.com/AdamKorcz/go-118-fuzz-build WORKDIR $SRC/demangle COPY build.sh fuzz_test.go $SRC/ diff --git a/projects/demangle/build.sh b/projects/demangle/build.sh index 8ca5d4c9e41e..517d5d6eeab0 100644 --- a/projects/demangle/build.sh +++ b/projects/demangle/build.sh @@ -16,7 +16,14 @@ ################################################################################ cp $SRC/fuzz_test.go ./ -go mod tidy +cd "$SRC"/go-118-fuzz-build +go build +rm "$GOPATH"/bin/go-118-fuzz-build +mv go-118-fuzz-build "$GOPATH"/bin/ + +cd "$SRC"/demangle +go mod edit -replace github.com/AdamKorcz/go-118-fuzz-build="$SRC"/go-118-fuzz-build +cp $SRC/fuzz_test.go ./ printf "package demangle\nimport _ \"github.com/AdamKorcz/go-118-fuzz-build/testing\"\n" > register.go go mod tidy compile_native_go_fuzzer github.com/ianlancetaylor/demangle FuzzTest FuzzTest diff --git a/projects/fasthttp/Dockerfile b/projects/fasthttp/Dockerfile index 6edf310b2b8a..f900af38bcf0 100644 --- a/projects/fasthttp/Dockerfile +++ b/projects/fasthttp/Dockerfile @@ -16,6 +16,6 @@ FROM gcr.io/oss-fuzz-base/base-builder-go RUN git clone --depth 1 https://github.com/valyala/fasthttp - +RUN git clone --depth=1 --branch=november-backup https://github.com/AdamKorcz/go-118-fuzz-build COPY build.sh $SRC/ WORKDIR $SRC/fasthttp diff --git a/projects/fasthttp/build.sh b/projects/fasthttp/build.sh index 9e466978f3d8..2342ab0de88f 100755 --- a/projects/fasthttp/build.sh +++ b/projects/fasthttp/build.sh @@ -15,8 +15,18 @@ # ################################################################################ -go get github.com/AdamKorcz/go-118-fuzz-build/testing +cd "$SRC"/go-118-fuzz-build +go build +rm "$GOPATH"/bin/go-118-fuzz-build +mv go-118-fuzz-build "$GOPATH"/bin/ +cd $SRC/fasthttp +printf "package fasthttp\nimport _ \"github.com/AdamKorcz/go-118-fuzz-build/testing\"\n" > register.go +go mod edit -replace github.com/AdamKorcz/go-118-fuzz-build="$SRC"/go-118-fuzz-build +go mod tidy + +# breaks the coverage build +rm fs_fs_test.go compile_native_go_fuzzer github.com/valyala/fasthttp FuzzCookieParse fuzzCookieParse compile_native_go_fuzzer github.com/valyala/fasthttp FuzzVisitHeaderParams fuzzVisitHeaderParams compile_native_go_fuzzer github.com/valyala/fasthttp FuzzResponseReadLimitBody fuzzResponseReadLimitBody diff --git a/projects/fsnotify/Dockerfile b/projects/fsnotify/Dockerfile index 4e8bba1a484f..8cae177388b6 100644 --- a/projects/fsnotify/Dockerfile +++ b/projects/fsnotify/Dockerfile @@ -16,5 +16,6 @@ FROM gcr.io/oss-fuzz-base/base-builder-go RUN git clone --depth 1 https://github.com/fsnotify/fsnotify +RUN git clone --depth=1 --branch=november-backup https://github.com/AdamKorcz/go-118-fuzz-build WORKDIR $SRC/fsnotify COPY build.sh fuzz_test.go $SRC/ diff --git a/projects/fsnotify/build.sh b/projects/fsnotify/build.sh index 709107172260..769b76a29c9b 100644 --- a/projects/fsnotify/build.sh +++ b/projects/fsnotify/build.sh @@ -15,9 +15,15 @@ # ################################################################################ +cd "$SRC"/go-118-fuzz-build +go build +rm "$GOPATH"/bin/go-118-fuzz-build +mv go-118-fuzz-build "$GOPATH"/bin/ + +cd "$SRC"/fsnotify + cp $SRC/fuzz_test.go ./ -go mod tidy printf "package fsnotify\nimport _ \"github.com/AdamKorcz/go-118-fuzz-build/testing\"\n" > register.go +go mod edit -replace github.com/AdamKorcz/go-118-fuzz-build="$SRC"/go-118-fuzz-build go mod tidy -echo building compile_native_go_fuzzer github.com/fsnotify/fsnotify FuzzInotify FuzzInotify diff --git a/projects/gitea/Dockerfile b/projects/gitea/Dockerfile index 2defa813c3fe..4fb96c1812b0 100644 --- a/projects/gitea/Dockerfile +++ b/projects/gitea/Dockerfile @@ -16,5 +16,6 @@ FROM gcr.io/oss-fuzz-base/base-builder-go RUN git clone https://github.com/go-gitea/gitea +RUN git clone --depth=1 --branch=november-backup https://github.com/AdamKorcz/go-118-fuzz-build COPY build.sh $SRC/ WORKDIR $SRC/gitea diff --git a/projects/gitea/build.sh b/projects/gitea/build.sh old mode 100644 new mode 100755 index cb6fe8aa6092..6c555671b5fa --- a/projects/gitea/build.sh +++ b/projects/gitea/build.sh @@ -15,6 +15,16 @@ # ################################################################################ -go get github.com/AdamKorcz/go-118-fuzz-build/testing +cd "$SRC"/go-118-fuzz-build +go build +rm "$GOPATH"/bin/go-118-fuzz-build +mv go-118-fuzz-build "$GOPATH"/bin/ + +cd "$SRC"/gitea + +printf "package routers\nimport _ \"github.com/AdamKorcz/go-118-fuzz-build/testing\"\n" > ./routers/register.go +go mod edit -replace github.com/AdamKorcz/go-118-fuzz-build="$SRC"/go-118-fuzz-build +go mod tidy + compile_native_go_fuzzer code.gitea.io/gitea/tests/fuzz FuzzMarkdownRenderRaw fuzz_markdown_render_raw gofuzz compile_native_go_fuzzer code.gitea.io/gitea/tests/fuzz FuzzMarkupPostProcess fuzz_markup_post_process gofuzz diff --git a/projects/go-cmp/Dockerfile b/projects/go-cmp/Dockerfile index 73db25a013df..d3d3894810bc 100644 --- a/projects/go-cmp/Dockerfile +++ b/projects/go-cmp/Dockerfile @@ -16,5 +16,6 @@ FROM gcr.io/oss-fuzz-base/base-builder-go RUN git clone --depth 1 https://github.com/google/go-cmp +RUN git clone --depth=1 --branch=november-backup https://github.com/AdamKorcz/go-118-fuzz-build WORKDIR go-cmp COPY build.sh fuzz_test.go $SRC/ diff --git a/projects/go-cmp/build.sh b/projects/go-cmp/build.sh index ebf2c2983ad6..423f1a66c718 100644 --- a/projects/go-cmp/build.sh +++ b/projects/go-cmp/build.sh @@ -16,6 +16,13 @@ ################################################################################ cp $SRC/fuzz_test.go ./cmp/ +cd "$SRC"/go-118-fuzz-build +go build +rm "$GOPATH"/bin/go-118-fuzz-build +mv go-118-fuzz-build "$GOPATH"/bin/ + +cd $SRC/go-cmp +go mod edit -replace github.com/AdamKorcz/go-118-fuzz-build="$SRC"/go-118-fuzz-build go mod tidy printf "package cmp\nimport _ \"github.com/AdamKorcz/go-118-fuzz-build/testing\"\n" > register.go go mod tidy diff --git a/projects/go-humanize/Dockerfile b/projects/go-humanize/Dockerfile index 2fee5c45d231..02c85879e7c0 100644 --- a/projects/go-humanize/Dockerfile +++ b/projects/go-humanize/Dockerfile @@ -16,5 +16,6 @@ FROM gcr.io/oss-fuzz-base/base-builder-go RUN git clone --depth 1 https://github.com/dustin/go-humanize +RUN git clone --depth=1 --branch=november-backup https://github.com/AdamKorcz/go-118-fuzz-build WORKDIR $SRC/go-humanize COPY build.sh fuzz_test.go $SRC/ diff --git a/projects/go-humanize/build.sh b/projects/go-humanize/build.sh index 48c500f49125..12918ed0a566 100644 --- a/projects/go-humanize/build.sh +++ b/projects/go-humanize/build.sh @@ -16,8 +16,14 @@ ################################################################################ cp $SRC/fuzz_test.go ./ -go mod tidy +cd "$SRC"/go-118-fuzz-build +go build +rm "$GOPATH"/bin/go-118-fuzz-build +mv go-118-fuzz-build "$GOPATH"/bin/ + +cd "$SRC"/go-humanize + +go mod edit -replace github.com/AdamKorcz/go-118-fuzz-build="$SRC"/go-118-fuzz-build printf "package humanize\nimport _ \"github.com/AdamKorcz/go-118-fuzz-build/testing\"\n" > register.go go mod tidy -echo building compile_native_go_fuzzer github.com/dustin/go-humanize FuzzParseBytes FuzzParseBytes diff --git a/projects/go-readline/Dockerfile b/projects/go-readline/Dockerfile index bd95dc6333ca..2ba13bf7533e 100644 --- a/projects/go-readline/Dockerfile +++ b/projects/go-readline/Dockerfile @@ -16,5 +16,6 @@ FROM gcr.io/oss-fuzz-base/base-builder-go RUN git clone --depth 1 https://github.com/chzyer/readline +RUN git clone --depth=1 --branch=november-backup https://github.com/AdamKorcz/go-118-fuzz-build WORKDIR readline COPY build.sh fuzz_test.go $SRC/ diff --git a/projects/go-readline/build.sh b/projects/go-readline/build.sh index 569aa0e75d05..6032330da067 100644 --- a/projects/go-readline/build.sh +++ b/projects/go-readline/build.sh @@ -15,8 +15,14 @@ # ################################################################################ -go mod tidy +cd "$SRC"/go-118-fuzz-build +go build +rm "$GOPATH"/bin/go-118-fuzz-build +mv go-118-fuzz-build "$GOPATH"/bin/ + +cd "$SRC"/readline +cp $SRC/fuzz_test.go ./ printf "package readline\nimport _ \"github.com/AdamKorcz/go-118-fuzz-build/testing\"\n" > ./register.go +go mod edit -replace github.com/AdamKorcz/go-118-fuzz-build="$SRC"/go-118-fuzz-build go mod tidy -cp $SRC/fuzz_test.go ./ compile_native_go_fuzzer github.com/chzyer/readline FuzzReadline FuzzReadline diff --git a/projects/go-shlex/Dockerfile b/projects/go-shlex/Dockerfile index 85ac849d7e42..b7a015dc1f6e 100644 --- a/projects/go-shlex/Dockerfile +++ b/projects/go-shlex/Dockerfile @@ -16,5 +16,6 @@ FROM gcr.io/oss-fuzz-base/base-builder-go RUN git clone --depth 1 https://github.com/google/shlex +RUN git clone --depth=1 --branch=november-backup https://github.com/AdamKorcz/go-118-fuzz-build WORKDIR $SRC/shlex COPY build.sh fuzz_test.go $SRC/ diff --git a/projects/go-shlex/build.sh b/projects/go-shlex/build.sh index 8e92fdc51257..500c0f593076 100644 --- a/projects/go-shlex/build.sh +++ b/projects/go-shlex/build.sh @@ -15,9 +15,14 @@ # ################################################################################ +cd "$SRC"/go-118-fuzz-build +go build +rm "$GOPATH"/bin/go-118-fuzz-build +mv go-118-fuzz-build "$GOPATH"/bin/ + +cd "$SRC"/shlex +go mod edit -replace github.com/AdamKorcz/go-118-fuzz-build="$SRC"/go-118-fuzz-build cp $SRC/fuzz_test.go ./ -go mod tidy printf "package shlex\nimport _ \"github.com/AdamKorcz/go-118-fuzz-build/testing\"\n" > register.go go mod tidy -echo building compile_native_go_fuzzer github.com/google/shlex FuzzLexer FuzzLexer diff --git a/projects/go-yaml/Dockerfile b/projects/go-yaml/Dockerfile index 7f01f458b647..ecc2cc18c837 100644 --- a/projects/go-yaml/Dockerfile +++ b/projects/go-yaml/Dockerfile @@ -16,5 +16,6 @@ FROM gcr.io/oss-fuzz-base/base-builder-go RUN git clone --depth 1 https://github.com/go-yaml/yaml +RUN git clone --depth=1 --branch=november-backup https://github.com/AdamKorcz/go-118-fuzz-build WORKDIR yaml COPY build.sh fuzz_test.go $SRC/ diff --git a/projects/go-yaml/build.sh b/projects/go-yaml/build.sh index 0819a37d0080..30593975396d 100644 --- a/projects/go-yaml/build.sh +++ b/projects/go-yaml/build.sh @@ -15,9 +15,16 @@ # ################################################################################ +cd "$SRC"/go-118-fuzz-build +go build +rm "$GOPATH"/bin/go-118-fuzz-build +mv go-118-fuzz-build "$GOPATH"/bin/ + +cd "$SRC"/yaml + cp $SRC/fuzz_test.go ./ -go mod tidy printf "package yaml\nimport _ \"github.com/AdamKorcz/go-118-fuzz-build/testing\"\n" > register.go +go mod edit -replace github.com/AdamKorcz/go-118-fuzz-build="$SRC"/go-118-fuzz-build go mod tidy compile_native_go_fuzzer gopkg.in/yaml.v3 FuzzDecode FuzzDecode diff --git a/projects/gogo-protobuf/Dockerfile b/projects/gogo-protobuf/Dockerfile index d1617a412d9a..b12b2a74c298 100644 --- a/projects/gogo-protobuf/Dockerfile +++ b/projects/gogo-protobuf/Dockerfile @@ -16,5 +16,6 @@ FROM gcr.io/oss-fuzz-base/base-builder-go RUN git clone --depth 1 https://github.com/gogo/protobuf +RUN git clone --depth=1 --branch=november-backup https://github.com/AdamKorcz/go-118-fuzz-build WORKDIR $SRC/protobuf COPY build.sh fuzz_test.go $SRC/ diff --git a/projects/gogo-protobuf/build.sh b/projects/gogo-protobuf/build.sh index d35079a88e91..25978eb0cb46 100644 --- a/projects/gogo-protobuf/build.sh +++ b/projects/gogo-protobuf/build.sh @@ -15,11 +15,17 @@ # ################################################################################ +cd "$SRC"/go-118-fuzz-build +go build +rm "$GOPATH"/bin/go-118-fuzz-build +mv go-118-fuzz-build "$GOPATH"/bin/ + +cd "$SRC"/protobuf + mkdir fuzzing cp $SRC/fuzz_test.go ./fuzzing/ cd fuzzing -go mod tidy printf "package fuzzing\nimport _ \"github.com/AdamKorcz/go-118-fuzz-build/testing\"\n" > register.go +go mod edit -replace github.com/AdamKorcz/go-118-fuzz-build="$SRC"/go-118-fuzz-build go mod tidy -echo building compile_native_go_fuzzer github.com/gogo/protobuf/fuzzing FuzzProtoUnmarshal FuzzProtoUnmarshal diff --git a/projects/gopsutil/Dockerfile b/projects/gopsutil/Dockerfile index 06c7fe3f726a..74fc85cb0ac9 100644 --- a/projects/gopsutil/Dockerfile +++ b/projects/gopsutil/Dockerfile @@ -16,5 +16,6 @@ FROM gcr.io/oss-fuzz-base/base-builder-go RUN git clone --depth 1 https://github.com/shirou/gopsutil +RUN git clone --depth=1 --branch=november-backup https://github.com/AdamKorcz/go-118-fuzz-build WORKDIR $SRC/gopsutil COPY build.sh fuzz_test.go $SRC/ diff --git a/projects/gopsutil/build.sh b/projects/gopsutil/build.sh index a8414a93eba8..7db752f416d0 100644 --- a/projects/gopsutil/build.sh +++ b/projects/gopsutil/build.sh @@ -15,8 +15,15 @@ # ################################################################################ +cp $SRC/fuzz_test.go ./ +cd "$SRC"/go-118-fuzz-build +go build +rm "$GOPATH"/bin/go-118-fuzz-build +mv go-118-fuzz-build "$GOPATH"/bin/ + +cd "$SRC"/gopsutil cp $SRC/fuzz_test.go ./process/ -go mod tidy printf "package process\nimport _ \"github.com/AdamKorcz/go-118-fuzz-build/testing\"\n" > ./process/register.go +go mod edit -replace github.com/AdamKorcz/go-118-fuzz-build="$SRC"/go-118-fuzz-build go mod tidy compile_native_go_fuzzer github.com/shirou/gopsutil/v4/process FuzzTest FuzzTest diff --git a/projects/kyverno/Dockerfile b/projects/kyverno/Dockerfile index 6cea43b85c58..4c58f3ba9852 100644 --- a/projects/kyverno/Dockerfile +++ b/projects/kyverno/Dockerfile @@ -16,5 +16,6 @@ FROM gcr.io/oss-fuzz-base/base-builder-go RUN git clone --depth 1 https://github.com/kyverno/kyverno +RUN git clone --depth=1 --branch=november-backup https://github.com/AdamKorcz/go-118-fuzz-build COPY build.sh $SRC/ WORKDIR $SRC/kyverno diff --git a/projects/kyverno/build.sh b/projects/kyverno/build.sh index b308d3c0879b..9b86440d38c7 100644 --- a/projects/kyverno/build.sh +++ b/projects/kyverno/build.sh @@ -15,4 +15,12 @@ # ################################################################################ +cd "$SRC"/go-118-fuzz-build +go build +rm "$GOPATH"/bin/go-118-fuzz-build +mv go-118-fuzz-build "$GOPATH"/bin/ + +cd "$SRC"/kyverno +go mod edit -replace github.com/AdamKorcz/go-118-fuzz-build="$SRC"/go-118-fuzz-build + $SRC/kyverno/test/fuzz/oss_fuzz_build.sh diff --git a/projects/lima/Dockerfile b/projects/lima/Dockerfile index 3e37a00a9c64..a73fafdadde3 100644 --- a/projects/lima/Dockerfile +++ b/projects/lima/Dockerfile @@ -16,5 +16,6 @@ FROM gcr.io/oss-fuzz-base/base-builder-go RUN git clone --depth 1 https://github.com/lima-vm/lima +RUN git clone --depth=1 --branch=november-backup https://github.com/AdamKorcz/go-118-fuzz-build WORKDIR lima COPY build.sh $SRC/ diff --git a/projects/lima/build.sh b/projects/lima/build.sh index 1634e5489293..2f63e19ab854 100644 --- a/projects/lima/build.sh +++ b/projects/lima/build.sh @@ -15,4 +15,12 @@ # ################################################################################ +cd "$SRC"/go-118-fuzz-build +go build +rm "$GOPATH"/bin/go-118-fuzz-build +mv go-118-fuzz-build "$GOPATH"/bin/ + +cd "$SRC"/lima +go mod edit -replace github.com/AdamKorcz/go-118-fuzz-build="$SRC"/go-118-fuzz-build + ./hack/oss-fuzz-build.sh diff --git a/projects/pborman-uuid/Dockerfile b/projects/pborman-uuid/Dockerfile index 75ad3166d70f..28ba46c3a579 100644 --- a/projects/pborman-uuid/Dockerfile +++ b/projects/pborman-uuid/Dockerfile @@ -16,5 +16,6 @@ FROM gcr.io/oss-fuzz-base/base-builder-go RUN git clone --depth 1 https://github.com/pborman/uuid +RUN git clone --depth=1 --branch=november-backup https://github.com/AdamKorcz/go-118-fuzz-build WORKDIR $SRC/uuid COPY build.sh fuzz_test.go $SRC/ diff --git a/projects/pborman-uuid/build.sh b/projects/pborman-uuid/build.sh index 0fe238ed5c5f..5f5f3a937e02 100644 --- a/projects/pborman-uuid/build.sh +++ b/projects/pborman-uuid/build.sh @@ -16,7 +16,14 @@ ################################################################################ cp $SRC/fuzz_test.go ./ -go mod tidy +cd "$SRC"/go-118-fuzz-build +go build +rm "$GOPATH"/bin/go-118-fuzz-build +mv go-118-fuzz-build "$GOPATH"/bin/ + +cd "$SRC"/uuid +cp $SRC/fuzz_test.go ./ printf "package uuid\nimport _ \"github.com/AdamKorcz/go-118-fuzz-build/testing\"\n" > register.go +go mod edit -replace github.com/AdamKorcz/go-118-fuzz-build="$SRC"/go-118-fuzz-build go mod tidy compile_native_go_fuzzer github.com/pborman/uuid FuzzParseBytes FuzzParseBytes diff --git a/projects/scorecard-web/Dockerfile b/projects/scorecard-web/Dockerfile index 2f15d7147124..0484ee1f6162 100644 --- a/projects/scorecard-web/Dockerfile +++ b/projects/scorecard-web/Dockerfile @@ -16,6 +16,6 @@ FROM gcr.io/oss-fuzz-base/base-builder-go RUN git clone --depth 1 https://github.com/ossf/scorecard-webapp - +RUN git clone --depth=1 --branch=november-backup https://github.com/AdamKorcz/go-118-fuzz-build COPY build.sh $SRC WORKDIR $SRC/scorecard-webapp/app/server diff --git a/projects/scorecard-web/build.sh b/projects/scorecard-web/build.sh index afab2d358c75..c0ff634578e4 100644 --- a/projects/scorecard-web/build.sh +++ b/projects/scorecard-web/build.sh @@ -15,7 +15,16 @@ # ################################################################################ -go get github.com/AdamKorcz/go-118-fuzz-build/testing +cd "$SRC"/go-118-fuzz-build +go build +rm "$GOPATH"/bin/go-118-fuzz-build +mv go-118-fuzz-build "$GOPATH"/bin/ + +cd $SRC/scorecard-webapp + +printf "package server\nimport _ \"github.com/AdamKorcz/go-118-fuzz-build/testing\"\n" > ./app/server/register.go +go mod edit -replace github.com/AdamKorcz/go-118-fuzz-build="$SRC"/go-118-fuzz-build +go mod tidy compile_native_go_fuzzer github.com/ossf/scorecard-webapp/app/server FuzzVerifyWorkflow FuzzVerifyWorkflow compile_native_go_fuzzer github.com/ossf/scorecard-webapp/app/server FuzzExtractCertInfo FuzzLoadCertificates diff --git a/projects/teleport/Dockerfile b/projects/teleport/Dockerfile index c7bced3e1618..92d565928227 100644 --- a/projects/teleport/Dockerfile +++ b/projects/teleport/Dockerfile @@ -16,5 +16,6 @@ FROM gcr.io/oss-fuzz-base/base-builder-go RUN git clone --depth 1 https://github.com/gravitational/teleport.git teleport +RUN git clone --depth=1 --branch=november-backup https://github.com/AdamKorcz/go-118-fuzz-build WORKDIR teleport COPY build.sh $SRC/ diff --git a/projects/teleport/build.sh b/projects/teleport/build.sh index df0e7d4681db..61bfbb357664 100644 --- a/projects/teleport/build.sh +++ b/projects/teleport/build.sh @@ -15,4 +15,12 @@ # ################################################################################ +cd "$SRC"/go-118-fuzz-build +go build +rm "$GOPATH"/bin/go-118-fuzz-build +mv go-118-fuzz-build "$GOPATH"/bin/ + +cd "$SRC"/teleport +go mod edit -replace github.com/AdamKorcz/go-118-fuzz-build="$SRC"/go-118-fuzz-build + bash -x ./fuzz/oss-fuzz-build.sh diff --git a/projects/volcano/Dockerfile b/projects/volcano/Dockerfile index dd5cf22522e6..3220bfd9a244 100644 --- a/projects/volcano/Dockerfile +++ b/projects/volcano/Dockerfile @@ -16,5 +16,6 @@ FROM gcr.io/oss-fuzz-base/base-builder-go RUN git clone --depth 1 https://github.com/volcano-sh/volcano +RUN git clone --depth=1 --branch=november-backup https://github.com/AdamKorcz/go-118-fuzz-build WORKDIR volcano COPY build.sh $SRC/ diff --git a/projects/volcano/build.sh b/projects/volcano/build.sh index 1137a7904db7..cd5dfb12b507 100644 --- a/projects/volcano/build.sh +++ b/projects/volcano/build.sh @@ -15,4 +15,12 @@ # ################################################################################ +cd "$SRC"/go-118-fuzz-build +go build +rm "$GOPATH"/bin/go-118-fuzz-build +mv go-118-fuzz-build "$GOPATH"/bin/ + +cd "$SRC"/volcano +go mod edit -replace github.com/AdamKorcz/go-118-fuzz-build="$SRC"/go-118-fuzz-build + ./hack/oss-fuzz-build.sh