From 91aaa43e4ebbf18b95017f8a28361c89b15c9de8 Mon Sep 17 00:00:00 2001 From: Dennis Kempin Date: Fri, 12 May 2023 13:31:45 -0700 Subject: [PATCH] New project: crosvm (#10284) crosvm fuzzing is currently running as part of ChromeOS infra, where the project originated. Crosvm has since become an independent project with separate infrastructure and we would like to move fuzzing out of ChromeOS as well. Tested with `python3 infra/helper.py check_build crosvm` --------- Co-authored-by: jonathanmetzman <31354670+jonathanmetzman@users.noreply.github.com> --- projects/crosvm/Dockerfile | 26 ++++++++++++++++++++++++++ projects/crosvm/build.sh | 33 +++++++++++++++++++++++++++++++++ projects/crosvm/project.yaml | 10 ++++++++++ 3 files changed, 69 insertions(+) create mode 100644 projects/crosvm/Dockerfile create mode 100755 projects/crosvm/build.sh create mode 100644 projects/crosvm/project.yaml 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