Skip to content

Commit 1ba5583

Browse files
author
MarcoFalke
committed
Merge #14252: build: Run functional tests and benchmarks under the undefined behaviour sanitizer (UBSan)
9f49db7 Enable functional tests in UBSAN job. Enable -fsanitize=integer (part of UBSAN). Merge UBSAN Travis job with no depends. (practicalswift) Pull request description: Run functional tests and benchmarks under the undefined behaviour sanitizer (UBSan). This will make Travis automatically detect issues such as: * #14242: Avoid triggering undefined behaviour (`std::memset(nullptr, 0, 0)`) if an invalid string is passed to `DecodeSecret(...)` * #14239: Avoid dividing by zero (undefined behaviour) in `EstimateMedianVal` (policy)/`ConnectTip` (validation)/`CreateTransaction` (wallet) * #13546: wallet: Avoid potential use of uninitialized value `bnb_used` in `CWallet::CreateTransaction(...)` Addresses issue #14059. Tree-SHA512: 285e1542b36c582516c47938ce8d999fd89ba6c867bc0976e7306e7c949b8b84ffbfa43dbc679dd97ae639b086092e7d799d8e1c903c66a37d529ce61d5c64b4
2 parents 9c3f6c5 + 9f49db7 commit 1ba5583

File tree

3 files changed

+31
-12
lines changed

3 files changed

+31
-12
lines changed

.travis.yml

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -103,23 +103,14 @@ jobs:
103103
NO_DEPENDS=1
104104
GOAL="install"
105105
BITCOIN_CONFIG="--enable-zmq --with-incompatible-bdb --enable-glibc-back-compat --enable-reduce-exports --with-gui=qt5 CPPFLAGS=-DDEBUG_LOCKORDER"
106-
# x86_64 Linux (no depends, only system libs)
107-
- stage: test
108-
env: >-
109-
HOST=x86_64-unknown-linux-gnu
110-
PACKAGES="python3-zmq qtbase5-dev qttools5-dev-tools libssl1.0-dev libevent-dev bsdmainutils libboost-system-dev libboost-filesystem-dev libboost-chrono-dev libboost-test-dev libboost-thread-dev libdb5.3++-dev libminiupnpc-dev libzmq3-dev libprotobuf-dev protobuf-compiler libqrencode-dev"
111-
NO_DEPENDS=1
112-
GOAL="install"
113-
BITCOIN_CONFIG="--enable-zmq --with-incompatible-bdb --enable-glibc-back-compat --enable-reduce-exports --with-gui=qt5 CPPFLAGS=-DDEBUG_LOCKORDER"
114-
# x86_64 Linux (sanitizers)
106+
# x86_64 Linux (no depends, only system libs, sanitizers: undefined (UBSAN) + integer)
115107
- stage: test
116108
env: >-
117109
HOST=x86_64-unknown-linux-gnu
118110
PACKAGES="clang python3-zmq qtbase5-dev qttools5-dev-tools libssl1.0-dev libevent-dev bsdmainutils libboost-system-dev libboost-filesystem-dev libboost-chrono-dev libboost-test-dev libboost-thread-dev libdb5.3++-dev libminiupnpc-dev libzmq3-dev libprotobuf-dev protobuf-compiler libqrencode-dev"
119111
NO_DEPENDS=1
120-
RUN_FUNCTIONAL_TESTS=false # Disabled for now, can be combined with the other x86_64 linux NO_DEPENDS job when functional tests pass the sanitizers
121112
GOAL="install"
122-
BITCOIN_CONFIG="--enable-zmq --with-incompatible-bdb --enable-glibc-back-compat --enable-reduce-exports --with-gui=qt5 CPPFLAGS=-DDEBUG_LOCKORDER --with-sanitizers=undefined CC=clang CXX=clang++"
113+
BITCOIN_CONFIG="--enable-zmq --with-incompatible-bdb --enable-glibc-back-compat --enable-reduce-exports --with-gui=qt5 CPPFLAGS=-DDEBUG_LOCKORDER --with-sanitizers=integer,undefined CC=clang CXX=clang++"
123114
# x86_64 Linux, No wallet
124115
- stage: test
125116
env: >-

.travis/test_04_install.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
export LC_ALL=C.UTF-8
88

99
travis_retry docker pull "$DOCKER_NAME_TAG"
10-
env | grep -E '^(CCACHE_|WINEDEBUG|LC_ALL|BOOST_TEST_RANDOM|CONFIG_SHELL)' | tee /tmp/env
10+
export UBSAN_OPTIONS="suppressions=${TRAVIS_BUILD_DIR}/contrib/sanitizers-ubsan.suppressions"
11+
env | grep -E '^(CCACHE_|WINEDEBUG|LC_ALL|BOOST_TEST_RANDOM|CONFIG_SHELL|UBSAN_OPTIONS)' | tee /tmp/env
1112
if [[ $HOST = *-mingw32 ]]; then
1213
DOCKER_ADMIN="--cap-add SYS_ADMIN"
1314
fi

contrib/sanitizers-ubsan.suppressions

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
alignment:move.h
2+
alignment:prevector.h
3+
bool:wallet/wallet.cpp
4+
float-divide-by-zero:policy/fees.cpp
5+
float-divide-by-zero:validation.cpp
6+
float-divide-by-zero:wallet/wallet.cpp
7+
nonnull-attribute:support/cleanse.cpp
8+
unsigned-integer-overflow:basic_string.h
9+
unsigned-integer-overflow:bench/bench.h
10+
unsigned-integer-overflow:bloom.cpp
11+
unsigned-integer-overflow:chain.h
12+
unsigned-integer-overflow:crypto/chacha20.cpp
13+
unsigned-integer-overflow:crypto/ctaes/ctaes.c
14+
unsigned-integer-overflow:crypto/ripemd160.cpp
15+
unsigned-integer-overflow:crypto/sha1.cpp
16+
unsigned-integer-overflow:crypto/sha256.cpp
17+
unsigned-integer-overflow:crypto/sha512.cpp
18+
unsigned-integer-overflow:hash.cpp
19+
unsigned-integer-overflow:leveldb/db/log_reader.cc
20+
unsigned-integer-overflow:leveldb/util/bloom.cc
21+
unsigned-integer-overflow:leveldb/util/crc32c.h
22+
unsigned-integer-overflow:leveldb/util/hash.cc
23+
unsigned-integer-overflow:policy/fees.cpp
24+
unsigned-integer-overflow:script/interpreter.cpp
25+
unsigned-integer-overflow:stl_bvector.h
26+
unsigned-integer-overflow:txmempool.cpp
27+
unsigned-integer-overflow:validation.cpp

0 commit comments

Comments
 (0)