Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bitcoin-core] Initial integration #5699

Merged
merged 1 commit into from
May 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
31 changes: 31 additions & 0 deletions projects/bitcoin-core/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# 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

# Packages taken from:
# * https://github.com/bitcoin/bitcoin/blob/master/doc/build-unix.md#dependency-build-instructions
# * https://github.com/bitcoin/bitcoin/blob/master/depends/README.md#for-linux-including-i386-arm-cross-compilation
RUN apt-get update && apt-get install -y \
build-essential libtool autotools-dev automake pkg-config bsdmainutils python3 \
maflcko marked this conversation as resolved.
Show resolved Hide resolved
make automake cmake curl g++-multilib libtool binutils-gold bsdmainutils pkg-config patch bison \
wget \
zip

RUN git clone --depth=1 https://github.com/bitcoin/bitcoin.git bitcoin-core
RUN git clone --depth=1 https://github.com/bitcoin-core/qa-assets bitcoin-core/assets
WORKDIR bitcoin-core
COPY build.sh $SRC/
56 changes: 56 additions & 0 deletions projects/bitcoin-core/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/bin/bash -eu
# 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.
#
################################################################################

# Temporary workaround for https://github.com/google/oss-fuzz/issues/5697
wget https://github.com/bitcoin/bitcoin/commit/0be1cb158899374722961b844f9f4b0dc5f8558b.patch
( patch -p1 < ./*.patch ) || true

# Build dependencies
# This will also force static builds
if [ "$ARCHITECTURE" = "i386" ]; then
export BUILD_TRIPLET="i686-pc-linux-gnu"
else
export BUILD_TRIPLET="x86_64-pc-linux-gnu"
fi
(
cd depends
make HOST=$BUILD_TRIPLET DEBUG=1 NO_QT=1 NO_WALLET=1 NO_ZMQ=1 NO_UPNP=1 NO_NATPMP=1 -j$(nproc)
)

# Build the fuzz targets

./autogen.sh

# Limit to one target as temporary workaround for https://github.com/google/oss-fuzz/pull/5699#issuecomment-831030305
export ONLY_ONE_TARGET="process_messages"
sed -i "s|std::getenv(\"FUZZ\")|\"$ONLY_ONE_TARGET\"|g" "./src/test/fuzz/fuzz.cpp"

# OSS-Fuzz will provide CC, CXX, etc. So only set:
# * --enable-fuzz, see https://github.com/bitcoin/bitcoin/blob/master/doc/fuzzing.md
# * CONFIG_SITE, see https://github.com/bitcoin/bitcoin/blob/master/depends/README.md
CONFIG_SITE="$PWD/depends/$BUILD_TRIPLET/share/config.site" ./configure --enable-fuzz --with-sanitizers=fuzzer

make -j$(nproc)

mv ./src/test/fuzz/fuzz $OUT/$ONLY_ONE_TARGET

(
cd assets/fuzz_seed_corpus
for folder in ./${ONLY_ONE_TARGET}*; do
zip --recurse-paths --quiet --junk-paths "$OUT/${folder}_seed_corpus.zip" "${folder}"
done
)
18 changes: 18 additions & 0 deletions projects/bitcoin-core/project.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
homepage: "https://github.com/bitcoin/bitcoin"
main_repo: 'https://github.com/bitcoin/bitcoin.git'
language: c++
primary_contact: "marco@chaincode.com"
maflcko marked this conversation as resolved.
Show resolved Hide resolved
auto_ccs:
- "fanquake@gmail.com"
- "john@brink.dev"
- "jonas@chaincode.com"
- "laanwj@gmail.com"
- "pieter@chaincode.com"
maflcko marked this conversation as resolved.
Show resolved Hide resolved
- "thomas.j.bitcoin@protonmail.com"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noting that one needs to use a Google account to get full access to crash reports and fuzzer statistics [source].

sanitizers:
- address
maflcko marked this conversation as resolved.
Show resolved Hide resolved
- undefined
architectures:
- x86_64
fuzzing_engines:
- libfuzzer