Direct leak of 7 byte(s) in 1 object(s) allocated from:
#0 0x5e9c3441ed12 in __interceptor_malloc (/tmp/autopkgtest.oXC2FP/autopkgtest_tmp/build/tests/Output/test_leaksan.c.tmp+0xa3d12) (BuildId: 6f71ac388125722ade1ea86ee3661c0d884dd193)
#1 0x5e9c3445acb8 in main /tmp/autopkgtest.oXC2FP/autopkgtest_tmp/tests/test_leaksan.c:13:7
#2 0x7e84e1e280cf (/lib/x86_64-linux-gnu/libc.so.6+0x280cf) (BuildId: f0b834daa3d05a80967e9ec2f990a1ea71c958fa)
SUMMARY: AddressSanitizer: 7 byte(s) leaked in 1 allocation(s).
ubuntu@autopkgtest:/tmp/autopkgtest.oXC2FP/autopkgtest_tmp/build/tests/Output$ ./test_leaksan.c.tmp
Direct leak of 7 byte(s) in 1 object(s) allocated from:
#0 0x5f19be5f6d12 in __interceptor_malloc (/tmp/autopkgtest.oXC2FP/autopkgtest_tmp/build/tests/Output/test_leaksan.c.tmp+0xa3d12) (BuildId: 6f71ac388125722ade1ea86ee3661c0d884dd193)
#1 0x5f19be632cb8 in main /tmp/autopkgtest.oXC2FP/autopkgtest_tmp/tests/test_leaksan.c:13:7
#2 0x77c7d3c280cf (/lib/x86_64-linux-gnu/libc.so.6+0x280cf) (BuildId: f0b834daa3d05a80967e9ec2f990a1ea71c958fa)
SUMMARY: AddressSanitizer: 7 byte(s) leaked in 1 allocation(s).
Some tests related to the address sanitizer are occasionally failing on amd64 (also for llvm-toolchain-15):
-------------- ******* ****** TEST 'LLVM regression suite :: test_leaksan.c' FAILED ******* ******* ****** t.gHVujV/ autopkgtest_ tmp/build/ tests/Output/ test_leaksan. c.tmp -fsanitize=address -g /tmp/autopkgtes t.gHVujV/ autopkgtest_ tmp/tests/ test_leaksan. c "log_path= stdout: exitcode= 0" /tmp/autopkgtes t.gHVujV/ autopkgtest_ tmp/build/ tests/Output/ test_leaksan. c.tmp 2>&1 > /tmp/autopkgtes t.gHVujV/ autopkgtest_ tmp/build/ tests/Output/ test_leaksan. c.tmp.out t.gHVujV/ autopkgtest_ tmp/build/ tests/Output/ test_leaksan. c.tmp.out t.gHVujV/ autopkgtest_ tmp/build/ tests/Output/ test_leaksan. c.script: line 3: 3335 Segmentation fault (core dumped) env ASAN_OPTIONS= "log_path= stdout: exitcode= 0" /tmp/autopkgtes t.gHVujV/ autopkgtest_ tmp/build/ tests/Output/ test_leaksan. c.tmp 2>&1 > /tmp/autopkgtes t.gHVujV/ autopkgtest_ tmp/build/ tests/Output/ test_leaksan. c.tmp.out
FAIL: LLVM regression suite :: test_leaksan.c (38 of 45)
746s *******
746s Script:
746s --
746s : 'RUN: at line 4'; /usr/bin/clang-14 -o /tmp/autopkgtes
746s : 'RUN: at line 5'; env ASAN_OPTIONS=
746s : 'RUN: at line 6'; grep -q "detected memory leaks" /tmp/autopkgtes
746s --
746s Exit Code: 139
746s
746s Command Output (stderr):
746s --
746s /tmp/autopkgtes
--------------
If you run the test manually you'll notice that it works but eventually crashes:
------- ------- ------ autopkgtest: /tmp/autopkgtes t.oXC2FP/ autopkgtest_ tmp/build/ tests/Output$ ./test_ leaksan. c.tmp
ubuntu@
======= ======= ======= ======= ======= ======= ======= ======= ======= ==
==8631==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 7 byte(s) in 1 object(s) allocated from: malloc (/tmp/autopkgte st.oXC2FP/ autopkgtest_ tmp/build/ tests/Output/ test_leaksan. c.tmp+0xa3d12) (BuildId: 6f71ac388125722 ade1ea86ee3661c 0d884dd193) t.oXC2FP/ autopkgtest_ tmp/tests/ test_leaksan. c:13:7 64-linux- gnu/libc. so.6+0x280cf) (BuildId: f0b834daa3d05a8 0967e9ec2f990a1 ea71c958fa)
#0 0x5e9c3441ed12 in __interceptor_
#1 0x5e9c3445acb8 in main /tmp/autopkgtes
#2 0x7e84e1e280cf (/lib/x86_
SUMMARY: AddressSanitizer: 7 byte(s) leaked in 1 allocation(s). autopkgtest: /tmp/autopkgtes t.oXC2FP/ autopkgtest_ tmp/build/ tests/Output$ ./test_ leaksan. c.tmp
ubuntu@
======= ======= ======= ======= ======= ======= ======= ======= ======= ==
==8634==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 7 byte(s) in 1 object(s) allocated from: malloc (/tmp/autopkgte st.oXC2FP/ autopkgtest_ tmp/build/ tests/Output/ test_leaksan. c.tmp+0xa3d12) (BuildId: 6f71ac388125722 ade1ea86ee3661c 0d884dd193) t.oXC2FP/ autopkgtest_ tmp/tests/ test_leaksan. c:13:7 64-linux- gnu/libc. so.6+0x280cf) (BuildId: f0b834daa3d05a8 0967e9ec2f990a1 ea71c958fa)
#0 0x5f19be5f6d12 in __interceptor_
#1 0x5f19be632cb8 in main /tmp/autopkgtes
#2 0x77c7d3c280cf (/lib/x86_
SUMMARY: AddressSanitizer: 7 byte(s) leaked in 1 allocation(s).
ubuntu@ autopkgtest: /tmp/autopkgtes t.oXC2FP/ autopkgtest_ tmp/build/ tests/Output$ ./test_ leaksan. c.tmp ------- ------
Segmentation fault (core dumped)
-------
After some investigation I found that it will not fail with ASLR disabled:
sudo sysctl kernel. randomize_ va_space= 0
while : ; do env ASAN_OPTIONS= "log_path= stdout: exitcode= 0" ./test_ leaksan. c.tmp >/dev/null; if [ $? -ne 0 ] ; then echo crashed ; fi done
If you enable ASLR it will start to crash:
$ sudo sysctl kernel. randomize_ va_space= 2
$ while : ; do env ASAN_OPTIONS= "log_path= stdout: exitcode= 0" ./test_ leaksan. c.tmp >/dev/null; if [ $? -ne 0 ] ; then echo crashed ; fi done
Segmentation fault (core dumped)
crashed
Segmentation fault (core dumped)
crashed
Segmentation fault (core dumped)
crashed
Segmentation fault (core dumped)
crashed
Segmentation fault (core dumped)
crashed
If you and ASLR again and run it with "setarch -R" (to disable ASLR for this binary), it will also not crash.