mirror of
https://github.com/morgan9e/systemd
synced 2026-04-14 08:25:20 +09:00
TEST-21-DFUZZER: first test session bus, then service bus, finally system bus
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user