From 26c460aa8b5decfd08d931b9b3f80be5c13c7528 Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Mon, 2 Sep 2024 23:18:16 +0100 Subject: [PATCH 1/2] build: Fix linking for `fuzz` target when building with MSan --- src/test/fuzz/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/src/test/fuzz/CMakeLists.txt b/src/test/fuzz/CMakeLists.txt index 0bff9bf784ad0..165add2e5a0e6 100644 --- a/src/test/fuzz/CMakeLists.txt +++ b/src/test/fuzz/CMakeLists.txt @@ -132,6 +132,7 @@ target_link_libraries(fuzz test_fuzz bitcoin_cli bitcoin_common + bitcoin_util minisketch leveldb univalue From 787dfaf084a3952319778da9cbcda9d7d619e4ee Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Sat, 31 Aug 2024 07:03:44 +0100 Subject: [PATCH 2/2] ci: Do not override `-g -O1` set in `MSAN_FLAGS` Additionally, setting the "Debug" build configuration ensures that `linux_debug_CPPFLAGS` from depends are passed to the main build system. --- ci/test/00_setup_env_native_fuzz_with_msan.sh | 4 ++++ ci/test/00_setup_env_native_msan.sh | 9 ++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/ci/test/00_setup_env_native_fuzz_with_msan.sh b/ci/test/00_setup_env_native_fuzz_with_msan.sh index 85f02c01c522f..7cea4d73afc6d 100755 --- a/ci/test/00_setup_env_native_fuzz_with_msan.sh +++ b/ci/test/00_setup_env_native_fuzz_with_msan.sh @@ -17,8 +17,12 @@ export PACKAGES="ninja-build" # BDB generates false-positives and will be removed in future export DEP_OPTS="DEBUG=1 NO_BDB=1 NO_QT=1 CC=clang CXX=clang++ CFLAGS='${MSAN_FLAGS}' CXXFLAGS='${MSAN_AND_LIBCXX_FLAGS}'" export GOAL="install" +# Setting CMAKE_{C,CXX}_FLAGS_DEBUG flags to an empty string ensures that the flags set in MSAN_FLAGS remain unaltered. # _FORTIFY_SOURCE is not compatible with MSAN. export BITCOIN_CONFIG="\ + -DCMAKE_BUILD_TYPE=Debug \ + -DCMAKE_C_FLAGS_DEBUG='' \ + -DCMAKE_CXX_FLAGS_DEBUG='' \ -DBUILD_FOR_FUZZING=ON \ -DSANITIZERS=fuzzer,memory \ -DAPPEND_CPPFLAGS='-DBOOST_MULTI_INDEX_ENABLE_SAFE_MODE -U_FORTIFY_SOURCE' \ diff --git a/ci/test/00_setup_env_native_msan.sh b/ci/test/00_setup_env_native_msan.sh index 85a1d3bd48e0a..2c85ba31d160f 100755 --- a/ci/test/00_setup_env_native_msan.sh +++ b/ci/test/00_setup_env_native_msan.sh @@ -17,8 +17,15 @@ export PACKAGES="ninja-build" # BDB generates false-positives and will be removed in future export DEP_OPTS="DEBUG=1 NO_BDB=1 NO_QT=1 CC=clang CXX=clang++ CFLAGS='${MSAN_FLAGS}' CXXFLAGS='${MSAN_AND_LIBCXX_FLAGS}'" export GOAL="install" +# Setting CMAKE_{C,CXX}_FLAGS_DEBUG flags to an empty string ensures that the flags set in MSAN_FLAGS remain unaltered. # _FORTIFY_SOURCE is not compatible with MSAN. -export BITCOIN_CONFIG="-DSANITIZERS=memory -DAPPEND_CPPFLAGS='-U_FORTIFY_SOURCE'" +export BITCOIN_CONFIG="\ + -DCMAKE_BUILD_TYPE=Debug \ + -DCMAKE_C_FLAGS_DEBUG='' \ + -DCMAKE_CXX_FLAGS_DEBUG='' \ + -DSANITIZERS=memory \ + -DAPPEND_CPPFLAGS='-U_FORTIFY_SOURCE' \ +" export USE_MEMORY_SANITIZER="true" export RUN_FUNCTIONAL_TESTS="false" export CCACHE_MAXSIZE=250M