diff --git a/mkosi/mkosi.sanitizers/mkosi.postinst b/mkosi/mkosi.sanitizers/mkosi.postinst index 88ba2c2bc0..f420a31b63 100755 --- a/mkosi/mkosi.sanitizers/mkosi.postinst +++ b/mkosi/mkosi.sanitizers/mkosi.postinst @@ -9,13 +9,17 @@ if [[ ! -f "$BUILDROOT/$LIBSYSTEMD" ]]; then exit 0 fi -# ASAN and syscall filters aren't compatible with each other. -find "$BUILDROOT"/usr "$BUILDROOT"/etc -name '*.service' -type f | while read -r unit; do - if grep -q -e MemoryDeny -e SystemCall "$unit" ; then +# ASAN and syscall filters aren't compatible with each other. Also, drop any memory limits +# as these are quite unpredictable when running under sanitizers. +find "$BUILDROOT"/{etc,usr/lib}/systemd/system/ -name '*.service' -type f | while read -r unit; do + if grep -q -e MemoryDeny -e MemoryMax -e MemoryHigh -e MemorySwapMax -e SystemCall "$unit" ; then mkdir -p "$unit.d" cat > "$unit.d/sanitizer-compat.conf" < bo fatal_end = re.compile(r'==[0-9]+==HINT:\s+\w+Sanitizer') # 'Standard' errors: - standard_begin = re.compile(r'([0-9]+: runtime error|==[0-9]+==.+?\w+Sanitizer)') + # + # TODO: there's currently a bug in LLVM 22 due to which certain systemd + # units can throw the following warning: + # [ 3366.747202] systemd-oomd[93]: ==93==WARNING: ptrace appears to be blocked (is seccomp enabled?). + # LeakSanitizer may hang. + # [ 3366.747202] systemd-oomd[93]: ==93==Child exited with signal 15. + # + # which is then picked up by the following regex and causes the test to + # fail. Let's, temporarily, exclude this warning from the regex to mitigate + # this. + # + # See: https://github.com/llvm/llvm-project/issues/193714 + standard_begin = re.compile(r'([0-9]+: runtime error|==[0-9]+==(?!WARNING: ptrace).+?\w+Sanitizer)') standard_end = re.compile(r'SUMMARY:\s+(\w+)Sanitizer') # extract COMM diff --git a/test/units/TEST-07-PID1.user-namespace-path.sh b/test/units/TEST-07-PID1.user-namespace-path.sh index 437968e8c2..fda83a9566 100755 --- a/test/units/TEST-07-PID1.user-namespace-path.sh +++ b/test/units/TEST-07-PID1.user-namespace-path.sh @@ -6,15 +6,6 @@ set -o pipefail # shellcheck source=test/units/util.sh . "$(dirname "$0")"/util.sh -# When sanitizers are used, export LD_PRELOAD with the sanitizers path, -# lsns doesn't work otherwise. -if [ -f /usr/lib/systemd/systemd-asan-env ]; then - # shellcheck source=/dev/null - . /usr/lib/systemd/systemd-asan-env - export LD_PRELOAD - export ASAN_OPTIONS -fi - # Only reuse the user namespace systemd-run --unit=oldservice --property=Type=exec --property=PrivateUsers=true sleep 3600 OLD_PID=$(systemctl show oldservice -p MainPID | awk -F= '{print $2}')