From: Yu Watanabe Date: Thu, 19 Jun 2025 10:01:57 +0000 (+0900) Subject: TEST-21-DFUZZER: first test session bus, then service bus, finally system bus X-Git-Tag: v258-rc2~68^2~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5e2b606e4e3939b057395feaadee01ef68b43286;p=thirdparty%2Fsystemd.git TEST-21-DFUZZER: first test session bus, then service bus, finally system bus --- diff --git a/test/units/TEST-21-DFUZZER.sh b/test/units/TEST-21-DFUZZER.sh index 11fc3b85c72..cc02956ac36 100755 --- a/test/units/TEST-21-DFUZZER.sh +++ b/test/units/TEST-21-DFUZZER.sh @@ -135,7 +135,6 @@ BUS_LIST=( org.freedesktop.machine1 org.freedesktop.portable1 org.freedesktop.resolve1 - org.freedesktop.systemd1 org.freedesktop.timedate1 ) @@ -160,10 +159,6 @@ elif busctl introspect org.freedesktop.network1 / &>/dev/null; then ) fi -SESSION_BUS_LIST=( - org.freedesktop.systemd1 -) - # Maximum payload size generated by dfuzzer (in bytes) - default: 50K PAYLOAD_MAX=50000 # Tweak the maximum payload size if we're running under sanitizers, since @@ -172,33 +167,37 @@ if [[ -v ASAN_OPTIONS || -v UBSAN_OPTIONS ]]; then PAYLOAD_MAX=10000 # 10K fi +test_systemd() { + systemd-run "$@" --pipe --wait \ + -- dfuzzer -b "$PAYLOAD_MAX" -n org.freedesktop.systemd1 + + # Let's reload the systemd user daemon to test (de)serialization as well + systemctl "$@" daemon-reload + # FIXME: explicitly trigger reexecute until systemd/systemd#27204 is resolved + systemctl "$@" daemon-reexec +} + +# Let's first test the session bus before the system one, as it may be in a +# spurious state after fuzzing the system bus or login bus. +echo "Bus: org.freedesktop.systemd1 (session)" +test_systemd --machine 'testuser@.host' --user + # Overmount /var/lib/machines with a size-limited tmpfs, as fuzzing # the org.freedesktop.machine1 stuff makes quite a mess mount -t tmpfs -o size=50M tmpfs /var/lib/machines -# Fuzz both the system and the session buses (where applicable) +# Next, test the system service buses, as the services may be in a spurious +# state after fuzzing the system service manager bus. for bus in "${BUS_LIST[@]}"; do - echo "Bus: $bus (system)" + echo "Bus: $bus" systemd-run --pipe --wait \ -- dfuzzer -b "$PAYLOAD_MAX" -n "$bus" - - # Let's reload the systemd daemon to test (de)serialization as well - systemctl daemon-reload - # FIXME: explicitly trigger reexecute until systemd/systemd#27204 is resolved - systemctl daemon-reexec done umount /var/lib/machines -for bus in "${SESSION_BUS_LIST[@]}"; do - echo "Bus: $bus (session)" - systemd-run --machine 'testuser@.host' --user --pipe --wait \ - -- dfuzzer -b "$PAYLOAD_MAX" -n "$bus" - - # Let's reload the systemd user daemon to test (de)serialization as well - systemctl --machine 'testuser@.host' --user daemon-reload - # FIXME: explicitly trigger reexecute until systemd/systemd#27204 is resolved - systemctl --machine 'testuser@.host' --user daemon-reexec -done +# Finally, test the system bus. +echo "Bus: org.freedesktop.systemd1 (system)" +test_systemd touch /testok