From 22dfa6882e8b0c8e52ecc61783843ec28b8f4d7c Mon Sep 17 00:00:00 2001 From: Zhengdai Hu Date: Tue, 14 Jul 2020 19:56:51 +0000 Subject: [PATCH] Onboarding new ZetaSQL fuzzers (#4095) * Enable UBSAN * Added a structure aware fuzzer * Revert "Enable UBSAN" and explicitly enable it in project.yaml This reverts commit de66864567193bd46c4f6bd7c9b09fe8ed03ac1a. * Amend UBSAN commit * Disable MSan Co-authored-by: Abhishek Arya --- projects/zetasql/Dockerfile | 3 ++- projects/zetasql/build.sh | 11 +++++++---- projects/zetasql/project.yaml | 2 +- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/projects/zetasql/Dockerfile b/projects/zetasql/Dockerfile index 54dcdb652..8dd0dd16a 100644 --- a/projects/zetasql/Dockerfile +++ b/projects/zetasql/Dockerfile @@ -25,6 +25,7 @@ RUN curl https://bazel.build/bazel-release.pub.gpg | apt-key add - && \ RUN apt-get update && apt-get -y install bazel-1.0.0 -RUN git clone --depth 1 https://github.com/googleinterns/zetasql-fuzzing.git zetasql +RUN git clone -b arithmetic_fuzzer --depth 1 \ + https://github.com/googleinterns/zetasql-fuzzing.git zetasql COPY build.sh $SRC/ WORKDIR zetasql diff --git a/projects/zetasql/build.sh b/projects/zetasql/build.sh index bca5d03cd..b2cb692b4 100755 --- a/projects/zetasql/build.sh +++ b/projects/zetasql/build.sh @@ -49,10 +49,10 @@ fi )" # Temporary hack, see https://github.com/google/oss-fuzz/issues/383 -readonly NO_VPTR='--copt=-fno-sanitize=vptr --linkopt=-fno-sanitize=vptr' +readonly NO_VPTR='--copt=-fno-sanitize=vptr --linkopt=-fno-sanitize=vptr --cxxopt=-fno-sanitize=vptr' -declare FUZZER_PATH="zetasql/fuzzing/simple_evaluator_fuzzer" -declare FUZZ_TARGET="//zetasql/fuzzing:simple_evaluator_fuzzer" +declare FUZZER_PATH=$(for path in $(find zetasql/fuzzing -name *_fuzzer.cc); do echo "${path%.*}"; done) +declare FUZZ_TARGET="$(for fuzzer in ${FUZZER_PATH}; do echo "//$(dirname ${fuzzer}):$(basename ${fuzzer})"; done)" # Build fuzz target # see https://google.github.io/oss-fuzz/further-reading/fuzzer-environment/ @@ -109,7 +109,10 @@ cp -r /usr/share/zoneinfo $OUT/data/ ln -sf Etc/UTC $OUT/data/zoneinfo/localtime # Move out fuzz target -cp bazel-bin/"${FUZZER_PATH}" "${OUT}"/ +for fuzzer in ${FUZZER_PATH}; +do + cp bazel-bin/"${fuzzer}" "${OUT}"/ +done # Cleanup bazel- symlinks to avoid oss-fuzz trying to copy out of the build # cache. diff --git a/projects/zetasql/project.yaml b/projects/zetasql/project.yaml index 1c52d9482..93bd030f2 100644 --- a/projects/zetasql/project.yaml +++ b/projects/zetasql/project.yaml @@ -6,4 +6,4 @@ auto_ccs: - "shumway@google.com" sanitizers: - address - - memory + - undefined