diff --git a/projects/crosvm/Dockerfile b/projects/crosvm/Dockerfile new file mode 100644 index 000000000..3280aa7ab --- /dev/null +++ b/projects/crosvm/Dockerfile @@ -0,0 +1,26 @@ +# Copyright 2023 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-rust + +RUN git clone --depth=1 --recursive https://chromium.googlesource.com/crosvm/crosvm $SRC/crosvm + +RUN apt-get upgrade && apt-get install --yes --no-install-recommends \ + libclang-dev \ + pkg-config \ + libcap-dev + +COPY build.sh $SRC diff --git a/projects/crosvm/build.sh b/projects/crosvm/build.sh new file mode 100755 index 000000000..a2ad9d707 --- /dev/null +++ b/projects/crosvm/build.sh @@ -0,0 +1,33 @@ +#!/bin/bash -eu +# Copyright 2023 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. +# +################################################################################ + +cd crosvm + +# Build crosvm fuzzers +# Unset the SRC variable as it will interfere with minijail's common.mk framework. +env -u SRC cargo +nightly \ + fuzz build \ + -O \ + --fuzz-dir=crosvm-fuzz \ + --features upstream-fuzz + +# Copy fuzzer binaries to $OUT +FUZZ_TARGET_OUTPUT_DIR="target/x86_64-unknown-linux-gnu/release" +for f in crosvm-fuzz/*.rs; do + FUZZ_TARGET_NAME=$(basename ${f%.*}) + cp "${FUZZ_TARGET_OUTPUT_DIR}/crosvm_${FUZZ_TARGET_NAME}" "$OUT/" +done diff --git a/projects/crosvm/project.yaml b/projects/crosvm/project.yaml new file mode 100644 index 000000000..2f5384035 --- /dev/null +++ b/projects/crosvm/project.yaml @@ -0,0 +1,10 @@ +homepage: "http://crosvm.dev" +language: rust +primary_contact: "denniskempin@google.com" +auto_ccs: + - "crosvm-core@google.com" +main_repo: "https://chromium.googlesource.com/crosvm/crosvm" +sanitizers: + - address +fuzzing_engines: + - libfuzzer