Skip to content

Commit 0e689c7

Browse files
committed
Merge #574: Overcome ASAN false positive regression
5a3f13e Overcome ASAN false positive regression (Tobin C. Harding) Pull request description: 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]). Props to elichai for working this out: #573 (comment) [0] rust-lang/rust#107149 ACKs for top commit: apoelstra: ACK 5a3f13e Tree-SHA512: 873145b732f7574c93ecc1bbabd9d82a1e501a39d1e2184770f71a07ffb72468783ab1b3fbfef8ef377c7e7a4b8c45253da1fce11660152d3369902136f1c049
2 parents be94e6c + 5a3f13e commit 0e689c7

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

contrib/test.sh

+4-2
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,10 @@ if [ "$DO_ASAN" = true ]; then
8181
ASAN_OPTIONS='detect_leaks=1 detect_invalid_pointer_pairs=1 detect_stack_use_after_return=1' \
8282
cargo test --lib --all --features="$FEATURES" -Zbuild-std --target x86_64-unknown-linux-gnu
8383
cargo clean
84-
CC='clang -fsanitize=memory -fno-omit-frame-pointer' \
85-
RUSTFLAGS='-Zsanitizer=memory -Zsanitizer-memory-track-origins -Cforce-frame-pointers=yes' \
84+
# The -Cllvm-args=-msan-eager-checks=0 flag was added to overcome this issue:
85+
# https://github.com/rust-bitcoin/rust-secp256k1/pull/573#issuecomment-1399465995
86+
CC='clang -fsanitize=memory -fno-omit-frame-pointer' \
87+
RUSTFLAGS='-Zsanitizer=memory -Zsanitizer-memory-track-origins -Cforce-frame-pointers=yes -Cllvm-args=-msan-eager-checks=0' \
8688
cargo test --lib --all --features="$FEATURES" -Zbuild-std --target x86_64-unknown-linux-gnu
8789
cargo run --release --manifest-path=./no_std_test/Cargo.toml | grep -q "Verified Successfully"
8890
cargo run --release --features=alloc --manifest-path=./no_std_test/Cargo.toml | grep -q "Verified alloc Successfully"

0 commit comments

Comments
 (0)