org.freedesktop.machine1
org.freedesktop.portable1
org.freedesktop.resolve1
- org.freedesktop.systemd1
org.freedesktop.timedate1
)
)
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
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