aboutsummaryrefslogtreecommitdiffhomepage
path: root/projects
diff options
context:
space:
mode:
authorGravatar MarcoFalke <falke.marco@gmail.com>2021-05-22 17:11:19 +0200
committerGravatar GitHub <noreply@github.com>2021-05-22 16:11:19 +0100
commit2c1c3c006c95ff055e55a2e96e8ca51b9934022e (patch)
tree7c1f1a6ca597b98525feaa3d32d5e17b97f37620 /projects
parent1f096f75e8859b268d8bafa77ad025d736d2885f (diff)
bitcoin-core: Build with msan (#5815)
* bitcoin-core: Add missing newline at end of file build.sh * bitcoin-core: Run zip in parallel * bitcoin-core: Build with msan
Diffstat (limited to 'projects')
-rw-r--r--projects/bitcoin-core/Dockerfile3
-rwxr-xr-xprojects/bitcoin-core/build.sh23
-rw-r--r--projects/bitcoin-core/project.yaml1
3 files changed, 22 insertions, 5 deletions
diff --git a/projects/bitcoin-core/Dockerfile b/projects/bitcoin-core/Dockerfile
index 8556c892..35e304ce 100644
--- a/projects/bitcoin-core/Dockerfile
+++ b/projects/bitcoin-core/Dockerfile
@@ -22,8 +22,7 @@ FROM gcr.io/oss-fuzz-base/base-builder
RUN apt-get update && apt-get install -y \
build-essential libtool autotools-dev automake pkg-config bsdmainutils python3 \
make automake cmake curl g++-multilib libtool binutils-gold bsdmainutils pkg-config patch bison \
- wget \
- zip
+ wget zip parallel
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
diff --git a/projects/bitcoin-core/build.sh b/projects/bitcoin-core/build.sh
index f2a2cb0d..d99447d4 100755
--- a/projects/bitcoin-core/build.sh
+++ b/projects/bitcoin-core/build.sh
@@ -47,7 +47,21 @@ sed -i "s|PROVIDE_FUZZ_MAIN_FUNCTION|NEVER_PROVIDE_MAIN_FOR_OSS_FUZZ|g" "./confi
# 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 SANITIZER_LDFLAGS="$LIB_FUZZING_ENGINE"
+if [ "$SANITIZER" = "memory" ]; then
+ CONFIG_SITE="$PWD/depends/$BUILD_TRIPLET/share/config.site" ./configure --enable-fuzz SANITIZER_LDFLAGS="$LIB_FUZZING_ENGINE" --with-asm=no
+else
+ CONFIG_SITE="$PWD/depends/$BUILD_TRIPLET/share/config.site" ./configure --enable-fuzz SANITIZER_LDFLAGS="$LIB_FUZZING_ENGINE"
+fi
+
+
+if [ "$SANITIZER" = "memory" ]; then
+ # MemorySanitizer (MSAN) does not support tracking memory initialization done by
+ # using the Linux getrandom syscall. Avoid using getrandom by undefining
+ # HAVE_SYS_GETRANDOM. See https://github.com/google/sanitizers/issues/852 for
+ # details.
+ grep -v HAVE_SYS_GETRANDOM src/config/bitcoin-config.h > src/config/bitcoin-config.h.tmp
+ mv src/config/bitcoin-config.h.tmp src/config/bitcoin-config.h
+fi
make -j$(nproc)
@@ -69,6 +83,9 @@ for fuzz_target in ${FUZZ_TARGETS[@]}; do
chmod +x "$OUT/$fuzz_target"
(
cd assets/fuzz_seed_corpus
- zip --recurse-paths --quiet --junk-paths "$OUT/${fuzz_target}_seed_corpus.zip" "${fuzz_target}"
+ if [ -d "$fuzz_target" ]; then
+ sem -j+0 zip --recurse-paths --quiet --junk-paths "$OUT/${fuzz_target}_seed_corpus.zip" "${fuzz_target}"
+ fi
)
-done \ No newline at end of file
+done
+sem --wait
diff --git a/projects/bitcoin-core/project.yaml b/projects/bitcoin-core/project.yaml
index e81cb8a1..9d6f3366 100644
--- a/projects/bitcoin-core/project.yaml
+++ b/projects/bitcoin-core/project.yaml
@@ -12,6 +12,7 @@ auto_ccs:
sanitizers:
- address
- undefined
+ - memory
architectures:
- x86_64
- i386