-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
compiler-rt/sanitizers/aarch64: CHECK failed: sanitizer_allocator_primary64.h:133 #65144
Comments
Seems I'm encountering the same issue on rockchip RK3588. firefly@firefly ~> clang -fsanitize=memory ./hello.c -o hello
firefly@firefly ~> ./hello
MemorySanitizer: CHECK failed: sanitizer_allocator_primary64.h:133 "((kSpaceBeg)) == ((address_range.Init(TotalSpaceSize, PrimaryAllocatorName, kSpaceBeg)))" (0xe00000000000, 0xfffffffffffffff4) (tid=51745)
<empty stack>
firefly@firefly ~ [1]> clang --version
clang version 17.0.1 (http://git.linaro.org/toolchain/jenkins-scripts.git 09f505cadfbe9987730e641398ab9a2ca0cdb67f)
Target: aarch64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/firefly/clang+llvm-17.0.1-aarch64-linux-gnu/bin
firefly@firefly ~> uname -a
Linux firefly 5.10.160 #111 SMP Tue Jul 4 11:41:59 CST 2023 aarch64 GNU/Linux |
firefly@firefly ~> lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 11 (bullseye)
Release: 11
Codename: bullseye |
Same problem here with clang 19.1.1, ARM64, where VA size is 48bits crashing before program even starts.
|
Same problem with my g++ 13.2.0 |
Can confirm that the issue does not occur with Yocto |
When using the -fsanitize=address CXX_FLAG for a program compiled for aarch64 / arm64 This is happing: MemorySanitizer: CHECK failed: sanitizer_allocator_primary64.h:133 "((kSpaceBeg)) == ((address_range.Init(TotalSpaceSize, PrimaryAllocatorName, kSpaceBeg)))" (0xe00000000000, 0xfffffffffffffff4) (tid=51745) With -DSANITIZER_CAN_USE_ALLOCATOR64=0 this is not happening and potenial bugs are detected. ARM32 does not require this patch. More info about the issue in this thread: llvm/llvm-project#65144 (From OE-Core rev: 95a5357d8093c5c52205b9f78a4f906b41bf4caa) Signed-off-by: Thomas Roos <throos@amazon.de> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
When using the -fsanitize=address CXX_FLAG for a program compiled for aarch64 / arm64 This is happing: MemorySanitizer: CHECK failed: sanitizer_allocator_primary64.h:133 "((kSpaceBeg)) == ((address_range.Init(TotalSpaceSize, PrimaryAllocatorName, kSpaceBeg)))" (0xe00000000000, 0xfffffffffffffff4) (tid=51745) With -DSANITIZER_CAN_USE_ALLOCATOR64=0 this is not happening and potenial bugs are detected. ARM32 does not require this patch. More info about the issue in this thread: llvm/llvm-project#65144 Signed-off-by: Thomas Roos <throos@amazon.de> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
When using the -fsanitize=address CXX_FLAG for a program compiled for aarch64 / arm64 This is happing: MemorySanitizer: CHECK failed: sanitizer_allocator_primary64.h:133 "((kSpaceBeg)) == ((address_range.Init(TotalSpaceSize, PrimaryAllocatorName, kSpaceBeg)))" (0xe00000000000, 0xfffffffffffffff4) (tid=51745) With -DSANITIZER_CAN_USE_ALLOCATOR64=0 this is not happening and potenial bugs are detected. ARM32 does not require this patch. More info about the issue in this thread: llvm/llvm-project#65144 (From OE-Core rev: 95a5357d8093c5c52205b9f78a4f906b41bf4caa) Signed-off-by: Thomas Roos <throos@amazon.de> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
When using the -fsanitize=address CXX_FLAG for a program compiled for aarch64 / arm64 This is happing: MemorySanitizer: CHECK failed: sanitizer_allocator_primary64.h:133 "((kSpaceBeg)) == ((address_range.Init(TotalSpaceSize, PrimaryAllocatorName, kSpaceBeg)))" (0xe00000000000, 0xfffffffffffffff4) (tid=51745) With -DSANITIZER_CAN_USE_ALLOCATOR64=0 this is not happening and potenial bugs are detected. ARM32 does not require this patch. More info about the issue in this thread: llvm/llvm-project#65144 (From OE-Core rev: da4b97eb982c6202d308578499527445db6055d4) Signed-off-by: Thomas Roos <throos@amazon.de> Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
When using the -fsanitize=address CXX_FLAG for a program compiled for aarch64 / arm64 This is happing: MemorySanitizer: CHECK failed: sanitizer_allocator_primary64.h:133 "((kSpaceBeg)) == ((address_range.Init(TotalSpaceSize, PrimaryAllocatorName, kSpaceBeg)))" (0xe00000000000, 0xfffffffffffffff4) (tid=51745) With -DSANITIZER_CAN_USE_ALLOCATOR64=0 this is not happening and potenial bugs are detected. ARM32 does not require this patch. More info about the issue in this thread: llvm/llvm-project#65144 (From OE-Core rev: 868981e0fccfe7c87b79c07e4e49a503da6f91cd) Signed-off-by: Thomas Roos <throos@amazon.de> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
When using the -fsanitize=address CXX_FLAG for a program compiled for aarch64 / arm64 This is happing: MemorySanitizer: CHECK failed: sanitizer_allocator_primary64.h:133 "((kSpaceBeg)) == ((address_range.Init(TotalSpaceSize, PrimaryAllocatorName, kSpaceBeg)))" (0xe00000000000, 0xfffffffffffffff4) (tid=51745) With -DSANITIZER_CAN_USE_ALLOCATOR64=0 this is not happening and potenial bugs are detected. ARM32 does not require this patch. More info about the issue in this thread: llvm/llvm-project#65144 Signed-off-by: Thomas Roos <throos@amazon.de> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
When using the -fsanitize=address CXX_FLAG for a program compiled for aarch64 / arm64 This is happing: MemorySanitizer: CHECK failed: sanitizer_allocator_primary64.h:133 "((kSpaceBeg)) == ((address_range.Init(TotalSpaceSize, PrimaryAllocatorName, kSpaceBeg)))" (0xe00000000000, 0xfffffffffffffff4) (tid=51745) With -DSANITIZER_CAN_USE_ALLOCATOR64=0 this is not happening and potenial bugs are detected. ARM32 does not require this patch. More info about the issue in this thread: llvm/llvm-project#65144 (From OE-Core rev: 1ef4ba40b792597490d2ff973453084a192f0545) Signed-off-by: Thomas Roos <throos@amazon.de> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
When using the -fsanitize=address CXX_FLAG for a program compiled for aarch64 / arm64 This is happing: MemorySanitizer: CHECK failed: sanitizer_allocator_primary64.h:133 "((kSpaceBeg)) == ((address_range.Init(TotalSpaceSize, PrimaryAllocatorName, kSpaceBeg)))" (0xe00000000000, 0xfffffffffffffff4) (tid=51745) With -DSANITIZER_CAN_USE_ALLOCATOR64=0 this is not happening and potenial bugs are detected. ARM32 does not require this patch. More info about the issue in this thread: llvm/llvm-project#65144 Signed-off-by: Thomas Roos <throos@amazon.de> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
When using the -fsanitize=address CXX_FLAG for a program compiled for aarch64 / arm64 This is happing: MemorySanitizer: CHECK failed: sanitizer_allocator_primary64.h:133 "((kSpaceBeg)) == ((address_range.Init(TotalSpaceSize, PrimaryAllocatorName, kSpaceBeg)))" (0xe00000000000, 0xfffffffffffffff4) (tid=51745) With -DSANITIZER_CAN_USE_ALLOCATOR64=0 this is not happening and potenial bugs are detected. ARM32 does not require this patch. More info about the issue in this thread: llvm/llvm-project#65144 (From OE-Core rev: 1ef4ba40b792597490d2ff973453084a192f0545) Signed-off-by: Thomas Roos <throos@amazon.de> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
When using the -fsanitize=address CXX_FLAG for a program compiled for aarch64 / arm64 This is happing: MemorySanitizer: CHECK failed: sanitizer_allocator_primary64.h:133 "((kSpaceBeg)) == ((address_range.Init(TotalSpaceSize, PrimaryAllocatorName, kSpaceBeg)))" (0xe00000000000, 0xfffffffffffffff4) (tid=51745) With -DSANITIZER_CAN_USE_ALLOCATOR64=0 this is not happening and potenial bugs are detected. ARM32 does not require this patch. More info about the issue in this thread: llvm/llvm-project#65144 (From OE-Core rev: da4b97eb982c6202d308578499527445db6055d4) Signed-off-by: Thomas Roos <throos@amazon.de> Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
When using the -fsanitize=address CXX_FLAG for a program compiled for aarch64 / arm64 This is happing: MemorySanitizer: CHECK failed: sanitizer_allocator_primary64.h:133 "((kSpaceBeg)) == ((address_range.Init(TotalSpaceSize, PrimaryAllocatorName, kSpaceBeg)))" (0xe00000000000, 0xfffffffffffffff4) (tid=51745) With -DSANITIZER_CAN_USE_ALLOCATOR64=0 this is not happening and potenial bugs are detected. ARM32 does not require this patch. More info about the issue in this thread: llvm/llvm-project#65144 Signed-off-by: Thomas Roos <throos@amazon.de> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Ross Burton <ross.burton@arm.com>
When using the -fsanitize=address CXX_FLAG for a program compiled for aarch64 / arm64 This is happing: MemorySanitizer: CHECK failed: sanitizer_allocator_primary64.h:133 "((kSpaceBeg)) == ((address_range.Init(TotalSpaceSize, PrimaryAllocatorName, kSpaceBeg)))" (0xe00000000000, 0xfffffffffffffff4) (tid=51745) With -DSANITIZER_CAN_USE_ALLOCATOR64=0 this is not happening and potenial bugs are detected. ARM32 does not require this patch. More info about the issue in this thread: llvm/llvm-project#65144 (From OE-Core rev: 12442b9b6df06317174066854935b1d6a4f1865d) Signed-off-by: Thomas Roos <throos@amazon.de> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Ross Burton <ross.burton@arm.com>
When using the -fsanitize=address CXX_FLAG for a program compiled for aarch64 / arm64 This is happing: MemorySanitizer: CHECK failed: sanitizer_allocator_primary64.h:133 "((kSpaceBeg)) == ((address_range.Init(TotalSpaceSize, PrimaryAllocatorName, kSpaceBeg)))" (0xe00000000000, 0xfffffffffffffff4) (tid=51745) With -DSANITIZER_CAN_USE_ALLOCATOR64=0 this is not happening and potenial bugs are detected. ARM32 does not require this patch. More info about the issue in this thread: llvm/llvm-project#65144 (From OE-Core rev: 12442b9b6df06317174066854935b1d6a4f1865d) Signed-off-by: Thomas Roos <throosamazon.de> Signed-off-by: Richard Purdie <richard.purdielinuxfoundation.org> Signed-off-by: Ross Burton <ross.burtonarm.com>
When using the -fsanitize=address CXX_FLAG for a program compiled for aarch64 / arm64 This is happing: MemorySanitizer: CHECK failed: sanitizer_allocator_primary64.h:133 "((kSpaceBeg)) == ((address_range.Init(TotalSpaceSize, PrimaryAllocatorName, kSpaceBeg)))" (0xe00000000000, 0xfffffffffffffff4) (tid=51745) With -DSANITIZER_CAN_USE_ALLOCATOR64=0 this is not happening and potenial bugs are detected. ARM32 does not require this patch. More info about the issue in this thread: llvm/llvm-project#65144 (From OE-Core rev: 12442b9b6df06317174066854935b1d6a4f1865d) Signed-off-by: Thomas Roos <throosamazon.de> Signed-off-by: Richard Purdie <richard.purdielinuxfoundation.org> Signed-off-by: Ross Burton <ross.burtonarm.com>
When using the -fsanitize=address CXX_FLAG for a program compiled for aarch64 / arm64 This is happing: MemorySanitizer: CHECK failed: sanitizer_allocator_primary64.h:133 "((kSpaceBeg)) == ((address_range.Init(TotalSpaceSize, PrimaryAllocatorName, kSpaceBeg)))" (0xe00000000000, 0xfffffffffffffff4) (tid=51745) With -DSANITIZER_CAN_USE_ALLOCATOR64=0 this is not happening and potenial bugs are detected. ARM32 does not require this patch. More info about the issue in this thread: llvm/llvm-project#65144 (From OE-Core rev: 12442b9b6df06317174066854935b1d6a4f1865d) Signed-off-by: Thomas Roos <throosamazon.de> Signed-off-by: Richard Purdie <richard.purdielinuxfoundation.org> Signed-off-by: Ross Burton <ross.burtonarm.com>
Symptoms
MSan fails to init with
Environment
This is when running an MSan-instrumented aarch64 binary via
qemu-aarch64
. I'm using a clang snapshot:People report similar issues on Raspberry Pi 4, with ASan, and with Clang 16 and Clang 17, while Clang 15 works:
So this seems to be a regression between 15 and 16.
Possible causes and fix
I have a strong suspicion that the reason for this is the commit a588cfe, but I haven't tested recompiling with
-DSANITIZER_CAN_USE_ALLOCATOR64=0
.When I use qemu's strace functionality, I get this just before the crash:
And note that the value
0xfffffffffffffff4
from the assertion is equal to-12
. Here,0x0000e00000000000
is a 48-bit address, but perhaps QEMU's emulation supports only smaller (39 bits)? [1] I suspect that the Raspberry Pi 4 also has a virtual address space smaller than 48 bits. When I try this with Clang 14, I see only mmap calls up to address0x0000006000000000
(which is a 39-bit address).The AArch64 memory layout on Linux can vary a lot (https://www.kernel.org/doc/html/v5.8/arm64/memory.html). Possible virtual address sizes are 39 bits, 42 bits, 48 bits, and 52 bits. Perhaps it's a good idea to detect this at runtime in the 64-bit allocator?
(note: Not sure if this is the right place to report. It seems to me that this is a compiler-rt issue, which seems to be tracked here? But please close if the existing google/sanitizers#1674 is a better place to track this.)
edit:
[1] After some more experimentation, I am not convinced that's true. I see QEMU placing the code 47-bit addresses. So I don't know why it doesn't like
0x0000e00000000000
. Its emulation of the Linux memory layout may not be perfect. I might reach out to them. But this does not change much about the validity of this bug, which still seems to occur on Raspberry Pi (without any emulation layer).The text was updated successfully, but these errors were encountered: