diff options
author | MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> | 2023-08-28 21:32:41 +0200 |
---|---|---|
committer | MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> | 2023-08-30 10:52:27 +0200 |
commit | fa07ac48d804beac38a98d23be2167f78cadefae (patch) | |
tree | be7ca583d93d9791ebfd4f7414135333dfe0d075 /ci | |
parent | ab42b2ebdbf61225e636e4c00068fd29b2790d41 (diff) |
ci: Asan with -ftrivial-auto-var-init=pattern
Diffstat (limited to 'ci')
-rwxr-xr-x | ci/test/00_setup_env_native_asan.sh | 3 | ||||
-rwxr-xr-x | ci/test/06_script_b.sh | 23 |
2 files changed, 25 insertions, 1 deletions
diff --git a/ci/test/00_setup_env_native_asan.sh b/ci/test/00_setup_env_native_asan.sh index b03fea4af9..70edf90606 100755 --- a/ci/test/00_setup_env_native_asan.sh +++ b/ci/test/00_setup_env_native_asan.sh @@ -22,4 +22,5 @@ export NO_DEPENDS=1 export GOAL="install" export BITCOIN_CONFIG="--enable-c++20 --enable-usdt --enable-zmq --with-incompatible-bdb --with-gui=qt5 \ CPPFLAGS='-DARENA_DEBUG -DDEBUG_LOCKORDER' \ ---with-sanitizers=address,float-divide-by-zero,integer,undefined CC=clang-16 CXX=clang++-16" +--with-sanitizers=address,float-divide-by-zero,integer,undefined \ +CC='clang-16 -ftrivial-auto-var-init=pattern' CXX='clang++-16 -ftrivial-auto-var-init=pattern'" diff --git a/ci/test/06_script_b.sh b/ci/test/06_script_b.sh index a3d982486e..f5ba48e455 100755 --- a/ci/test/06_script_b.sh +++ b/ci/test/06_script_b.sh @@ -29,6 +29,29 @@ df -h # Tests that run natively guess the host export HOST=${HOST:-$("$BASE_ROOT_DIR/depends/config.guess")} +( + # compact->outputs[i].file_size is uninitialized memory, so reading it is UB. + # The statistic bytes_written is only used for logging, which is disabled in + # CI, so as a temporary minimal fix to work around UB and CI failures, leave + # bytes_written unmodified. + # See https://github.com/bitcoin/bitcoin/pull/28359#issuecomment-1698694748 + echo 'diff --git a/src/leveldb/db/db_impl.cc b/src/leveldb/db/db_impl.cc +index 65e31724bc..f61b471953 100644 +--- a/src/leveldb/db/db_impl.cc ++++ b/src/leveldb/db/db_impl.cc +@@ -1028,9 +1028,6 @@ Status DBImpl::DoCompactionWork(CompactionState* compact) { + stats.bytes_read += compact->compaction->input(which, i)->file_size; + } + } +- for (size_t i = 0; i < compact->outputs.size(); i++) { +- stats.bytes_written += compact->outputs[i].file_size; +- } + + mutex_.Lock(); + stats_[compact->compaction->level() + 1].Add(stats);' | patch -p1 + git diff +) + if [ "$RUN_FUZZ_TESTS" = "true" ]; then export DIR_FUZZ_IN=${DIR_QA_ASSETS}/fuzz_seed_corpus/ if [ ! -d "$DIR_FUZZ_IN" ]; then |