From 89bf196c88e550fd066d6d44aa05ef88cd53b487 Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Mon, 19 Nov 2018 09:11:18 -0500 Subject: [PATCH 1/3] travis: Run thread sanitizer --- .travis.yml | 9 +++++---- .travis/test_04_install.sh | 3 ++- test/sanitizer_suppressions/tsan | 24 ++++++++++++++++++++++++ 3 files changed, 31 insertions(+), 5 deletions(-) create mode 100644 test/sanitizer_suppressions/tsan diff --git a/.travis.yml b/.travis.yml index 1bf560fc4c8..2b5bc97ddf9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -94,15 +94,16 @@ jobs: DEP_OPTS="NO_QT=1 NO_UPNP=1 DEBUG=1 ALLOW_HOST_PACKAGES=1" GOAL="install" BITCOIN_CONFIG="--enable-zmq --with-gui=qt5 --enable-glibc-back-compat --enable-reduce-exports --enable-debug CXXFLAGS=\"-g0 -O2\"" -# x86_64 Linux (xenial, no depends, only system libs) +# x86_64 Linux (xenial, no depends, only system libs, sanitizers: thread (TSAN)) - stage: test env: >- HOST=x86_64-unknown-linux-gnu DOCKER_NAME_TAG=ubuntu:16.04 - PACKAGES="python3-zmq qtbase5-dev qttools5-dev-tools libssl-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" + PACKAGES="clang llvm python3-zmq qtbase5-dev qttools5-dev-tools libssl-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. TODO identify suppressions or exclude specific tests GOAL="install" - BITCOIN_CONFIG="--enable-zmq --with-incompatible-bdb --enable-glibc-back-compat --enable-reduce-exports --with-gui=qt5 CPPFLAGS=-DDEBUG_LOCKORDER" + BITCOIN_CONFIG="--enable-zmq --with-incompatible-bdb --with-gui=qt5 CPPFLAGS=-DDEBUG_LOCKORDER --with-sanitizers=thread CC=clang CXX=clang++" # x86_64 Linux (no depends, only system libs, sanitizers: undefined (UBSAN) + integer) - stage: test env: >- @@ -110,7 +111,7 @@ jobs: PACKAGES="clang llvm 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 --with-sanitizers=integer,undefined CC=clang CXX=clang++" + BITCOIN_CONFIG="--enable-zmq --with-incompatible-bdb --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 4cf0ba8984a..7019c343427 100755 --- a/.travis/test_04_install.sh +++ b/.travis/test_04_install.sh @@ -7,8 +7,9 @@ export LC_ALL=C.UTF-8 travis_retry docker pull "$DOCKER_NAME_TAG" +export TSAN_OPTIONS="suppressions=${TRAVIS_BUILD_DIR}/test/sanitizer_suppressions/tsan" export UBSAN_OPTIONS="suppressions=${TRAVIS_BUILD_DIR}/contrib/sanitizers-ubsan.suppressions:print_stacktrace=1:halt_on_error=1" -env | grep -E '^(CCACHE_|WINEDEBUG|LC_ALL|BOOST_TEST_RANDOM|CONFIG_SHELL|UBSAN_OPTIONS)' | tee /tmp/env +env | grep -E '^(CCACHE_|WINEDEBUG|LC_ALL|BOOST_TEST_RANDOM|CONFIG_SHELL|(TSAN|UBSAN)_OPTIONS)' | tee /tmp/env if [[ $HOST = *-mingw32 ]]; then DOCKER_ADMIN="--cap-add SYS_ADMIN" fi diff --git a/test/sanitizer_suppressions/tsan b/test/sanitizer_suppressions/tsan new file mode 100644 index 00000000000..209c46f0964 --- /dev/null +++ b/test/sanitizer_suppressions/tsan @@ -0,0 +1,24 @@ +# ThreadSanitizer suppressions +# ============================ + +# fChecked is theoretically racy, practically only in unit tests +race:CheckBlock + +# WalletBatch (unidentified deadlock) +deadlock:WalletBatch + +# Intentional deadlock in tests +deadlock:TestPotentialDeadLockDetected + +# Wildcard for all gui tests, should be replaced with non-wildcard suppressions +race:src/qt/test/* +deadlock:src/qt/test/* + +# WIP: Unidentified suppressions to run the functional tests +#race:zmqpublishnotifier.cpp +# +#deadlock:CreateWalletFromFile +#deadlock:importprivkey +#deadlock:walletdb.h +#deadlock:walletdb.cpp +#deadlock:wallet/db.cpp From fa36d4e4566de18f4ab41c6b248953bec89e5555 Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Mon, 19 Nov 2018 09:42:34 -0500 Subject: [PATCH 2/3] travis: --disable-hardening for xenial thread sanitizer https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67308 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 2b5bc97ddf9..2407aa73f6f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -103,7 +103,7 @@ jobs: NO_DEPENDS=1 RUN_FUNCTIONAL_TESTS=false # Disabled for now. TODO identify suppressions or exclude specific tests GOAL="install" - BITCOIN_CONFIG="--enable-zmq --with-incompatible-bdb --with-gui=qt5 CPPFLAGS=-DDEBUG_LOCKORDER --with-sanitizers=thread CC=clang CXX=clang++" + BITCOIN_CONFIG="--enable-zmq --with-incompatible-bdb --with-gui=qt5 CPPFLAGS=-DDEBUG_LOCKORDER --with-sanitizers=thread --disable-hardening --disable-asm CC=clang CXX=clang++" # x86_64 Linux (no depends, only system libs, sanitizers: undefined (UBSAN) + integer) - stage: test env: >- From fa7d36b8e77cafe74ac9c11ebe752b731c215480 Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Thu, 22 Nov 2018 11:57:07 -0500 Subject: [PATCH 3/3] test: Move UBSAN suppressions to test/sanitizer_suppressions/ubsan --- .travis/test_04_install.sh | 2 +- .../sanitizer_suppressions/ubsan | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename contrib/sanitizers-ubsan.suppressions => test/sanitizer_suppressions/ubsan (100%) diff --git a/.travis/test_04_install.sh b/.travis/test_04_install.sh index 7019c343427..75de71c5830 100755 --- a/.travis/test_04_install.sh +++ b/.travis/test_04_install.sh @@ -8,7 +8,7 @@ export LC_ALL=C.UTF-8 travis_retry docker pull "$DOCKER_NAME_TAG" export TSAN_OPTIONS="suppressions=${TRAVIS_BUILD_DIR}/test/sanitizer_suppressions/tsan" -export UBSAN_OPTIONS="suppressions=${TRAVIS_BUILD_DIR}/contrib/sanitizers-ubsan.suppressions:print_stacktrace=1:halt_on_error=1" +export UBSAN_OPTIONS="suppressions=${TRAVIS_BUILD_DIR}/test/sanitizer_suppressions/ubsan:print_stacktrace=1:halt_on_error=1" env | grep -E '^(CCACHE_|WINEDEBUG|LC_ALL|BOOST_TEST_RANDOM|CONFIG_SHELL|(TSAN|UBSAN)_OPTIONS)' | tee /tmp/env if [[ $HOST = *-mingw32 ]]; then DOCKER_ADMIN="--cap-add SYS_ADMIN" diff --git a/contrib/sanitizers-ubsan.suppressions b/test/sanitizer_suppressions/ubsan similarity index 100% rename from contrib/sanitizers-ubsan.suppressions rename to test/sanitizer_suppressions/ubsan