Merge bitcoin-core/secp256k1#1750: ci: Use clang-snapshot in "MSan" job
53585f93b7ci: Use clang-snapshot in "MSan" job (Hennadii Stepanov)6894c964f3Fix Clang 21+ `-Wuninitialized-const-pointer` warning when using MSan (Hennadii Stepanov) Pull request description: In Bitcoin Core, the "MSan" CI jobs use the latest tagged Clang available from http://apt.llvm.org. This PR applies similar changes and switches the "MSan" CI jobs to clang-snapshot. This exposes problematic code that was reported in https://github.com/bitcoin/bitcoin/issues/33284. ACKs for top commit: real-or-random: utACK53585f93b7Tree-SHA512: 79bc10f1d0a60ed67b518eb8fab9a48146a4ef1fff95c8775717be3a950b323ae89a12999504ed8446f164da426894abe02f9fb61b5ca19453d549a34873b73b
This commit is contained in:
5
.github/workflows/ci.yml
vendored
5
.github/workflows/ci.yml
vendored
@@ -417,6 +417,9 @@ jobs:
|
|||||||
# when ctime_tests when enabled.
|
# when ctime_tests when enabled.
|
||||||
CFLAGS: '-fsanitize=memory -fsanitize-recover=memory -fsanitize-memory-param-retval -g'
|
CFLAGS: '-fsanitize=memory -fsanitize-recover=memory -fsanitize-memory-param-retval -g'
|
||||||
CTIMETESTS: 'no'
|
CTIMETESTS: 'no'
|
||||||
|
cc:
|
||||||
|
- 'clang'
|
||||||
|
- 'clang-snapshot'
|
||||||
|
|
||||||
env:
|
env:
|
||||||
ECDH: 'yes'
|
ECDH: 'yes'
|
||||||
@@ -425,7 +428,7 @@ jobs:
|
|||||||
SCHNORRSIG: 'yes'
|
SCHNORRSIG: 'yes'
|
||||||
MUSIG: 'yes'
|
MUSIG: 'yes'
|
||||||
ELLSWIFT: 'yes'
|
ELLSWIFT: 'yes'
|
||||||
CC: 'clang'
|
CC: ${{ matrix.cc }}
|
||||||
SECP256K1_TEST_ITERS: 32
|
SECP256K1_TEST_ITERS: 32
|
||||||
ASM: 'no'
|
ASM: 'no'
|
||||||
WITH_VALGRIND: 'no'
|
WITH_VALGRIND: 'no'
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ RUN \
|
|||||||
# Determine the version number of the LLVM development branch
|
# Determine the version number of the LLVM development branch
|
||||||
LLVM_VERSION=$(apt-cache search --names-only '^clang-[0-9]+$' | sort -V | tail -1 | cut -f1 -d" " | cut -f2 -d"-" ) && \
|
LLVM_VERSION=$(apt-cache search --names-only '^clang-[0-9]+$' | sort -V | tail -1 | cut -f1 -d" " | cut -f2 -d"-" ) && \
|
||||||
# Install
|
# Install
|
||||||
DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y "clang-${LLVM_VERSION}" && \
|
DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y "clang-${LLVM_VERSION}" "libclang-rt-${LLVM_VERSION}-dev" && \
|
||||||
# Create symlink
|
# Create symlink
|
||||||
ln -s "/usr/bin/clang-${LLVM_VERSION}" /usr/bin/clang-snapshot && \
|
ln -s "/usr/bin/clang-${LLVM_VERSION}" /usr/bin/clang-snapshot && \
|
||||||
# Clean up
|
# Clean up
|
||||||
|
|||||||
@@ -48,7 +48,17 @@
|
|||||||
# if __has_feature(memory_sanitizer)
|
# if __has_feature(memory_sanitizer)
|
||||||
# include <sanitizer/msan_interface.h>
|
# include <sanitizer/msan_interface.h>
|
||||||
# define SECP256K1_CHECKMEM_ENABLED 1
|
# define SECP256K1_CHECKMEM_ENABLED 1
|
||||||
# define SECP256K1_CHECKMEM_UNDEFINE(p, len) __msan_allocated_memory((p), (len))
|
# if defined(__clang__) && ((__clang_major__ == 21 && __clang_minor__ >= 1) || __clang_major__ >= 22)
|
||||||
|
# define SECP256K1_CHECKMEM_UNDEFINE(p, len) do { \
|
||||||
|
/* Work around https://github.com/llvm/llvm-project/issues/160094 */ \
|
||||||
|
_Pragma("clang diagnostic push") \
|
||||||
|
_Pragma("clang diagnostic ignored \"-Wuninitialized-const-pointer\"") \
|
||||||
|
__msan_allocated_memory((p), (len)); \
|
||||||
|
_Pragma("clang diagnostic pop") \
|
||||||
|
} while(0)
|
||||||
|
# else
|
||||||
|
# define SECP256K1_CHECKMEM_UNDEFINE(p, len) __msan_allocated_memory((p), (len))
|
||||||
|
# endif
|
||||||
# define SECP256K1_CHECKMEM_DEFINE(p, len) __msan_unpoison((p), (len))
|
# define SECP256K1_CHECKMEM_DEFINE(p, len) __msan_unpoison((p), (len))
|
||||||
# define SECP256K1_CHECKMEM_MSAN_DEFINE(p, len) __msan_unpoison((p), (len))
|
# define SECP256K1_CHECKMEM_MSAN_DEFINE(p, len) __msan_unpoison((p), (len))
|
||||||
# define SECP256K1_CHECKMEM_CHECK(p, len) __msan_check_mem_is_initialized((p), (len))
|
# define SECP256K1_CHECKMEM_CHECK(p, len) __msan_check_mem_is_initialized((p), (len))
|
||||||
|
|||||||
Reference in New Issue
Block a user