partial Merge #19041: ci: tsan with -stdlib=libc++-10

BACKPORT NOTICE:
this PR doesn't actually swithc to libc++ due to multiple CI failures such as
linking errors or other
------------------
faf62e6ed0ca45db44c370844c3515eb5a8cda12 ci: Remove unused workaround (MarcoFalke)
fa7c8509153bfd2d5b4dcff86ad27dfd73e8788b ci: Install llvm to get llvm symbolizer (MarcoFalke)
fa563cef61e8a217c5e8ec059e174afae61087a5 test: Add more tsan suppressions (MarcoFalke)
fa0cc02c0a029133f080680ae9186002a144738f ci: Mute depends logs completely (MarcoFalke)
fa906bf2988c799765a04c484269f890964ec3ee test: Extend tsan suppressions for clang stdlib (MarcoFalke)
fa10d850790bbe52d948659bb1ebbb88fe718065 ci: Use libc++ instead of libstdc++ for tsan (MarcoFalke)
fa0d5ee1126a8cff9f30f863eb8f5c78bf57e168 ci: Set halt_on_error=1 for tsan (MarcoFalke)
fa2ffe87f794caa74f80c1c2d6e6067ee4849632 ci: Deduplicate DOCKER_EXEC (MarcoFalke)
fac2eeeb9d718bdb892eef9adf333ea61ba8f3d0 cirrus: Remove no longer needed install step (MarcoFalke)

Pull request description:

  According to the [ThreadSanitizer docs](https://clang.llvm.org/docs/ThreadSanitizer.html#current-status):
  >  C++11 threading is supported with **llvm libc++**.

  For example, the thread sanitizer build is currently not checking for double lock of mutexes.

  Fixes (partially) https://github.com/bitcoin/bitcoin/issues/19038#issuecomment-632138003

ACKs for top commit:
  practicalswift:
    ACK faf62e6ed0ca45db44c370844c3515eb5a8cda12
  fanquake:
    ACK faf62e6ed0ca45db44c370844c3515eb5a8cda12
  hebasto:
    ACK faf62e6ed0ca45db44c370844c3515eb5a8cda12, maybe re-organize commits to modify suppressions in a single one?

Tree-SHA512: 98ce5154b4736dfb811ffdb6e6f63a7bc25fe50d3b73134404a8f3715ad53626c31f9c8132dbacf85de47b9409f1e17a4399e35f78b1da30b1577167ea2982ad
This commit is contained in:
fanquake 2020-06-03 21:26:39 +08:00 committed by pasta
parent 924b8e4eb8
commit 09fe21bb0e
No known key found for this signature in database
GPG Key ID: 52527BEDABE87984
10 changed files with 42 additions and 26 deletions

View File

@ -14,9 +14,5 @@ task:
folder: "/tmp/ccache_dir"
depends_built_cache:
folder: "/tmp/cirrus-ci-build/depends/built"
install_script:
- apt-get update
- apt-get -y install git bash ccache
- ccache --max-size=${CCACHE_SIZE}
ci_script:
- ./ci/test_run_all.sh

View File

@ -210,7 +210,7 @@ after_success:
FILE_ENV="./ci/test/00_setup_env_native_qt5.sh"
# x86_64 Linux (xenial, no depends, only system libs, sanitizers: thread (TSan))
- stage: test
name: 'x86_64 Linux [GOAL: install] [bionic] [no depends, only system libs, sanitizers: thread (TSan), no wallet]'
name: 'x86_64 Linux [GOAL: install] [focal] [depends, sanitizers: thread (TSan), no wallet, no gui]'
# Not enough memory on travis machines, so feature_block is excluded for now
env: >-
TEST_RUNNER_EXTRA="--exclude feature_block"

View File

@ -45,11 +45,11 @@ rm -rf build-ci
mkdir build-ci
cd build-ci
../configure $BITCOIN_CONFIG_ALL $BITCOIN_CONFIG || ( cat config.log && false)
bash -c "../configure $BITCOIN_CONFIG_ALL $BITCOIN_CONFIG" || ( cat config.log && false)
make distdir VERSION=$BUILD_TARGET
cd dashcore-$BUILD_TARGET
./configure $BITCOIN_CONFIG_ALL $BITCOIN_CONFIG || ( cat config.log && false)
bash -c "./configure $BITCOIN_CONFIG_ALL $BITCOIN_CONFIG" || ( cat config.log && false)
make $MAKEJOBS $GOAL || ( echo "Build failure. Verbose build follows." && make $GOAL V=1 ; false )

View File

@ -13,7 +13,7 @@ source ./ci/test/00_setup_env.sh
# Configure sanitizers options
export ASAN_OPTIONS=""
export LSAN_OPTIONS="suppressions=${BASE_ROOT_DIR}/test/sanitizer_suppressions/lsan"
export TSAN_OPTIONS="suppressions=${BASE_ROOT_DIR}/test/sanitizer_suppressions/tsan"
export TSAN_OPTIONS="suppressions=${BASE_ROOT_DIR}/test/sanitizer_suppressions/tsan:halt_on_error=1"
export UBSAN_OPTIONS="suppressions=${BASE_ROOT_DIR}/test/sanitizer_suppressions/ubsan"
if [ "$BUILD_TARGET" = "arm-linux" ]; then

View File

@ -7,13 +7,12 @@
export LC_ALL=C.UTF-8
export CONTAINER_NAME=ci_native_tsan
export PACKAGES="clang-15 llvm-15 python3-zmq qtbase5-dev qttools5-dev-tools libevent-dev bsdmainutils libboost-filesystem-dev libboost-test-dev libboost-thread-dev libdb5.3++-dev libminiupnpc-dev libzmq3-dev libqrencode-dev"
export DEP_OPTS="NO_UPNP=1 DEBUG=1"
export PACKAGES="clang llvm libc++abi-dev libc++-dev python3-zmq"
export DEP_OPTS="CC=clang-15 CXX='clang++-15 -stdlib=libc++"
export TEST_RUNNER_EXTRA="--extended --exclude feature_pruning,feature_dbcrash,wallet_multiwallet.py" # Temporarily suppress ASan heap-use-after-free (see issue #14163)
export TEST_RUNNER_EXTRA="${TEST_RUNNER_EXTRA} --timeout-factor=4" # Increase timeout because sanitizers slow down
export GOAL="install"
export BITCOIN_CONFIG="--enable-zmq --enable-reduce-exports --enable-crash-hooks --with-sanitizers=thread"
export BITCOIN_CONFIG="${BITCOIN_CONFIG} CC=clang-15 CXX=clang++-15 CXXFLAGS=-Werror=thread-safety"
export BITCOIN_CONFIG="--enable-zmq --disable-wallet --with-gui=no --with-sanitizers=thread CC=clang-15 CXX=clang++-15"
export CPPFLAGS="-DDEBUG_LOCKORDER -DENABLE_DASH_DEBUG -DARENA_DEBUG"
export PYZMQ=true
export RUN_SYMBOL_TESTS=false

View File

@ -6,10 +6,6 @@
export LC_ALL=C.UTF-8
# Add llvm-symbolizer directory to PATH. Needed to get symbolized stack traces from the sanitizers.
PATH=$PATH:/usr/lib/llvm-6.0/bin/
export PATH
BEGIN_FOLD () {
echo ""
CURRENT_FOLD_NAME=$1

View File

@ -23,7 +23,7 @@ mkdir -p "${PREVIOUS_RELEASES_DIR}"
export ASAN_OPTIONS="detect_stack_use_after_return=1:check_initialization_order=1:strict_init_order=1"
export LSAN_OPTIONS="suppressions=${BASE_BUILD_DIR}/test/sanitizer_suppressions/lsan"
export TSAN_OPTIONS="suppressions=${BASE_BUILD_DIR}/test/sanitizer_suppressions/tsan"
export TSAN_OPTIONS="suppressions=${BASE_BUILD_DIR}/test/sanitizer_suppressions/tsan:halt_on_error=1"
export UBSAN_OPTIONS="suppressions=${BASE_BUILD_DIR}/test/sanitizer_suppressions/ubsan:print_stacktrace=1:halt_on_error=1:report_error_type=1"
env | grep -E '^(BASE_|QEMU_|CCACHE_|LC_ALL|BOOST_TEST_RANDOM|DEBIAN_FRONTEND|CONFIG_SHELL|(ASAN|LSAN|TSAN|UBSAN)_OPTIONS|PREVIOUS_RELEASES_DIR))' | tee /tmp/env
if [[ $HOST = *-mingw32 ]]; then
@ -47,16 +47,14 @@ if [ -z "$DANGER_RUN_CI_ON_HOST" ]; then
--env-file /tmp/env \
--name $CONTAINER_NAME \
$DOCKER_NAME_TAG)
DOCKER_EXEC () {
docker exec $DOCKER_ID bash -c "export PATH=$BASE_SCRATCH_DIR/bins/:\$PATH && cd $P_CI_DIR && $*"
}
export DOCKER_CI_CMD_PREFIX="docker exec $DOCKER_ID"
else
echo "Running on host system without docker wrapper"
DOCKER_EXEC () {
bash -c "export PATH=$BASE_SCRATCH_DIR/bins/:\$PATH && cd $P_CI_DIR && $*"
}
fi
DOCKER_EXEC () {
$DOCKER_CI_CMD_PREFIX bash -c "export PATH=$BASE_SCRATCH_DIR/bins/:\$PATH && cd $P_CI_DIR && $*"
}
export -f DOCKER_EXEC
if [ -n "$DPKG_ADD_ARCH" ]; then

View File

@ -33,7 +33,9 @@ if [ -z "$NO_DEPENDS" ]; then
else
SHELL_OPTS="CONFIG_SHELL="
fi
DOCKER_EXEC $SHELL_OPTS make $MAKEJOBS -C depends HOST=$HOST $DEP_OPTS
# Temporary workaround for https://github.com/bitcoin/bitcoin/issues/16368
python3 -c 'import time; [print(".") or time.sleep(500) for _ in range(4)]' &
( DOCKER_EXEC $SHELL_OPTS make $MAKEJOBS -C depends HOST=$HOST $DEP_OPTS ) &> /dev/null
fi
if [ -n "$PREVIOUS_RELEASES_TO_DOWNLOAD" ]; then
BEGIN_FOLD previous-versions

View File

@ -25,9 +25,11 @@ RUN apt-get update && apt-get install $APT_ARGS \
ccache \
clang \
cmake \
git \
g++ \
gettext \
git \
libc++-dev \
libc++abi-dev \
libtool \
libxcb-icccm4 \
libxcb-image0 \

View File

@ -9,6 +9,29 @@ race:zmq::*
# race (TODO fix)
race:validation_chainstatemanager_tests
# double locks (TODO fix)
mutex:g_genesis_wait_mutex
mutex:Interrupt
mutex:CThreadInterrupt
mutex:CConnman::Interrupt
mutex:CConnman::WakeMessageHandler
mutex:CConnman::ThreadOpenConnections
mutex:CConnman::ThreadOpenAddedConnections
mutex:CConnman::SocketHandler
mutex:UpdateTip
mutex:PeerLogicValidation::UpdatedBlockTip
# race (TODO fix)
race:CConnman::WakeMessageHandler
race:CConnman::ThreadMessageHandler
race:fHaveGenesis
race:ProcessNewBlock
race:ThreadImport
race:zmq::*
race:bitcoin-qt
# deadlock (TODO fix)
deadlock:CConnman::ForNode
deadlock:UpdateTip
# WalletBatch (unidentified deadlock)
deadlock:WalletBatch