diff --git a/projects/orbit/Dockerfile b/projects/orbit/Dockerfile new file mode 100644 index 000000000..58bb17022 --- /dev/null +++ b/projects/orbit/Dockerfile @@ -0,0 +1,31 @@ +# Copyright 2020 Google Inc. +# +# 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 -SL https://github.com/google/orbit/archive/master.tar.gz \ +FROM gcr.io/oss-fuzz-base/base-builder +RUN apt-get update && apt-get install -y m4 libglu1-mesa-dev mesa-common-dev \ + libxmu-dev libxi-dev pkg-config libxxf86vm-dev patchelf + +ADD https://github.com/google/orbit/archive/master.tar.gz $SRC/ +RUN mkdir -p $SRC/orbit && tar -xzf $SRC/master.tar.gz \ + -C $SRC/orbit/ --strip-components 1; rm -f $SRC/master.tar.gz +WORKDIR $SRC +COPY build.sh $SRC/ + +# That's a hack. The service needs to have a more recent kernel than what the +# container provides. But this code is not going to be called from the fuzz- +# tests, so we should be fine here. +ADD https://raw.githubusercontent.com/torvalds/linux/v5.7/include/linux/perf_event.h /usr/include/linux/perf_event.h diff --git a/projects/orbit/build.sh b/projects/orbit/build.sh new file mode 100755 index 000000000..794551ecd --- /dev/null +++ b/projects/orbit/build.sh @@ -0,0 +1,54 @@ +#!/bin/bash -eu +# Copyright 2020 Google Inc. +# +# 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. +# +################################################################################ + +#builds project +export PATH="/root/.local/bin:$PATH" +$SRC/orbit/bootstrap-orbit.sh --force-public-remotes --dont-compile --ignore-system-requirements + +conan profile new default --detect +conan profile update settings.compiler.libcxx=libc++ default +conan profile update settings.compiler.fpo=False default +conan profile update settings.compiler.address_sanitizer=True default +conan profile update settings.compiler.fuzzer_sanitizer=True default + +sed -i 's/\[settings\]/include(libfuzzer_base)\n\n[settings]/' ~/.conan/profiles/default +echo "CFLAGS=\$BASE_CFLAGS" >> ~/.conan/profiles/default +echo "CXXFLAGS=\$BASE_CXXFLAGS" >> ~/.conan/profiles/default +echo "LDFLAGS=\$BASE_LDFLAGS" >> ~/.conan/profiles/default +echo "OrbitProfiler:CFLAGS=\$BASE_CFLAGS $CFLAGS" >> ~/.conan/profiles/default +echo "OrbitProfiler:CXXFLAGS=\$BASE_CFLAGS $CXXFLAGS" >> ~/.conan/profiles/default +echo "llvm:CFLAGS=\$BASE_CFLAGS $CFLAGS" >> ~/.conan/profiles/default +echo "llvm:CXXFLAGS=\$BASE_CXXFLAGS $CXXFLAGS" >> ~/.conan/profiles/default + +$SRC/orbit/build.sh default + +function copy_fuzzer { + mkdir -p "$OUT/lib" + cp -v "$1" "$OUT/" + patchelf --set-rpath '$ORIGIN/lib' "$OUT/$(basename "$1")" + + ldd "$1" | grep '=>' | cut -d ' ' -f 3 | while read lib; do + if [[ -f $lib ]]; then + cp -v "$lib" "$OUT/lib/" + patchelf --set-rpath '$ORIGIN' "$OUT/lib/$(basename "$lib")" + fi + done +} + +find $SRC/build_default/bin -name \*Fuzzer | while read fuzzer; do + copy_fuzzer "$fuzzer" +done diff --git a/projects/orbit/project.yaml b/projects/orbit/project.yaml index b4efb732c..62ec85438 100644 --- a/projects/orbit/project.yaml +++ b/projects/orbit/project.yaml @@ -1,7 +1,7 @@ homepage: "https://github.com/google/orbit" language: c++ primary_contact: "hebecker@google.com" -auto_ccs : +auto_ccs: - "orbitprofiler-eng+fuzztests@google.com" fuzzing_engines: