Skip to content

Commit 34d5c75

Browse files
committed
Overcome ASAN false positive regression
The Memory Sanitizer is giving a false positive at the moment in `nightly`. Adding compiler flags resolves the issue. I didn't grok the exact root cause but this fixes it (cut'n'pasta from the issue [0]). [0] rust-lang/rust#107149
1 parent be94e6c commit 34d5c75

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

contrib/test.sh

+8-5
Original file line numberDiff line numberDiff line change
@@ -73,16 +73,19 @@ if [ "$DO_WASM" = true ]; then
7373
fi
7474

7575
# Address Sanitizer
76+
#
77+
# The -Cllvm-args=-msan-eager-checks=0 flag was added to overcome this issue:
78+
# https://github.com/rust-bitcoin/rust-secp256k1/pull/573#issuecomment-1399465995
7679
if [ "$DO_ASAN" = true ]; then
7780
clang --version
7881
cargo clean
79-
CC='clang -fsanitize=address -fno-omit-frame-pointer' \
80-
RUSTFLAGS='-Zsanitizer=address -Clinker=clang -Cforce-frame-pointers=yes' \
81-
ASAN_OPTIONS='detect_leaks=1 detect_invalid_pointer_pairs=1 detect_stack_use_after_return=1' \
82+
CC='clang -fsanitize=address -fno-omit-frame-pointer' \
83+
RUSTFLAGS='-Zsanitizer=address -Clinker=clang -Cforce-frame-pointers=yes -Cllvm-args=-msan-eager-checks=0' \
84+
ASAN_OPTIONS='detect_leaks=1 detect_invalid_pointer_pairs=1 detect_stack_use_after_return=1' \
8285
cargo test --lib --all --features="$FEATURES" -Zbuild-std --target x86_64-unknown-linux-gnu
8386
cargo clean
84-
CC='clang -fsanitize=memory -fno-omit-frame-pointer' \
85-
RUSTFLAGS='-Zsanitizer=memory -Zsanitizer-memory-track-origins -Cforce-frame-pointers=yes' \
87+
CC='clang -fsanitize=memory -fno-omit-frame-pointer' \
88+
RUSTFLAGS='-Zsanitizer=memory -Zsanitizer-memory-track-origins -Cforce-frame-pointers=yes -Cllvm-args=-msan-eager-checks=0' \
8689
cargo test --lib --all --features="$FEATURES" -Zbuild-std --target x86_64-unknown-linux-gnu
8790
cargo run --release --manifest-path=./no_std_test/Cargo.toml | grep -q "Verified Successfully"
8891
cargo run --release --features=alloc --manifest-path=./no_std_test/Cargo.toml | grep -q "Verified alloc Successfully"

0 commit comments

Comments
 (0)