diff options
Diffstat (limited to 'infra/base-images/base-builder/Dockerfile')
-rw-r--r-- | infra/base-images/base-builder/Dockerfile | 51 |
1 files changed, 41 insertions, 10 deletions
diff --git a/infra/base-images/base-builder/Dockerfile b/infra/base-images/base-builder/Dockerfile index 6f596d5ba..d802f247a 100644 --- a/infra/base-images/base-builder/Dockerfile +++ b/infra/base-images/base-builder/Dockerfile @@ -29,6 +29,7 @@ RUN dpkg --add-architecture i386 && \ jq \ libc6-dev-i386 \ patchelf \ + rsync \ subversion \ zip @@ -57,12 +58,14 @@ RUN export PYTHON_DEPS="\ ln -s /usr/bin/python3 /usr/bin/python && \ cd .. && \ rm -r /tmp/Python-$PYTHON_VERSION.tar.xz /tmp/Python-$PYTHON_VERSION && \ - apt-get remove -y $PYTHON_DEPS # https://github.com/google/oss-fuzz/issues/3888 + rm -rf /usr/local/lib/python3.8/test && \ + apt-get remove -y $PYTHON_DEPS # https://github.com/google/oss-fuzz/issues/3888 # Install latest atheris for python fuzzing, pyinstaller for fuzzer packaging, # six for Bazel rules. -RUN unset CFLAGS CXXFLAGS && pip3 install -v \ - atheris pyinstaller==4.1 six==1.15.0 +RUN unset CFLAGS CXXFLAGS && pip3 install -v --no-cache-dir \ + atheris pyinstaller==4.1 six==1.15.0 && \ + rm -rf /tmp/* # Download and install the latest stable Go. RUN cd /tmp && \ @@ -87,15 +90,42 @@ ENV CARGO_HOME=/rust ENV RUSTUP_HOME=/rust/rustup ENV PATH=$PATH:/rust/bin RUN curl https://sh.rustup.rs | sh -s -- -y --default-toolchain=nightly --profile=minimal -RUN cargo install cargo-fuzz +RUN cargo install cargo-fuzz && rm -rf /rust/registry # Needed to recompile rust std library for MSAN RUN rustup component add rust-src --toolchain nightly +# Set up custom environment variable for source code copy for coverage reports +ENV OSSFUZZ_RUSTPATH /rust # Install Bazel through Bazelisk, which automatically fetches the latest Bazel version. ENV BAZELISK_VERSION 1.7.4 RUN curl -L https://github.com/bazelbuild/bazelisk/releases/download/v$BAZELISK_VERSION/bazelisk-linux-amd64 -o /usr/local/bin/bazel && \ chmod +x /usr/local/bin/bazel +# Install OpenJDK 15 and trim its size by removing unused components. +ENV JAVA_HOME=/usr/lib/jvm/java-15-openjdk-amd64 +ENV JVM_LD_LIBRARY_PATH=$JAVA_HOME/lib/server +ENV PATH=$PATH:$JAVA_HOME/bin +RUN cd /tmp && \ + curl -L -O https://download.java.net/java/GA/jdk15.0.2/0d1cfde4252546c6931946de8db48ee2/7/GPL/openjdk-15.0.2_linux-x64_bin.tar.gz && \ + mkdir -p $JAVA_HOME && \ + tar -xzv --strip-components=1 -f openjdk-15.0.2_linux-x64_bin.tar.gz --directory $JAVA_HOME && \ + rm -f openjdk-15.0.2_linux-x64_bin.tar.gz && \ + rm -rf $JAVA_HOME/jmods $JAVA_HOME/lib/src.zip + +# Install the latest Jazzer in $OUT. +# jazzer_api_deploy.jar is required only at build-time, the agent and the +# drivers are copied to $OUT as they need to be present on the runners. +ENV JAZZER_API_PATH "/usr/local/lib/jazzer_api_deploy.jar" +RUN cd $SRC/ && \ + git clone --depth=1 https://github.com/CodeIntelligenceTesting/jazzer && \ + cd jazzer && \ + bazel build --java_runtime_version=localjdk_15 -c opt --cxxopt="-stdlib=libc++" --linkopt=-lc++ \ + //agent:jazzer_agent_deploy.jar //driver:jazzer_driver //driver:jazzer_driver_asan //agent:jazzer_api_deploy.jar && \ + cp bazel-bin/agent/jazzer_agent_deploy.jar bazel-bin/driver/jazzer_driver bazel-bin/driver/jazzer_driver_asan /usr/local/bin/ && \ + cp bazel-bin/agent/jazzer_api_deploy.jar $JAZZER_API_PATH && \ + rm -rf ~/.cache/bazel ~/.cache/bazelisk && \ + rm -rf $SRC/jazzer + # Default build flags for various sanitizers. ENV SANITIZER_FLAGS_address "-fsanitize=address -fsanitize-address-use-after-scope" @@ -106,6 +136,8 @@ ENV SANITIZER_FLAGS_memory "-fsanitize=memory -fsanitize-memory-track-origins" ENV SANITIZER_FLAGS_dataflow "-fsanitize=dataflow" +ENV SANITIZER_FLAGS_thread "-fsanitize=thread" + # Do not use any sanitizers in the coverage build. ENV SANITIZER_FLAGS_coverage "" @@ -144,15 +176,12 @@ ENV LIB_FUZZING_ENGINE="/usr/lib/libFuzzingEngine.a" # TODO: remove after tpm2 catchup. ENV FUZZER_LDFLAGS "" -ENV PRECOMPILED_DIR="/usr/lib/precompiled" -RUN mkdir $PRECOMPILED_DIR - WORKDIR $SRC # TODO: switch to -b stable once we can. RUN git clone https://github.com/AFLplusplus/AFLplusplus.git aflplusplus && \ cd aflplusplus && \ - git checkout aeb7d7048371cd91ab9280c3958f1c35e5d5e758 + git checkout 2102264acf5c271b7560a82771b3af8136af9354 RUN cd $SRC && \ curl -L -O https://github.com/google/honggfuzz/archive/oss-fuzz.tar.gz && \ @@ -161,12 +190,14 @@ RUN cd $SRC && \ tar -xzv --strip-components=1 -f $SRC/oss-fuzz.tar.gz && \ rm -rf examples $SRC/oss-fuzz.tar.gz -COPY compile compile_afl compile_dataflow compile_libfuzzer compile_honggfuzz \ - compile_go_fuzzer precompile_honggfuzz srcmap write_labels.py /usr/local/bin/ +COPY cargo compile compile_afl compile_dataflow compile_libfuzzer compile_honggfuzz \ + compile_go_fuzzer precompile_honggfuzz precompile_afl debug_afl srcmap \ + write_labels.py bazel_build_fuzz_tests /usr/local/bin/ COPY detect_repo.py /opt/cifuzz/ COPY ossfuzz_coverage_runner.go $GOPATH RUN precompile_honggfuzz +RUN precompile_afl CMD ["compile"] |