diff options
author | Tonko SabolĨec <tsabolcec@google.com> | 2021-06-01 18:59:42 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-01 16:59:42 +0000 |
commit | 4fb4850860b5caf02ab7b964ef83ba3a9f238408 (patch) | |
tree | 0c57cd954224d01a67d0be3a6b13e6a50e2983ae /projects/lldb-eval | |
parent | 69287c7485979813e348100a85d8bbe12e9ad406 (diff) | |
download | oss-fuzz-4fb4850860b5caf02ab7b964ef83ba3a9f238408.tar.gz |
[lldb-eval] Initial integration (#5831)
* [lldb-eval] Initial integration
* Update project.yaml
* Add missing license headers
* Update Dockerfile
* Update build.sh
* Update project.yaml
* Use prebuilt LLVM, Clang and LLDB libraries
Co-authored-by: jonathanmetzman <31354670+jonathanmetzman@users.noreply.github.com>
Diffstat (limited to 'projects/lldb-eval')
-rw-r--r-- | projects/lldb-eval/Dockerfile | 26 | ||||
-rw-r--r-- | projects/lldb-eval/build.sh | 61 | ||||
-rw-r--r-- | projects/lldb-eval/project.yaml | 10 |
3 files changed, 97 insertions, 0 deletions
diff --git a/projects/lldb-eval/Dockerfile b/projects/lldb-eval/Dockerfile new file mode 100644 index 000000000..15e5bab6f --- /dev/null +++ b/projects/lldb-eval/Dockerfile @@ -0,0 +1,26 @@ +# 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 + +RUN apt-get update \ + && apt-get install -y wget git patchelf zlib1g-dev libtinfo-dev --no-install-recommends + +RUN git clone --depth 1 https://github.com/google/lldb-eval + +COPY build.sh $SRC/ + +WORKDIR $SRC/lldb-eval diff --git a/projects/lldb-eval/build.sh b/projects/lldb-eval/build.sh new file mode 100644 index 000000000..888bb9a3d --- /dev/null +++ b/projects/lldb-eval/build.sh @@ -0,0 +1,61 @@ +#!/bin/bash +# 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. +# +################################################################################ + +( +cd $SRC/ +GITHUB_RELEASE="https://github.com/google/lldb-eval/releases/download/oss-fuzz-llvm-11" + +wget --quiet --show-progress $GITHUB_RELEASE/llvm-11.1.0-source.tar.gz +tar -xzf llvm-11.1.0-source.tar.gz + +wget --quiet --show-progress $GITHUB_RELEASE/llvm-11.1.0-x86_64-linux-release-genfiles.tar.gz +tar -xzf llvm-11.1.0-x86_64-linux-release-genfiles.tar.gz + +if [ "$SANITIZER" = "address" ] +then + LLVM_ARCHIVE="llvm-11.1.0-x86_64-linux-release-address.tar.gz" +else + LLVM_ARCHIVE="llvm-11.1.0-x86_64-linux-release-coverage.tar.gz" +fi + +wget --quiet --show-progress $GITHUB_RELEASE/$LLVM_ARCHIVE +mkdir -p llvm && tar -xzf $LLVM_ARCHIVE --strip-components 1 -C llvm +) +export LLVM_INSTALL_PATH=$SRC/llvm + +# Run the build! +bazel_build_fuzz_tests + +# OSS-Fuzz rule doesn't build data dependencies +bazel build //testdata:fuzzer_binary_gen + +# OSS-Fuzz rule doesn't package runfiles yet: +# https://github.com/bazelbuild/rules_fuzzing/issues/100 +mkdir -p $OUT/lldb_eval_libfuzzer_test.runfiles +# fuzzer_binary +mkdir -p $OUT/lldb_eval_libfuzzer_test.runfiles/lldb_eval/testdata +cp $SRC/lldb-eval/bazel-bin/testdata/fuzzer_binary $OUT/lldb_eval_libfuzzer_test.runfiles/lldb_eval/testdata/ +cp $SRC/lldb-eval/testdata/fuzzer_binary.cc $OUT/lldb_eval_libfuzzer_test.runfiles/lldb_eval/testdata/ +# lldb-server +mkdir -p $OUT/lldb_eval_libfuzzer_test.runfiles/llvm_project/bin +cp $SRC/llvm/bin/lldb-server $OUT/lldb_eval_libfuzzer_test.runfiles/llvm_project/bin/lldb-server + +# OSS-Fuzz rule doesn't handle dynamic dependencies +# Copy liblldb.so and path RPATH of the fuzz target +mkdir -p $OUT/lib +cp -a $SRC/llvm/lib/liblldb.so* $OUT/lib +patchelf --set-rpath '$ORIGIN/lib' $OUT/lldb_eval_libfuzzer_test diff --git a/projects/lldb-eval/project.yaml b/projects/lldb-eval/project.yaml new file mode 100644 index 000000000..63969bc62 --- /dev/null +++ b/projects/lldb-eval/project.yaml @@ -0,0 +1,10 @@ +homepage: "https://github.com/google/lldb-eval" +main_repo: "https://github.com/google/lldb-eval" +language: c++ +primary_contact: "werat@google.com" +auto_ccs: + - "tsabolcec@google.com" +fuzzing_engines: + - libfuzzer +sanitizers: + - address |