aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2018-11-05 14:49:38 -0500
committerMarcoFalke <falke.marco@gmail.com>2018-11-05 14:49:44 -0500
commit1ba5583646e3a64ebae4fcda3c498292998a6d5d (patch)
treee4fc95848304756edb58461ac2d60213448a92fd
parent9c3f6c5fad27b4516f0c144880f4c6c27faf835e (diff)
parent9f49db7335cbcd9d3c726d965604ff3316bc38e5 (diff)
downloadbitcoin-1ba5583646e3a64ebae4fcda3c498292998a6d5d.tar.xz
Merge #14252: build: Run functional tests and benchmarks under the undefined behaviour sanitizer (UBSan)
9f49db7335 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
-rw-r--r--.travis.yml13
-rwxr-xr-x.travis/test_04_install.sh3
-rw-r--r--contrib/sanitizers-ubsan.suppressions27
3 files changed, 31 insertions, 12 deletions
diff --git a/.travis.yml b/.travis.yml
index 0e1f76e56d..e221537d5f 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -103,23 +103,14 @@ jobs:
NO_DEPENDS=1
GOAL="install"
BITCOIN_CONFIG="--enable-zmq --with-incompatible-bdb --enable-glibc-back-compat --enable-reduce-exports --with-gui=qt5 CPPFLAGS=-DDEBUG_LOCKORDER"
-# x86_64 Linux (no depends, only system libs)
- - stage: test
- env: >-
- HOST=x86_64-unknown-linux-gnu
- 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"
- NO_DEPENDS=1
- GOAL="install"
- BITCOIN_CONFIG="--enable-zmq --with-incompatible-bdb --enable-glibc-back-compat --enable-reduce-exports --with-gui=qt5 CPPFLAGS=-DDEBUG_LOCKORDER"
-# x86_64 Linux (sanitizers)
+# x86_64 Linux (no depends, only system libs, sanitizers: undefined (UBSAN) + integer)
- stage: test
env: >-
HOST=x86_64-unknown-linux-gnu
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"
NO_DEPENDS=1
- 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
GOAL="install"
- 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++"
+ 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++"
# x86_64 Linux, No wallet
- stage: test
env: >-
diff --git a/.travis/test_04_install.sh b/.travis/test_04_install.sh
index ef595287b7..43f2be129e 100755
--- a/.travis/test_04_install.sh
+++ b/.travis/test_04_install.sh
@@ -7,7 +7,8 @@
export LC_ALL=C.UTF-8
travis_retry docker pull "$DOCKER_NAME_TAG"
-env | grep -E '^(CCACHE_|WINEDEBUG|LC_ALL|BOOST_TEST_RANDOM|CONFIG_SHELL)' | tee /tmp/env
+export UBSAN_OPTIONS="suppressions=${TRAVIS_BUILD_DIR}/contrib/sanitizers-ubsan.suppressions"
+env | grep -E '^(CCACHE_|WINEDEBUG|LC_ALL|BOOST_TEST_RANDOM|CONFIG_SHELL|UBSAN_OPTIONS)' | tee /tmp/env
if [[ $HOST = *-mingw32 ]]; then
DOCKER_ADMIN="--cap-add SYS_ADMIN"
fi
diff --git a/contrib/sanitizers-ubsan.suppressions b/contrib/sanitizers-ubsan.suppressions
new file mode 100644
index 0000000000..44c4a49796
--- /dev/null
+++ b/contrib/sanitizers-ubsan.suppressions
@@ -0,0 +1,27 @@
+alignment:move.h
+alignment:prevector.h
+bool:wallet/wallet.cpp
+float-divide-by-zero:policy/fees.cpp
+float-divide-by-zero:validation.cpp
+float-divide-by-zero:wallet/wallet.cpp
+nonnull-attribute:support/cleanse.cpp
+unsigned-integer-overflow:basic_string.h
+unsigned-integer-overflow:bench/bench.h
+unsigned-integer-overflow:bloom.cpp
+unsigned-integer-overflow:chain.h
+unsigned-integer-overflow:crypto/chacha20.cpp
+unsigned-integer-overflow:crypto/ctaes/ctaes.c
+unsigned-integer-overflow:crypto/ripemd160.cpp
+unsigned-integer-overflow:crypto/sha1.cpp
+unsigned-integer-overflow:crypto/sha256.cpp
+unsigned-integer-overflow:crypto/sha512.cpp
+unsigned-integer-overflow:hash.cpp
+unsigned-integer-overflow:leveldb/db/log_reader.cc
+unsigned-integer-overflow:leveldb/util/bloom.cc
+unsigned-integer-overflow:leveldb/util/crc32c.h
+unsigned-integer-overflow:leveldb/util/hash.cc
+unsigned-integer-overflow:policy/fees.cpp
+unsigned-integer-overflow:script/interpreter.cpp
+unsigned-integer-overflow:stl_bvector.h
+unsigned-integer-overflow:txmempool.cpp
+unsigned-integer-overflow:validation.cpp