Description
In rust-random/getrandom#681 I discovered that MSAN doesn't work correctly in QEMU user space emulation in its default configuration, and so we cannot use memory sanitizer when using cross-rs. This is a known issue; see llvm/llvm-project#65144. From the LLVM issue comment llvm/llvm-project#65144 (comment):
Can confirm that the issue does not occur with Yocto
Compiling with setting -DSANITIZER_CAN_USE_ALLOCATOR64=0
So, should we build with SANITIZER_CAN_USE_ALLOCATOR64=0 on AArch64 Linux to facilitate this configuration?
(Note that while GitHub Actions does have ARM64 Linux runners now, they don't work in private repos, so people are often still using cross, as it supports PR workflows better.)
RUSTFLAGS=-Dwarnings -Zsanitizer=memory \
RUSTDOCFLAGS=-Dwarnings -Zsanitizer=memory \
cross test --no-fail-fast -Zbuild-std --target=aarch64-unknown-linux-gnu
Output (copied from the comments of the aforementioned getrandom
PR:
---- src/lib.rs - (line 162) stdout ----
Test executable failed (exit status: 1).
stderr:
MemorySanitizer: CHECK failed: sanitizer_allocator_primary64.h:133 "((kSpaceBeg)) == ((address_range.Init(TotalSpaceSize, PrimaryAllocatorName, kSpaceBeg)))" (0xe00000000000, 0xfffffffffffffff4) (tid=524)
<empty stack>
---- src/lib.rs - (line 187) stdout ----
Test executable failed (exit status: 1).
stderr:
MemorySanitizer: CHECK failed: sanitizer_allocator_primary64.h:133 "((kSpaceBeg)) == ((address_range.Init(TotalSpaceSize, PrimaryAllocatorName, kSpaceBeg)))" (0xe00000000000, 0xfffffffffffffff4) (tid=538)
<empty stack>
---- src/lib.rs - (line 36) stdout ----
Test executable failed (exit status: 1).
stderr:
MemorySanitizer: CHECK failed: sanitizer_allocator_primary64.h:133 "((kSpaceBeg)) == ((address_range.Init(TotalSpaceSize, PrimaryAllocatorName, kSpaceBeg)))" (0xe00000000000, 0xfffffffffffffff4) (tid=552)
<empty stack>
---- src/lib.rs - fill (line 59) stdout ----
Test executable failed (exit status: 1).
stderr:
MemorySanitizer: CHECK failed: sanitizer_allocator_primary64.h:133 "((kSpaceBeg)) == ((address_range.Init(TotalSpaceSize, PrimaryAllocatorName, kSpaceBeg)))" (0xe00000000000, 0xfffffffffffffff4) (tid=566)
<empty stack>
---- src/lib.rs - u32 (line 121) stdout ----
Test executable failed (exit status: 1).
stderr:
MemorySanitizer: CHECK failed: sanitizer_allocator_primary64.h:133 "((kSpaceBeg)) == ((address_range.Init(TotalSpaceSize, PrimaryAllocatorName, kSpaceBeg)))" (0xe00000000000, 0xfffffffffffffff4) (tid=580)
<empty stack>
---- src/lib.rs - u64 (line 135) stdout ----
Test executable failed (exit status: 1).
stderr:
MemorySanitizer: CHECK failed: sanitizer_allocator_primary64.h:133 "((kSpaceBeg)) == ((address_range.Init(TotalSpaceSize, PrimaryAllocatorName, kSpaceBeg)))" (0xe00000000000, 0xfffffffffffffff4) (tid=594)
<empty stack>