Reputation: 6936
I've already seen FATAL: ThreadSanitizer: unexpected memory mapping when running on Linux Kernels 6.6+ (for clang) and Thread sanitizer complaining of unexpected memory map (with an answer saying not to use -pie -fPIC which I'm not using).
Not that it would be actually relevant but here is a MRE:
#include <iostream>
int main()
{
std::cout << "Hello, world!\n";
}
g++ -g -o hw hw.cpp -fsanitize=thread -pthread
./hw
FATAL: ThreadSanitizer: unexpected memory mapping 0x80000004b000-0x80000004f000
This is on Rocky 8.9 x86_64. So far I suspect that this is an ASLR issue. I don't have root access so I can't check or change the values of vm.mmap_rnd_bits or vm.mmap_rnd_compat_bits. /proc/sys/kernel/randomize_va_space is zero.
I've tried clang++ 18.1.7 and it seems to work OK. I've tried a few other versions of GCC (8.5, 5.3) same problem.
I've also tried on a different machine at a different location. That worked OK. Again, I don't have root access and I don't know exactly how the machines were configured. I've opened a support ticket with our IT.
EDIT: Both machines have vm.mmap_rnd_bits = 28
Upvotes: 2
Views: 523