Skip to content

Commit fa07ac4

Browse files
author
MarcoFalke
committed
ci: Asan with -ftrivial-auto-var-init=pattern
1 parent ab42b2e commit fa07ac4

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

ci/test/00_setup_env_native_asan.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,5 @@ export NO_DEPENDS=1
2222
export GOAL="install"
2323
export BITCOIN_CONFIG="--enable-c++20 --enable-usdt --enable-zmq --with-incompatible-bdb --with-gui=qt5 \
2424
CPPFLAGS='-DARENA_DEBUG -DDEBUG_LOCKORDER' \
25-
--with-sanitizers=address,float-divide-by-zero,integer,undefined CC=clang-16 CXX=clang++-16"
25+
--with-sanitizers=address,float-divide-by-zero,integer,undefined \
26+
CC='clang-16 -ftrivial-auto-var-init=pattern' CXX='clang++-16 -ftrivial-auto-var-init=pattern'"

ci/test/06_script_b.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,29 @@ df -h
2929
# Tests that run natively guess the host
3030
export HOST=${HOST:-$("$BASE_ROOT_DIR/depends/config.guess")}
3131

32+
(
33+
# compact->outputs[i].file_size is uninitialized memory, so reading it is UB.
34+
# The statistic bytes_written is only used for logging, which is disabled in
35+
# CI, so as a temporary minimal fix to work around UB and CI failures, leave
36+
# bytes_written unmodified.
37+
# See https://github.com/bitcoin/bitcoin/pull/28359#issuecomment-1698694748
38+
echo 'diff --git a/src/leveldb/db/db_impl.cc b/src/leveldb/db/db_impl.cc
39+
index 65e31724bc..f61b471953 100644
40+
--- a/src/leveldb/db/db_impl.cc
41+
+++ b/src/leveldb/db/db_impl.cc
42+
@@ -1028,9 +1028,6 @@ Status DBImpl::DoCompactionWork(CompactionState* compact) {
43+
stats.bytes_read += compact->compaction->input(which, i)->file_size;
44+
}
45+
}
46+
- for (size_t i = 0; i < compact->outputs.size(); i++) {
47+
- stats.bytes_written += compact->outputs[i].file_size;
48+
- }
49+
50+
mutex_.Lock();
51+
stats_[compact->compaction->level() + 1].Add(stats);' | patch -p1
52+
git diff
53+
)
54+
3255
if [ "$RUN_FUZZ_TESTS" = "true" ]; then
3356
export DIR_FUZZ_IN=${DIR_QA_ASSETS}/fuzz_seed_corpus/
3457
if [ ! -d "$DIR_FUZZ_IN" ]; then

0 commit comments

Comments
 (0)