From 8edd802942cafdd4c3d63f96c8fc0a3f8eae7974 Mon Sep 17 00:00:00 2001 From: Evgeny Vereshchagin Date: Dec 15 2020 09:45:30 +0000 Subject: tests: add a wrapper for when systemd is built with ASAN (cherry picked from commit 1786fae3668fa94359ee58a8c11031dc46459255) patch_name: 0100-tests-add-a-wrapper-for-when-systemd-is-built-with-A.patch present_in_specfile: true location_in_specfile: 100 squash_commits: true --- diff --git a/test/test-functions b/test/test-functions index 4417301..a6f88e4 100644 --- a/test/test-functions +++ b/test/test-functions @@ -21,7 +21,7 @@ if ! ROOTLIBDIR=$(pkg-config --variable=systemdutildir systemd); then ROOTLIBDIR=/usr/lib/systemd fi -BASICTOOLS="test sh bash setsid loadkeys setfont login sulogin gzip sleep echo mount umount cryptsetup date dmsetup modprobe sed cmp tee rm true false chmod chown ln" +BASICTOOLS="test sh bash setsid loadkeys setfont login sulogin gzip sleep echo mount umount cryptsetup date dmsetup modprobe sed cmp tee rm true false chmod chown ln xargs" DEBUGTOOLS="df free ls stty cat ps ln ip route dmesg dhclient mkdir cp ping dhclient strace less grep id tty touch du sort hostname find" STATEDIR="${BUILD_DIR:-.}/test/$(basename $(dirname $(realpath $0)))" @@ -317,6 +317,39 @@ EOF chmod 0755 $_valgrind_wrapper } +create_asan_wrapper() { + local _asan_wrapper=$initdir/$ROOTLIBDIR/systemd-under-asan + ddebug "Create $_asan_wrapper" + cat >$_asan_wrapper <>/etc/systemd/system.conf + +# ASAN and syscall filters aren't compatible with each other. +find / -name '*.service' -type f | xargs sed -i 's/^\\(MemoryDeny\\|SystemCall\\)/#\\1/' + +export ASAN_OPTIONS=\$DEFAULT_ASAN_OPTIONS:log_path=/systemd.asan.log +exec $ROOTLIBDIR/systemd "\$@" +EOF + + chmod 0755 $_asan_wrapper +} + create_strace_wrapper() { local _strace_wrapper=$initdir/$ROOTLIBDIR/systemd-under-strace ddebug "Create $_strace_wrapper"