diff options
28 files changed, 80 insertions, 30 deletions
diff --git a/infra/base-images/all.sh b/infra/base-images/all.sh index d191ecd6..71b7f919 100755 --- a/infra/base-images/all.sh +++ b/infra/base-images/all.sh @@ -19,9 +19,10 @@ docker build --pull -t gcr.io/oss-fuzz-base/base-image "$@" infra/base-images/ba docker build -t gcr.io/oss-fuzz-base/base-clang "$@" infra/base-images/base-clang docker build -t gcr.io/oss-fuzz-base/base-builder-new "$@" infra/base-images/base-builder-new docker build -t gcr.io/oss-fuzz-base/base-builder "$@" infra/base-images/base-builder -docker build -t gcr.io/oss-fuzz-base/base-builder-swift "$@" infra/base-images/base-builder-swift -docker build -t gcr.io/oss-fuzz-base/base-builder-python "$@" infra/base-images/base-builder-python docker build -t gcr.io/oss-fuzz-base/base-builder-go "$@" infra/base-images/base-builder-go docker build -t gcr.io/oss-fuzz-base/base-builder-jvm "$@" infra/base-images/base-builder-jvm +docker build -t gcr.io/oss-fuzz-base/base-builder-python "$@" infra/base-images/base-builder-python +docker build -t gcr.io/oss-fuzz-base/base-builder-rust "$@" infra/base-images/base-builder-rust +docker build -t gcr.io/oss-fuzz-base/base-builder-swift "$@" infra/base-images/base-builder-swift docker build -t gcr.io/oss-fuzz-base/base-runner "$@" infra/base-images/base-runner docker build -t gcr.io/oss-fuzz-base/base-runner-debug "$@" infra/base-images/base-runner-debug diff --git a/infra/base-images/base-builder-new/Dockerfile b/infra/base-images/base-builder-new/Dockerfile index 18ef55c9..40e6e4cf 100644 --- a/infra/base-images/base-builder-new/Dockerfile +++ b/infra/base-images/base-builder-new/Dockerfile @@ -146,9 +146,10 @@ COPY cargo compile compile_afl compile_dataflow compile_libfuzzer compile_honggf write_labels.py bazel_build_fuzz_tests \ # Go, java, and swift installation scripts. install_go.sh \ - install_swift.sh \ - install_python.sh \ install_java.sh \ + install_python.sh \ + install_rust.sh \ + install_swift.sh \ /usr/local/bin/ COPY llvmsymbol.diff $SRC diff --git a/infra/base-images/base-builder-new/install_rust.sh b/infra/base-images/base-builder-new/install_rust.sh new file mode 100644 index 00000000..cbb461fd --- /dev/null +++ b/infra/base-images/base-builder-new/install_rust.sh @@ -0,0 +1,21 @@ +#!/bin/bash -eux +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +################################################################################ + +curl https://sh.rustup.rs | sh -s -- -y --default-toolchain=nightly --profile=minimal +cargo install cargo-fuzz && rm -rf /rust/registry +# Needed to recompile rust std library for MSAN +rustup component add rust-src --toolchain nightly diff --git a/infra/base-images/base-builder-rust/Dockerfile b/infra/base-images/base-builder-rust/Dockerfile new file mode 100644 index 00000000..1d01a76a --- /dev/null +++ b/infra/base-images/base-builder-rust/Dockerfile @@ -0,0 +1,25 @@ +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +################################################################################ + +FROM gcr.io/oss-fuzz-base/base-builder-new + +ENV CARGO_HOME=/rust +ENV RUSTUP_HOME=/rust/rustup +ENV PATH=$PATH:/rust/bin +# Set up custom environment variable for source code copy for coverage reports +ENV OSSFUZZ_RUSTPATH /rust + +RUN install_rust.sh diff --git a/infra/build/functions/base_images.py b/infra/build/functions/base_images.py index f8ece3ac..1af250b7 100644 --- a/infra/build/functions/base_images.py +++ b/infra/build/functions/base_images.py @@ -25,9 +25,10 @@ BASE_IMAGES = [ 'base-clang', 'base-builder', 'base-builder-new', - 'base-builder-python', 'base-builder-go', 'base-builder-jvm', + 'base-builder-python', + 'base-builder-rust', 'base-builder-swift', 'base-runner', 'base-runner-debug', diff --git a/infra/helper.py b/infra/helper.py index e83655a2..ce0f572a 100755 --- a/infra/helper.py +++ b/infra/helper.py @@ -40,10 +40,11 @@ BASE_IMAGES = [ 'gcr.io/oss-fuzz-base/base-clang', 'gcr.io/oss-fuzz-base/base-builder', 'gcr.io/oss-fuzz-base/base-builder-new', - 'gcr.io/oss-fuzz-base/base-builder-swift', - 'gcr.io/oss-fuzz-base/base-builder-python', 'gcr.io/oss-fuzz-base/base-builder-go', 'gcr.io/oss-fuzz-base/base-builder-jvm', + 'gcr.io/oss-fuzz-base/base-builder-python', + 'gcr.io/oss-fuzz-base/base-builder-rust', + 'gcr.io/oss-fuzz-base/base-builder-swift', 'gcr.io/oss-fuzz-base/base-runner', 'gcr.io/oss-fuzz-base/base-runner-debug', 'gcr.io/oss-fuzz-base/base-sanitizer-libs-builder', @@ -64,7 +65,7 @@ PROJECT_LANGUAGE_REGEX = re.compile(r'\s*language\s*:\s*([^\s]+)') WORKDIR_REGEX = re.compile(r'\s*WORKDIR\s*([^\s]+)') -LANGUAGES_WITH_BUILDER_IMAGES = {'swift', 'python', 'jvm', 'go'} +LANGUAGES_WITH_BUILDER_IMAGES = {'go', 'jvm', 'python', 'rust', 'swift'} if sys.version_info[0] >= 3: raw_input = input # pylint: disable=invalid-name diff --git a/projects/flate2-rs/Dockerfile b/projects/flate2-rs/Dockerfile index 6ee3f320..1309ff0f 100644 --- a/projects/flate2-rs/Dockerfile +++ b/projects/flate2-rs/Dockerfile @@ -12,7 +12,7 @@ # limitations under the License. # ################################################################################ -FROM gcr.io/oss-fuzz-base/base-builder +FROM gcr.io/oss-fuzz-base/base-builder-rust RUN git clone --depth 1 https://github.com/rust-lang/flate2-rs WORKDIR $SRC diff --git a/projects/httparse/Dockerfile b/projects/httparse/Dockerfile index cffcc9f1..9b7b3208 100644 --- a/projects/httparse/Dockerfile +++ b/projects/httparse/Dockerfile @@ -13,7 +13,7 @@ # limitations under the License. # ################################################################################ -FROM gcr.io/oss-fuzz-base/base-builder +FROM gcr.io/oss-fuzz-base/base-builder-rust RUN git clone https://github.com/seanmonstar/httparse WORKDIR $SRC diff --git a/projects/hyperium/Dockerfile b/projects/hyperium/Dockerfile index ffd6e88d..41930235 100644 --- a/projects/hyperium/Dockerfile +++ b/projects/hyperium/Dockerfile @@ -13,7 +13,7 @@ # limitations under the License. # ################################################################################ -FROM gcr.io/oss-fuzz-base/base-builder +FROM gcr.io/oss-fuzz-base/base-builder-rust RUN git clone https://github.com/hyperium/http RUN git clone https://github.com/hyperium/h2 diff --git a/projects/image-png/Dockerfile b/projects/image-png/Dockerfile index eb3ce102..48be6768 100644 --- a/projects/image-png/Dockerfile +++ b/projects/image-png/Dockerfile @@ -13,7 +13,7 @@ # limitations under the License. # ################################################################################ -FROM gcr.io/oss-fuzz-base/base-builder +FROM gcr.io/oss-fuzz-base/base-builder-rust RUN apt-get update && apt-get install -y make autoconf automake libtool curl cmake python llvm-dev libclang-dev clang RUN git clone https://github.com/image-rs/image-png diff --git a/projects/image-rs/Dockerfile b/projects/image-rs/Dockerfile index 254e7e55..636bc2b3 100644 --- a/projects/image-rs/Dockerfile +++ b/projects/image-rs/Dockerfile @@ -13,7 +13,7 @@ # limitations under the License. # ################################################################################ -FROM gcr.io/oss-fuzz-base/base-builder +FROM gcr.io/oss-fuzz-base/base-builder-rust RUN git clone https://github.com/image-rs/image WORKDIR $SRC/image diff --git a/projects/json5format/Dockerfile b/projects/json5format/Dockerfile index c0117a59..64c8793c 100644 --- a/projects/json5format/Dockerfile +++ b/projects/json5format/Dockerfile @@ -13,7 +13,7 @@ # limitations under the License. # ################################################################################ -FROM gcr.io/oss-fuzz-base/base-builder +FROM gcr.io/oss-fuzz-base/base-builder-rust RUN git clone --depth 1 https://github.com/google/json5format WORKDIR $SRC diff --git a/projects/libra/Dockerfile b/projects/libra/Dockerfile index 426e5479..cc541e3a 100644 --- a/projects/libra/Dockerfile +++ b/projects/libra/Dockerfile @@ -15,7 +15,7 @@ ################################################################################ # google oss-fuzz stuff -FROM gcr.io/oss-fuzz-base/base-builder +FROM gcr.io/oss-fuzz-base/base-builder-rust # install other tools we might need RUN apt-get update && apt-get install -y cmake curl diff --git a/projects/linkerd2-proxy/Dockerfile b/projects/linkerd2-proxy/Dockerfile index b5497da7..1abb1d4f 100644 --- a/projects/linkerd2-proxy/Dockerfile +++ b/projects/linkerd2-proxy/Dockerfile @@ -14,7 +14,7 @@ # ################################################################################ -FROM gcr.io/oss-fuzz-base/base-builder +FROM gcr.io/oss-fuzz-base/base-builder-rust RUN git clone --depth 1 https://github.com/linkerd/linkerd2-proxy COPY build.sh $SRC/ diff --git a/projects/mp4parse-rust/Dockerfile b/projects/mp4parse-rust/Dockerfile index 990fbbaf..f974759f 100644 --- a/projects/mp4parse-rust/Dockerfile +++ b/projects/mp4parse-rust/Dockerfile @@ -14,7 +14,7 @@ # ################################################################################ -FROM gcr.io/oss-fuzz-base/base-builder +FROM gcr.io/oss-fuzz-base/base-builder-rust RUN apt-get update && apt-get install -y make autoconf automake libtool curl cmake python llvm-dev libclang-dev clang RUN git clone --depth 1 --recursive https://github.com/mozilla/mp4parse-rust mp4parse-rust diff --git a/projects/nom/Dockerfile b/projects/nom/Dockerfile index 167550e3..793d785e 100644 --- a/projects/nom/Dockerfile +++ b/projects/nom/Dockerfile @@ -13,7 +13,7 @@ # limitations under the License. # ################################################################################ -FROM gcr.io/oss-fuzz-base/base-builder +FROM gcr.io/oss-fuzz-base/base-builder-rust RUN git clone --depth 1 https://github.com/Geal/nom/ WORKDIR $SRC diff --git a/projects/oak/Dockerfile b/projects/oak/Dockerfile index d311c02e..16f77413 100644 --- a/projects/oak/Dockerfile +++ b/projects/oak/Dockerfile @@ -14,7 +14,7 @@ # ################################################################################ -FROM gcr.io/oss-fuzz-base/base-builder +FROM gcr.io/oss-fuzz-base/base-builder-rust RUN apt-get --yes update \ && apt-get install --no-install-recommends --yes \ diff --git a/projects/opensk/Dockerfile b/projects/opensk/Dockerfile index d914bd23..d24d28d7 100644 --- a/projects/opensk/Dockerfile +++ b/projects/opensk/Dockerfile @@ -13,7 +13,7 @@ # limitations under the License. # ################################################################################ -FROM gcr.io/oss-fuzz-base/base-builder +FROM gcr.io/oss-fuzz-base/base-builder-rust RUN apt-get update && apt-get install -y make autoconf automake libtool curl cmake python llvm-dev libclang-dev clang uuid-runtime RUN git clone --depth=1 --branch=develop https://github.com/google/OpenSK && \ diff --git a/projects/prost/Dockerfile b/projects/prost/Dockerfile index 6d13ecf0..d340fe5f 100644 --- a/projects/prost/Dockerfile +++ b/projects/prost/Dockerfile @@ -12,7 +12,7 @@ # limitations under the License. # ################################################################################ -FROM gcr.io/oss-fuzz-base/base-builder +FROM gcr.io/oss-fuzz-base/base-builder-rust RUN apt-get update && apt-get install -y pkg-config libssl-dev curl libcurl4-openssl-dev ninja-build RUN git clone --depth 1 https://github.com/danburkert/prost WORKDIR $SRC diff --git a/projects/qcms/Dockerfile b/projects/qcms/Dockerfile index c124a14a..922eac69 100644 --- a/projects/qcms/Dockerfile +++ b/projects/qcms/Dockerfile @@ -14,7 +14,7 @@ # ################################################################################ -FROM gcr.io/oss-fuzz-base/base-builder +FROM gcr.io/oss-fuzz-base/base-builder-rust RUN apt-get update && apt-get install -y mercurial RUN hg clone --uncompressed https://hg.mozilla.org/mozilla-central/ COPY build.sh $SRC/ diff --git a/projects/quick-xml/Dockerfile b/projects/quick-xml/Dockerfile index 843c3c8f..43995b86 100644 --- a/projects/quick-xml/Dockerfile +++ b/projects/quick-xml/Dockerfile @@ -13,7 +13,7 @@ # limitations under the License. # ################################################################################ -FROM gcr.io/oss-fuzz-base/base-builder +FROM gcr.io/oss-fuzz-base/base-builder-rust RUN git clone --depth 1 https://github.com/tafia/quick-xml COPY fuzz_target_1.rs $SRC/quick-xml/fuzz/fuzz_targets/fuzz_target_1.rs diff --git a/projects/rust-regex/Dockerfile b/projects/rust-regex/Dockerfile index c64a6a1e..e1b5b40d 100644 --- a/projects/rust-regex/Dockerfile +++ b/projects/rust-regex/Dockerfile @@ -13,7 +13,7 @@ # limitations under the License. # ################################################################################ -FROM gcr.io/oss-fuzz-base/base-builder +FROM gcr.io/oss-fuzz-base/base-builder-rust RUN git clone --depth 1 https://github.com/rust-lang/regex regex WORKDIR $SRC diff --git a/projects/rustls/Dockerfile b/projects/rustls/Dockerfile index f6cc44a9..361e30a3 100644 --- a/projects/rustls/Dockerfile +++ b/projects/rustls/Dockerfile @@ -14,7 +14,7 @@ # ################################################################################ -FROM gcr.io/oss-fuzz-base/base-builder +FROM gcr.io/oss-fuzz-base/base-builder-rust RUN apt-get update && apt-get install -y make autoconf automake libtool curl cmake python llvm-dev libclang-dev clang RUN git clone https://github.com/ctz/rustls diff --git a/projects/serde-yaml/Dockerfile b/projects/serde-yaml/Dockerfile index 42b1ce38..216394c7 100644 --- a/projects/serde-yaml/Dockerfile +++ b/projects/serde-yaml/Dockerfile @@ -13,7 +13,7 @@ # limitations under the License. # ################################################################################ -FROM gcr.io/oss-fuzz-base/base-builder +FROM gcr.io/oss-fuzz-base/base-builder-rust RUN git clone --depth 1 https://github.com/dtolnay/serde-yaml serde-yaml WORKDIR $SRC diff --git a/projects/serde_json/Dockerfile b/projects/serde_json/Dockerfile index d27ebda2..395b8971 100644 --- a/projects/serde_json/Dockerfile +++ b/projects/serde_json/Dockerfile @@ -13,7 +13,7 @@ # limitations under the License. # ################################################################################ -FROM gcr.io/oss-fuzz-base/base-builder +FROM gcr.io/oss-fuzz-base/base-builder-rust RUN apt-get update && apt-get install -y make autoconf automake libtool curl cmake python llvm-dev libclang-dev clang RUN git clone --depth 1 https://github.com/serde-rs/json json diff --git a/projects/servo/Dockerfile b/projects/servo/Dockerfile index a0e081d0..6fbeef8a 100644 --- a/projects/servo/Dockerfile +++ b/projects/servo/Dockerfile @@ -13,7 +13,7 @@ # limitations under the License. # ################################################################################ -FROM gcr.io/oss-fuzz-base/base-builder +FROM gcr.io/oss-fuzz-base/base-builder-rust RUN git clone --depth 1 https://github.com/servo/html5ever RUN git clone --depth 1 https://github.com/servo/rust-url diff --git a/projects/unicode-rs/Dockerfile b/projects/unicode-rs/Dockerfile index 13852620..9d9cc476 100644 --- a/projects/unicode-rs/Dockerfile +++ b/projects/unicode-rs/Dockerfile @@ -13,7 +13,7 @@ # limitations under the License. # ################################################################################ -FROM gcr.io/oss-fuzz-base/base-builder +FROM gcr.io/oss-fuzz-base/base-builder-rust RUN git clone --depth 1 https://github.com/unicode-rs/unicode-normalization RUN git clone --depth 1 https://github.com/unicode-rs/unicode-segmentation diff --git a/projects/wasmtime/Dockerfile b/projects/wasmtime/Dockerfile index ea72bfb3..fe6c8dd3 100644 --- a/projects/wasmtime/Dockerfile +++ b/projects/wasmtime/Dockerfile @@ -14,7 +14,7 @@ # ################################################################################ -FROM gcr.io/oss-fuzz-base/base-builder +FROM gcr.io/oss-fuzz-base/base-builder-rust RUN apt-get update && apt-get install -y make autoconf automake libtool curl cmake python llvm-dev libclang-dev clang # Install a newer version of OCaml than provided by Ubuntu 16.04 (base version for this image) |