google / sanitizers

AddressSanitizer, ThreadSanitizer, MemorySanitizer
Other
11.5k stars 1.04k forks source link

Sanitizer CHECK failed: ../../.././libsanitizer/sanitizer_common/sanitizer_allocator_primary64.h:73 ((kSpaceBeg)) == ((address_range.Init(TotalSpaceSize, PrimaryAllocatorName, kSpaceBeg))) (105553116266496, -12) #1329

Open jerryc05 opened 4 years ago

jerryc05 commented 4 years ago

I got this error when I was running on a remote Fedora Linux machine via ssh:

$ cat test.cpp
int main(){
   int* arr=new int[10];
   return 0;
}
$ ./a.out
==16497==Sanitizer CHECK failed: ../../.././libsanitizer/sanitizer_common/sanitizer_allocator_primary64.h:73 ((kSpaceBeg)) == ((address_range.Init(TotalSpaceSize, PrimaryAllocatorName, kSpaceBeg))) (105553116266496, -12)
$ ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 86191
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1024
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) 21600
max user processes              (-u) 500
virtual memory          (kbytes, -v) 9000000
file locks                      (-x) unlimited

This is similar to #1243, but I was using the regular asan, not hwasan.

Note that I only encountered this error on this particular remote machine. ASAN worked very well on my local machines. Any clue?

dmoody256 commented 2 years ago

@jerryc05 I ran into this and set the ulimit -v to unlimited to get past it.

madler commented 1 year ago

I am seeing the same thing with a fresh install of clang/llvm 16 (16.0.6) from apt.llvm.org using bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)" on a Raspberry Pi 3. Both ASAN and MSAN fail before the program is even run. Compiling and attempting to run the standard hello world C program gives:

$ clang-16 -fsanitize=address -o hello hello.c && ./hello
AddressSanitizer: CHECK failed: sanitizer_allocator_primary64.h:133 "((kSpaceBeg)) == ((address_range.Init(TotalSpaceSize, PrimaryAllocatorName, kSpaceBeg)))" (0x600000000000, 0xfffffffffffffff4) (tid=6629)
    <empty stack>

$ clang-16 -fsanitize=memory -o hello hello.c && ./hello
MemorySanitizer: CHECK failed: sanitizer_allocator_primary64.h:133 "((kSpaceBeg)) == ((address_range.Init(TotalSpaceSize, PrimaryAllocatorName, kSpaceBeg)))" (0xe00000000000, 0xfffffffffffffff4) (tid=6633)
    <empty stack>

$

The virtual memory is set to unlimited:

$ ulimit -a
real-time non-blocking time  (microseconds, -R) unlimited
core file size              (blocks, -c) 0
data seg size               (kbytes, -d) unlimited
scheduling priority                 (-e) 0
file size                   (blocks, -f) unlimited
pending signals                     (-i) 2598
max locked memory           (kbytes, -l) 116429
max memory size             (kbytes, -m) unlimited
open files                          (-n) 1024
pipe size                (512 bytes, -p) 8
POSIX message queues         (bytes, -q) 819200
real-time priority                  (-r) 0
stack size                  (kbytes, -s) 8192
cpu time                   (seconds, -t) unlimited
max user processes                  (-u) 2598
virtual memory              (kbytes, -v) unlimited
file locks                          (-x) unlimited
madler commented 1 year ago

Same thing with clang 17.0.0 and 18.0.0.

$ clang-16 -fsanitize=memory -o hello hello.c && ./hello
MemorySanitizer: CHECK failed: sanitizer_allocator_primary64.h:133 "((kSpaceBeg)) == ((address_range.Init(TotalSpaceSize, PrimaryAllocatorName, kSpaceBeg)))" (0xe00000000000, 0xfffffffffffffff4) (tid=22663)
    <empty stack>

$ clang-17 -fsanitize=memory -o hello hello.c && ./hello
MemorySanitizer: CHECK failed: sanitizer_allocator_primary64.h:133 "((kSpaceBeg)) == ((address_range.Init(TotalSpaceSize, PrimaryAllocatorName, kSpaceBeg)))" (0xe00000000000, 0xfffffffffffffff4) (tid=22668)
    <empty stack>

$ clang-18 -fsanitize=memory -o hello hello.c && ./hello
MemorySanitizer: CHECK failed: sanitizer_allocator_primary64.h:133 "((kSpaceBeg)) == ((address_range.Init(TotalSpaceSize, PrimaryAllocatorName, kSpaceBeg)))" (0xe00000000000, 0xfffffffffffffff4) (tid=22672)
    <empty stack>
pmatos commented 1 month ago

Still same issue in 19.1.1 unfortunately - testing on ARM64 with 48bit VA size.