]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: drop any memory limits from units when running with sanitizers
authorFrantisek Sumsal <frantisek@sumsal.cz>
Fri, 24 Apr 2026 12:17:23 +0000 (14:17 +0200)
committerLuca Boccassi <luca.boccassi@gmail.com>
Fri, 22 May 2026 12:57:29 +0000 (13:57 +0100)
As the memory usage under sanitizers is quite unpredictable.

This is currently relevant mainly for Polkit, as it introduced memory
limits for its polkitd.service unit in the latest version [0] which are
very easy to trigger when running under sanitizers (as polkitd depends
on libsystemd which brings ASan into polkitd's address space).

[0] https://github.com/polkit-org/polkit/commit/7d9c06c58a957ee3f2a4383ade6f207b05207e3e

(cherry picked from commit e3aaf3d76eb0990ca015961703e905977df8faf7)

mkosi/mkosi.sanitizers/mkosi.postinst

index c451e05796d43e832285707c27ea3629c317eca4..01c5b23fa25055e5c0d319f669a26ea63a3f5b54 100755 (executable)
@@ -9,13 +9,17 @@ if [[ ! -f "$BUILDROOT/$LIBSYSTEMD" ]]; then
     exit 0
 fi
 
-# ASAN and syscall filters aren't compatible with each other.
+# 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"/usr "$BUILDROOT"/etc -name '*.service' -type f | while read -r unit; do
-    if grep -q -e MemoryDeny -e SystemCall "$unit" ; then
+    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" <<EOF
 [Service]
 MemoryDenyWriteExecute=no
+MemoryMax=
+MemoryHigh=
+MemorySwapMax=
 SystemCallFilter=
 EOF
     fi