From: Frantisek Sumsal Date: Fri, 23 Jun 2023 12:28:30 +0000 (+0200) Subject: test: make sure we get PID1's stack trace on ASan/UBSan errors X-Git-Tag: v254-rc1~128^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=88c98cb2614a2893ec2ae7197a1f234b579da7a7;p=thirdparty%2Fsystemd.git test: make sure we get PID1's stack trace on ASan/UBSan errors As hitting an ASan/UBSan error in PID1 results in a crash (and a kernel panic when running under qemu), we usually lose the stack trace which makes debugging quite painful. Let's mitigate this by forwarding the stack trace to multiple places - namely to a file and the syslog. --- diff --git a/test/test-functions b/test/test-functions index d57594f17bb..abbe0c2e2c7 100644 --- a/test/test-functions +++ b/test/test-functions @@ -914,7 +914,7 @@ EOF } create_asan_wrapper() { - local asan_wrapper default_asan_options default_ubsan_options default_environment + local asan_wrapper default_asan_options default_ubsan_options default_environment manager_environment [[ -z "$ASAN_RT_PATH" ]] && dfatal "ASAN_RT_PATH is empty, but it shouldn't be" @@ -948,12 +948,17 @@ EOF "UBSAN_OPTIONS='$default_ubsan_options'" "ASAN_RT_PATH='$ASAN_RT_PATH'" ) + manager_environment=( + "ASAN_OPTIONS='$default_asan_options:log_path=/systemd-pid1.asan.log:log_to_syslog=1'" + "UBSAN_OPTIONS='$default_ubsan_options:log_path=/systemd-pid1.ubsan.log:log_to_syslog=1'" + "ASAN_RT_PATH='$ASAN_RT_PATH'" + ) mkdir -p "${initdir:?}/etc/systemd/system.conf.d/" cat >"${initdir:?}/etc/systemd/system.conf.d/asan.conf" <