Whenever I run any c++ code, regardless of its contents, I sometimes randomly get the following error:
AddressSanitizer:DEADLYSIGNAL
AddressSanitizer:DEADLYSIGNAL
AddressSanitizer:DEADLYSIGNAL
AddressSanitizer:DEADLYSIGNAL
AddressSanitizer:DEADLYSIGNAL
AddressSanitizer:DEADLYSIGNAL
AddressSanitizer:DEADLYSIGNAL
Segmentation fault (core dumped)
I am on Ubuntu 23.10 with kernel version: Linux 6.5.0-25-generic x86_64. Using the g++ 13.2.0 compiler. The code content really doesn't matter, a basic Hello World program causes the issue. I am compiling with the following flags: g++ test.cpp -std=c++23 -fsanitize=address -o test
The problem seems to come from using the following flag:
-fsanitize=address
I noticed that this only started happening when I start messing with a code with dynamic memory allocation, I also sometimes got memory leakage out of nowhere. I thought the problem will disappear when I wrote normal codes again, but that wasn't the case.
When I tried running the following command:
ulimit -s unlimited
And running the code again, I got a new error:
==18240==Shadow memory range interleaves with an existing memory mapping. ASan cannot proceed correctly. ABORTING.
==18240==ASan shadow was supposed to be located in the \[0x00007fff7000-0x10007fff7fff\] range.
==18240==This might be related to ELF_ET_DYN_BASE change in Linux 4.12.
==18240==See https://github.com/google/sanitizers/issues/856 for possible workarounds.
==18240==Process memory map follows:
0x0f0051f00000-0x0f0052000000
0x0f0052100000-0x0f0052200000
0x0f0052300000-0x0f0052400000
0x0f0052500000-0x0f0052600000
0x0f0052700000-0x0f0052800000
0x0f0052872000-0x0f0052c00000
0x0f0052c00000-0x0f0052c26000 /usr/lib/x86_64-linux-gnu/libc.so.6
0x0f0052c26000-0x0f0052da5000 /usr/lib/x86_64-linux-gnu/libc.so.6
0x0f0052da5000-0x0f0052dfa000 /usr/lib/x86_64-linux-gnu/libc.so.6
0x0f0052dfa000-0x0f0052dfe000 /usr/lib/x86_64-linux-gnu/libc.so.6
0x0f0052dfe000-0x0f0052e00000 /usr/lib/x86_64-linux-gnu/libc.so.6
0x0f0052e00000-0x0f0052e0d000
0x0f0053000000-0x0f005309c000 /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.32
0x0f005309c000-0x0f00531cd000 /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.32
0x0f00531cd000-0x0f005325a000 /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.32
0x0f005325a000-0x0f0053265000 /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.32
0x0f0053265000-0x0f0053268000 /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.32
0x0f0053268000-0x0f005326c000
0x0f0053400000-0x0f0053425000 /usr/lib/x86_64-linux-gnu/libasan.so.8.0.0
0x0f0053425000-0x0f0053534000 /usr/lib/x86_64-linux-gnu/libasan.so.8.0.0
0x0f0053534000-0x0f0053569000 /usr/lib/x86_64-linux-gnu/libasan.so.8.0.0
0x0f0053569000-0x0f005356d000 /usr/lib/x86_64-linux-gnu/libasan.so.8.0.0
0x0f005356d000-0x0f0053570000 /usr/lib/x86_64-linux-gnu/libasan.so.8.0.0
0x0f0053570000-0x0f0053aa4000
0x0f0053b57000-0x0f0053b6c000
0x0f0053b6c000-0x0f0053b6f000 /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
0x0f0053b6f000-0x0f0053b8a000 /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
0x0f0053b8a000-0x0f0053b8e000 /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
0x0f0053b8e000-0x0f0053b8f000 /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
0x0f0053b8f000-0x0f0053b90000 /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
0x0f0053b90000-0x0f0053ba0000 /usr/lib/x86_64-linux-gnu/libm.so.6
0x0f0053ba0000-0x0f0053c20000 /usr/lib/x86_64-linux-gnu/libm.so.6
0x0f0053c20000-0x0f0053c79000 /usr/lib/x86_64-linux-gnu/libm.so.6
0x0f0053c79000-0x0f0053c7a000 /usr/lib/x86_64-linux-gnu/libm.so.6
0x0f0053c7a000-0x0f0053c7b000 /usr/lib/x86_64-linux-gnu/libm.so.6
0x0f0053c82000-0x0f0053c90000
0x0f0053c90000-0x0f0053c91000 /usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2
0x0f0053c91000-0x0f0053cbb000 /usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2
0x0f0053cbb000-0x0f0053cc5000 /usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2
0x0f0053cc5000-0x0f0053cc7000 /usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2
0x0f0053cc7000-0x0f0053cc9000 /usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2
0x5e446ea4f000-0x5e446ea50000 /home/x/Desktop/test
0x5e446ea50000-0x5e446ea51000 /home/x/Desktop/test
0x5e446ea51000-0x5e446ea52000 /home/x/Desktop/test
0x5e446ea52000-0x5e446ea53000 /home/x/Desktop/test
0x5e446ea53000-0x5e446ea54000 /home/x/Desktop/test
0x7ffce680d000-0x7ffce682e000 \[stack\]
0x7ffce68d0000-0x7ffce68d4000 \[vvar\]
0x7ffce68d4000-0x7ffce68d6000 \[vdso\]
0xffffffffff600000-0xffffffffff601000 \[vsyscall\]
==18240==End of process memory map.
Is there someway to prevent this?
@TheFortyTwo Thankyou for you post. I have the same experience. I am using sanitizer with gtest. Approximately every third time I execute the tests I get endless list AddressSanitizer:DEADLYSIGNAL. I have also narrowed it down to be independent of my code.
So, I was thinking it had to be gtest
or the sanitizer itself. I am on Ubuntu 22.04.4 LTS, kernel 6.5.0-25-generic and gcc(Ubuntu 11.4.0~22.04) 11.4.0.
Found this post that may be the solution: Possible Bug in GCC Sanitizers?
Will try to upgrade gcc-libs as suggested there.