diff --git a/projects/lotus/Dockerfile b/projects/lotus/Dockerfile index 1a4b2df6a..08dccff6a 100644 --- a/projects/lotus/Dockerfile +++ b/projects/lotus/Dockerfile @@ -17,7 +17,7 @@ FROM gcr.io/oss-fuzz-base/base-builder RUN apt-get update && apt-get install -y mesa-opencl-icd ocl-icd-opencl-dev gcc \ git bzr jq pkg-config curl clang build-essential hwloc libhwloc-dev -RUN git clone --depth 1 https://github.com/filecoin-project/lotus $GOPATH/src/github.com/filecoin-project/lotus -RUN git clone --depth 1 https://github.com/filecoin-project/fuzzing-lotus $GOPATH/src/github.com/filecoin-project/fuzzing-lotus +RUN git clone --depth 1 https://github.com/filecoin-project/lotus +RUN git clone --depth 1 https://github.com/filecoin-project/fuzzing-lotus COPY build.sh $SRC/ -WORKDIR $GOPATH/src/github.com/filecoin-project/lotus +WORKDIR $SRC/lotus diff --git a/projects/lotus/build.sh b/projects/lotus/build.sh index d0de20761..64603099b 100644 --- a/projects/lotus/build.sh +++ b/projects/lotus/build.sh @@ -17,10 +17,26 @@ make -compile_go_fuzzer github.com/filecoin-project/lotus/chain/types FuzzMessage fuzz_message gofuzz +# Not all fuzzers can be compiled with --sanitizer=coverage. +# The specific issue is that gofuzz.NewFromGofuzz is not supported when compiling with coverage. +# The current status of the coverage build is that we do not break it for the fuzzers that cannot be compiled. +#The reason that we don't break the build script is to create coverage reports for the fuzzers that compile. +if [[ $SANITIZER = *coverage* ]]; then + compile_go_fuzzer github.com/filecoin-project/lotus/chain/types FuzzMessage fuzz_message gofuzz + mkdir fuzzing + cp ../fuzzing-lotus/fuzz/fuzz.go fuzzing/ + compile_go_fuzzer github.com/filecoin-project/lotus/fuzzing FuzzBlockMsg fuzz_block_msg || true + compile_go_fuzzer github.com/filecoin-project/lotus/fuzzing FuzzBlockMsgStructural fuzz_block_msg_structural || true + compile_go_fuzzer github.com/filecoin-project/lotus/fuzzing FuzzBlockHeader fuzz_block_header || true + compile_go_fuzzer github.com/filecoin-project/lotus/fuzzing FuzzNodesForHeight fuzz_nodes_for_height || true + exit 0 +fi +compile_go_fuzzer ./chain/types FuzzMessage fuzz_message gofuzz + + +# Fuzzers from fuzzing-lotus cd ../fuzzing-lotus/fuzz -# obsolete modules referenced rm -Rf libfuzzer go mod init github.com/filecoin-project/fuzzing-lotus/fuzz @@ -28,3 +44,4 @@ compile_go_fuzzer github.com/filecoin-project/fuzzing-lotus/fuzz FuzzBlockMsg fu compile_go_fuzzer github.com/filecoin-project/fuzzing-lotus/fuzz FuzzBlockMsgStructural fuzz_block_msg_structural compile_go_fuzzer github.com/filecoin-project/fuzzing-lotus/fuzz FuzzBlockHeader fuzz_block_header compile_go_fuzzer github.com/filecoin-project/fuzzing-lotus/fuzz FuzzNodesForHeight fuzz_nodes_for_height +exit 0