Merge pull request #23791 from mrc0mmand/dfuzzer-followups
Several dfuzzer-related follow-ups
This commit is contained in:
@@ -6,6 +6,8 @@ TEST_DESCRIPTION="Fuzz our D-Bus interfaces with dfuzzer"
|
||||
TEST_NO_NSPAWN=1
|
||||
TEST_SUPPORTING_SERVICES_SHOULD_BE_MASKED=0
|
||||
QEMU_TIMEOUT="${QEMU_TIMEOUT:-1800}"
|
||||
IMAGE_NAME=dfuzzer
|
||||
TEST_FORCE_NEWIMAGE=1
|
||||
|
||||
# shellcheck source=test/test-functions
|
||||
. "${TEST_BASE_DIR:?}/test-functions"
|
||||
|
||||
@@ -9,7 +9,7 @@ TEST_NO_NSPAWN=1
|
||||
. "${TEST_BASE_DIR:?}/test-functions"
|
||||
|
||||
if qemu_min_version "5.2.0"; then
|
||||
QEMU_OPTIONS="-object memory-backend-ram,id=mem0,size=${QEMU_MEM:?} -numa node,memdev=mem0,nodeid=0"
|
||||
QEMU_OPTIONS="-object memory-backend-ram,id=mem0,size=${QEMU_MEM:-512M} -numa node,memdev=mem0,nodeid=0"
|
||||
else
|
||||
QEMU_OPTIONS="-numa node,nodeid=0"
|
||||
fi
|
||||
|
||||
+2
-3
@@ -30,7 +30,6 @@ TIMED_OUT= # will be 1 after run_* if *_TIMEOUT is set and test timed out
|
||||
[[ "$LOOKS_LIKE_SUSE" ]] && FSTYPE="${FSTYPE:-btrfs}" || FSTYPE="${FSTYPE:-ext4}"
|
||||
UNIFIED_CGROUP_HIERARCHY="${UNIFIED_CGROUP_HIERARCHY:-default}"
|
||||
EFI_MOUNT="${EFI_MOUNT:-$(bootctl -x 2>/dev/null || echo /boot)}"
|
||||
QEMU_MEM="${QEMU_MEM:-512M}"
|
||||
# Note that defining a different IMAGE_NAME in a test setup script will only result
|
||||
# in default.img being copied and renamed. It can then be extended by defining
|
||||
# a test_append_files() function. The $1 parameter will be the root directory.
|
||||
@@ -262,7 +261,7 @@ if get_bool "$IS_BUILT_WITH_ASAN"; then
|
||||
STRIP_BINARIES=no
|
||||
SKIP_INITRD="${SKIP_INITRD:-yes}"
|
||||
PATH_TO_INIT=$ROOTLIBDIR/systemd-under-asan
|
||||
QEMU_MEM="2048M"
|
||||
QEMU_MEM="${QEMU_MEM:-2G}"
|
||||
QEMU_SMP="${QEMU_SMP:-4}"
|
||||
|
||||
# We need to correctly distinguish between gcc's and clang's ASan DSOs.
|
||||
@@ -456,7 +455,7 @@ run_qemu() {
|
||||
qemu_options+=(
|
||||
-smp "$QEMU_SMP"
|
||||
-net none
|
||||
-m "$QEMU_MEM"
|
||||
-m "${QEMU_MEM:-512M}"
|
||||
-nographic
|
||||
-kernel "$KERNEL_BIN"
|
||||
-drive "format=raw,cache=unsafe,file=$image"
|
||||
|
||||
@@ -8,22 +8,16 @@ set -o pipefail
|
||||
systemctl list-jobs | grep -F 'end.service' && SHUTDOWN_AT_EXIT=1 || SHUTDOWN_AT_EXIT=0
|
||||
|
||||
at_exit() {
|
||||
# "Safety net" - check for any coredumps which might have not caused dfuzzer
|
||||
# to stop & return an error (we need to do this now before truncating the
|
||||
# journal)
|
||||
# TODO: check fo ASan/UBSan errors
|
||||
local found_cd=0
|
||||
while read -r exe; do
|
||||
coredumctl info "$exe"
|
||||
found_cd=1
|
||||
done < <(coredumpctl -F COREDUMP_EXE | sort -u)
|
||||
[[ $found_cd -eq 0 ]] || exit 1
|
||||
|
||||
# We have to call the end.service explicitly even if it's specified on
|
||||
set +e
|
||||
# We have to call the end.service/poweroff explicitly even if it's specified on
|
||||
# the kernel cmdline via systemd.wants=end.service, since dfuzzer calls
|
||||
# org.freedesktop.systemd1.Manager.ClearJobs() which drops the service
|
||||
# from the queue
|
||||
[[ $SHUTDOWN_AT_EXIT -ne 0 ]] && systemctl start --job-mode=flush end.service
|
||||
if [[ $SHUTDOWN_AT_EXIT -ne 0 ]] && ! systemctl poweroff; then
|
||||
# PID1 is down let's try to save the journal
|
||||
journalctl --sync || : # journal can be down as well so let's ignore exit codes here
|
||||
systemctl -ff poweroff # sync() and reboot(RB_POWER_OFF)
|
||||
fi
|
||||
}
|
||||
|
||||
trap at_exit EXIT
|
||||
@@ -72,7 +66,7 @@ mount -t tmpfs -o size=50M tmpfs /var/lib/machines
|
||||
for bus in "${BUS_LIST[@]}"; do
|
||||
echo "Bus: $bus (system)"
|
||||
systemd-run --pipe --wait \
|
||||
-- dfuzzer -v -b "$PAYLOAD_MAX" -n "$bus"
|
||||
-- dfuzzer -b "$PAYLOAD_MAX" -n "$bus"
|
||||
|
||||
# Let's reload the systemd daemon to test (de)serialization as well
|
||||
systemctl daemon-reload
|
||||
@@ -83,7 +77,7 @@ umount /var/lib/machines
|
||||
for bus in "${SESSION_BUS_LIST[@]}"; do
|
||||
echo "Bus: $bus (session)"
|
||||
systemd-run --machine 'testuser@.host' --user --pipe --wait \
|
||||
-- dfuzzer -v -b "$PAYLOAD_MAX" -n "$bus"
|
||||
-- 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
|
||||
|
||||
Reference in New Issue
Block a user