From 896ed726e28f8b540f8331cdbe1fccf135796343 Mon Sep 17 00:00:00 2001 From: Abhishek Arya Date: Tue, 14 Apr 2020 15:48:08 -0700 Subject: [PATCH] Fix syzkaller to use go-fuzz. (#3646) Fixes #3639. --- projects/go-json-iterator/Dockerfile | 6 +++--- projects/go-json-iterator/build.sh | 2 +- projects/syzkaller/Dockerfile | 4 ++-- projects/syzkaller/build.sh | 10 +++++----- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/projects/go-json-iterator/Dockerfile b/projects/go-json-iterator/Dockerfile index 57cac6d56..78972b689 100644 --- a/projects/go-json-iterator/Dockerfile +++ b/projects/go-json-iterator/Dockerfile @@ -18,7 +18,7 @@ FROM gcr.io/oss-fuzz-base/base-builder MAINTAINER taowen@gmail.com RUN go get github.com/json-iterator/go -RUN mkdir $GOPATH/src/fuzz -COPY fuzz_json.go $GOPATH/src/fuzz +RUN mkdir fuzz +COPY fuzz_json.go fuzz COPY build.sh $SRC/ -WORKDIR $GOPATH/src/fuzz +WORKDIR fuzz diff --git a/projects/go-json-iterator/build.sh b/projects/go-json-iterator/build.sh index a6b121221..476de37d8 100755 --- a/projects/go-json-iterator/build.sh +++ b/projects/go-json-iterator/build.sh @@ -28,4 +28,4 @@ function compile_fuzzer { $CXX $CXXFLAGS $LIB_FUZZING_ENGINE $fuzzer.a -lpthread -o $OUT/$fuzzer } -compile_fuzzer fuzz Fuzz fuzz_json +compile_fuzzer . Fuzz fuzz_json diff --git a/projects/syzkaller/Dockerfile b/projects/syzkaller/Dockerfile index a02296570..983c8faca 100644 --- a/projects/syzkaller/Dockerfile +++ b/projects/syzkaller/Dockerfile @@ -22,6 +22,6 @@ RUN go get -u -d github.com/google/syzkaller/... # Dependency for one of the fuzz targets. RUN go get github.com/ianlancetaylor/demangle -RUN git clone --depth 1 https://github.com/google/syzkaller.git $GOPATH/src/syzkaller -WORKDIR $GOPATH/src/syzkaller +RUN git clone --depth 1 https://github.com/google/syzkaller.git +WORKDIR syzkaller COPY build.sh $SRC/ diff --git a/projects/syzkaller/build.sh b/projects/syzkaller/build.sh index b36f446d2..2977b577a 100755 --- a/projects/syzkaller/build.sh +++ b/projects/syzkaller/build.sh @@ -22,16 +22,16 @@ function compile_fuzzer { fuzzer=$3 # Instrument all Go files relevant to this fuzzer - go-fuzz-build -libfuzzer -func $function -o $fuzzer.a $path + go-fuzz -func $function -o $fuzzer.a $path # Instrumented, compiled Go ($fuzzer.a) + fuzzing engine = fuzzer binary $CXX $CXXFLAGS $LIB_FUZZING_ENGINE $fuzzer.a -lpthread -o $OUT/$fuzzer } -compile_fuzzer syzkaller/pkg/compiler Fuzz compiler_fuzzer -compile_fuzzer syzkaller/prog/test FuzzDeserialize prog_deserialize_fuzzer -compile_fuzzer syzkaller/prog/test FuzzParseLog prog_parselog_fuzzer -compile_fuzzer syzkaller/pkg/report Fuzz report_fuzzer +compile_fuzzer ./pkg/compiler Fuzz compiler_fuzzer +compile_fuzzer ./prog/test FuzzDeserialize prog_deserialize_fuzzer +compile_fuzzer ./prog/test FuzzParseLog prog_parselog_fuzzer +compile_fuzzer ./pkg/report Fuzz report_fuzzer # This target is way too spammy and OOMs very quickly. # compile_fuzzer ./tools/syz-trace2syz/proggen Fuzz trace2syz_fuzzer