Hi Dimitri, I just tried it here. The same problem is happening with
kernel 6.7 and the same workaround (disabling ASLR) works.
Example of failure:
clang++-$VERSION -O1 -g -fsanitize=address -fno-omit-frame-pointer foo.cpp
ASAN_OPTIONS=verbosity=1 ./a.out &> foo.log || true
./debian/qualify-clang.sh: line 634: 4281 Segmentation fault (core
dumped) ASAN_OPTIONS=verbosity=1 ./a.out &> foo.log
if ! grep -q "Init done" foo.log; then
echo "asan verbose mode failed"
cat foo.log
exit 42
fi
asan verbose mode failed
==4281==Registered root region at 0x736c74f00b70 of size 48
==4281==Registered root region at 0x736c74b007a0 of size 32
==4281==Unregistered root region at 0x736c74f00b70 of size 48
==4281==Unregistered root region at 0x736c74b007a0 of size 32
==4281==AddressSanitizer: failed to intercept '__isoc99_printf'
==4281==Registered root region at 0x736c74f00b70 of size 48
==4281==Registered root region at 0x736c74b007a0 of size 32
==4281==Unregistered root region at 0x736c74f00b70 of size 48
==4281==Unregistered root region at 0x736c74b007a0 of size 32
==4281==AddressSanitizer: failed to intercept '__isoc99_sprintf'
==4281==Registered root region at 0x736c74f00b70 of size 48
==4281==Registered root region at 0x736c74b007a0 of size 32
==4281==Unregistered root region at 0x736c74f00b70 of size 48
==4281==Unregistered root region at 0x736c74b007a0 of size 32
==4281==AddressSanitizer: failed to intercept '__isoc99_snprintf'
==4281==Registered root region at 0x736c74f00b70 of size 48
==4281==Registered root region at 0x736c74b007a0 of size 32
==4281==Unregistered root region at 0x736c74f00b70 of size 48
==4281==Unregistered root region at 0x736c74b007a0 of size 32
==4281==AddressSanitizer: failed to intercept '__isoc99_fprintf'
....
==4281==Unregistered root region at 0x736c74b00780 of size 32
==4281==AddressSanitizer: failed to intercept 'crypt'
==4281==Registered root region at 0x736c74f00b70 of size 48
==4281==Registered root region at 0x736c74b00780 of size 32
==4281==Unregistered root region at 0x736c74f00b70 of size 48
==4281==Unregistered root region at 0x736c74b00780 of size 32
==4281==AddressSanitizer: failed to intercept 'crypt_r'
==4281==Registered root region at 0x736c74900f40 of size 64
==4281==Registered root region at 0x736c74b00780 of size 32
==4281==Unregistered root region at 0x736c74900f40 of size 64
==4281==Unregistered root region at 0x736c74b00780 of size 32
==4281==AddressSanitizer: failed to intercept '__cxa_rethrow_primary_exception'
==4281==AddressSanitizer: libc interceptors initialized
|| `[0x10007fff8000, 0x7fffffffffff]` || HighMem ||
|| `[0x02008fff7000, 0x10007fff7fff]` || HighShadow ||
|| `[0x00008fff7000, 0x02008fff6fff]` || ShadowGap ||
|| `[0x00007fff8000, 0x00008fff6fff]` || LowShadow ||
|| `[0x000000000000, 0x00007fff7fff]` || LowMem ||
MemToShadow(shadow): 0x00008fff7000 0x000091ff6dff 0x004091ff6e00 0x02008fff6fff
redzone=16
max_redzone=2048
quarantine_size_mb=256M
thread_local_quarantine_size_kb=1024K
malloc_context_size=30
SHADOW_SCALE: 3
SHADOW_GRANULARITY: 8
SHADOW_OFFSET: 0x7fff8000
==4281==Installed the sigaction for signal 11
==4281==Installed the sigaction for signal 7
==4281==Installed the sigaction for signal 8
autopkgtest [11:22:53]: test command1: -----------------------]
--
You received this bug notification because you are a member of Kernel
Packages, which is subscribed to linux in Ubuntu.
https://bugs.launchpad.net/bugs/2048768
Title:
Autopkgtest failures on amd64
Status in linux package in Ubuntu:
New
Status in llvm-toolchain-14 package in Ubuntu:
New
Status in linux source package in Noble:
New
Status in llvm-toolchain-14 source package in Noble:
New
Bug description:
Some tests related to the address sanitizer are occasionally failing
on amd64 (also for llvm-toolchain-15 and 16):
--------------
FAIL: LLVM regression suite :: test_leaksan.c (38 of 45)
746s ******************** TEST 'LLVM regression suite :: test_leaksan.c'
FAILED ********************
746s Script:
746s --
746s : 'RUN: at line 4'; /usr/bin/clang-14 -o
/tmp/autopkgtest.gHVujV/autopkgtest_tmp/build/tests/Output/test_leaksan.c.tmp
-fsanitize=address -g
/tmp/autopkgtest.gHVujV/autopkgtest_tmp/tests/test_leaksan.c
746s : 'RUN: at line 5'; env ASAN_OPTIONS="log_path=stdout:exitcode=0"
/tmp/autopkgtest.gHVujV/autopkgtest_tmp/build/tests/Output/test_leaksan.c.tmp
2>&1 >
/tmp/autopkgtest.gHVujV/autopkgtest_tmp/build/tests/Output/test_leaksan.c.tmp.out
746s : 'RUN: at line 6'; grep -q "detected memory leaks"
/tmp/autopkgtest.gHVujV/autopkgtest_tmp/build/tests/Output/test_leaksan.c.tmp.out
746s --
746s Exit Code: 139
746s
746s Command Output (stderr):
746s --
746s
/tmp/autopkgtest.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/autopkgtest.gHVujV/autopkgtest_tmp/build/tests/Output/test_leaksan.c.tmp
2>&1 >
/tmp/autopkgtest.gHVujV/autopkgtest_tmp/build/tests/Output/test_leaksan.c.tmp.out
--------------
If you run the test manually you'll notice that it works but
eventually crashes:
--------------------
ubuntu@autopkgtest:/tmp/autopkgtest.oXC2FP/autopkgtest_tmp/build/tests/Output$
./test_leaksan.c.tmp
=================================================================
==8631==ERROR: LeakSanitizer: detected memory leaks
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
=================================================================
==8634==ERROR: LeakSanitizer: detected memory leaks
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).
ubuntu@autopkgtest:/tmp/autopkgtest.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 enable ASLR again and run it with "setarch -R" (to disable ASLR
for this binary), it will also not crash.
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/2048768/+subscriptions
--
Mailing list: https://launchpad.net/~kernel-packages
Post to : [email protected]
Unsubscribe : https://launchpad.net/~kernel-packages
More help : https://help.launchpad.net/ListHelp