Skip to content

Commit

Permalink
Overcome ASAN false positive regression
Browse files Browse the repository at this point in the history
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
  • Loading branch information
tcharding committed Jan 22, 2023
1 parent be94e6c commit 5a3f13e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions contrib/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,10 @@ if [ "$DO_ASAN" = true ]; then
ASAN_OPTIONS='detect_leaks=1 detect_invalid_pointer_pairs=1 detect_stack_use_after_return=1' \
cargo test --lib --all --features="$FEATURES" -Zbuild-std --target x86_64-unknown-linux-gnu
cargo clean
CC='clang -fsanitize=memory -fno-omit-frame-pointer' \
RUSTFLAGS='-Zsanitizer=memory -Zsanitizer-memory-track-origins -Cforce-frame-pointers=yes' \
# The -Cllvm-args=-msan-eager-checks=0 flag was added to overcome this issue:
# https://github.com/rust-bitcoin/rust-secp256k1/pull/573#issuecomment-1399465995
CC='clang -fsanitize=memory -fno-omit-frame-pointer' \
RUSTFLAGS='-Zsanitizer=memory -Zsanitizer-memory-track-origins -Cforce-frame-pointers=yes -Cllvm-args=-msan-eager-checks=0' \
cargo test --lib --all --features="$FEATURES" -Zbuild-std --target x86_64-unknown-linux-gnu
cargo run --release --manifest-path=./no_std_test/Cargo.toml | grep -q "Verified Successfully"
cargo run --release --features=alloc --manifest-path=./no_std_test/Cargo.toml | grep -q "Verified alloc Successfully"
Expand Down

0 comments on commit 5a3f13e

Please sign in to comment.