diff --git a/1041-test-execute-let-s-ignore-the-difference-between-CLD.patch b/1041-test-execute-let-s-ignore-the-difference-between-CLD.patch new file mode 100644 index 0000000..69bdb17 --- /dev/null +++ b/1041-test-execute-let-s-ignore-the-difference-between-CLD.patch @@ -0,0 +1,41 @@ +From edc3ca8a481a918f61404a7d41aa328c247721cd Mon Sep 17 00:00:00 2001 +From: Frantisek Sumsal +Date: Tue, 2 Sep 2025 13:41:07 +0200 +Subject: [PATCH] test-execute: let's ignore the difference between CLD_KILLED + and CLD_DUMPED + +Depending on system configuration and whether SCMP_ACT_KILL_PROCESS or SCMP_ACT_KILL_THREAD is available/used processes might coredump on specific coredumps or are just plain killed. For our test case the difference doesn't really matter, hence let's hide it away. + +(cherry picked from commit c3ab2c389ee60d92fb8d7fe779ae9c4e3c092e4c) + +Related: RHEL-108744 +--- + src/test/test-execute.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/src/test/test-execute.c b/src/test/test-execute.c +index 7581d5ed68..97649ee5ec 100644 +--- a/src/test/test-execute.c ++++ b/src/test/test-execute.c +@@ -30,6 +30,12 @@ + + typedef void (*test_function_t)(Manager *m); + ++static int cld_dumped_to_killed(int code) { ++ /* Depending on the system, seccomp version, … some signals might result in dumping, others in plain ++ * killing. Let's ignore the difference here, and map both cases to CLD_KILLED */ ++ return code == CLD_DUMPED ? CLD_KILLED : code; ++} ++ + static void wait_for_service_finish(Manager *m, Unit *unit) { + Service *service = NULL; + usec_t ts; +@@ -73,7 +79,7 @@ static void check_main_result(const char *func, Manager *m, Unit *unit, int stat + service->main_exec_status.status, status_expected); + abort(); + } +- if (service->main_exec_status.code != code_expected) { ++ if (cld_dumped_to_killed(service->main_exec_status.code) != cld_dumped_to_killed(code_expected)) { + log_error("%s: %s: exit code %d, expected %d", + func, unit->id, + service->main_exec_status.code, code_expected); diff --git a/1042-test-execute-turn-off-coredump-generation-in-test-se.patch b/1042-test-execute-turn-off-coredump-generation-in-test-se.patch new file mode 100644 index 0000000..609c17d --- /dev/null +++ b/1042-test-execute-turn-off-coredump-generation-in-test-se.patch @@ -0,0 +1,37 @@ +From bbec8198d56f141ab3e97dca3607744e2497bf9a Mon Sep 17 00:00:00 2001 +From: Frantisek Sumsal +Date: Tue, 2 Sep 2025 13:41:22 +0200 +Subject: [PATCH] test-execute: turn off coredump generation in test services + +These services are likely to coredump, and we expect that but aren't interested in the coredump. Hence let's turn off processing by setting RLIMIT_CORE to 0/0. + +(cherry picked from commit a429223d1767a9d6cb0a95fd2fa3b0d64ce3d4e7) + +Related: RHEL-108744 +--- + test/test-execute/exec-systemcallfilter-failing.service | 1 + + test/test-execute/exec-systemcallfilter-failing2.service | 1 + + 2 files changed, 2 insertions(+) + +diff --git a/test/test-execute/exec-systemcallfilter-failing.service b/test/test-execute/exec-systemcallfilter-failing.service +index bcebc99507..996f859217 100644 +--- a/test/test-execute/exec-systemcallfilter-failing.service ++++ b/test/test-execute/exec-systemcallfilter-failing.service +@@ -4,6 +4,7 @@ Description=Test for SystemCallFilter + [Service] + ExecStart=/bin/sh -c 'echo "This should not be seen"' + Type=oneshot ++LimitCORE=0 + SystemCallFilter=ioperm + SystemCallFilter=~ioperm + SystemCallFilter=ioperm +diff --git a/test/test-execute/exec-systemcallfilter-failing2.service b/test/test-execute/exec-systemcallfilter-failing2.service +index 2fdc0ed772..c74f42248b 100644 +--- a/test/test-execute/exec-systemcallfilter-failing2.service ++++ b/test/test-execute/exec-systemcallfilter-failing2.service +@@ -4,4 +4,5 @@ Description=Test for SystemCallFilter + [Service] + ExecStart=/bin/sh -c 'echo "This should not be seen"' + Type=oneshot ++LimitCORE=0 + SystemCallFilter=~write open execve exit_group close mmap munmap fstat DONOTEXIST diff --git a/1043-test-introduce-TEST-53-TIMER.patch b/1043-test-introduce-TEST-53-TIMER.patch new file mode 100644 index 0000000..5b7ed46 --- /dev/null +++ b/1043-test-introduce-TEST-53-TIMER.patch @@ -0,0 +1,106 @@ +From 7097abc3e9a0b76942b6844d43152e37f22158cf Mon Sep 17 00:00:00 2001 +From: Frantisek Sumsal +Date: Mon, 29 Sep 2025 13:37:02 +0200 +Subject: [PATCH] test: introduce TEST-53-TIMER + +This tries to mirror upstream's +953c347fb6f293acbd6da009646bfc071b68ddd7, but we don't have +TEST-53-ISSUE-16347 in RHEL 8 at all, so just introduce a new empty test +instead. + +rhel-only +Related: RHEL-108744 +--- + test/TEST-53-TIMER/Makefile | 1 + + test/TEST-53-TIMER/test.sh | 51 +++++++++++++++++++++++++++++++++ + test/TEST-53-TIMER/testsuite.sh | 14 +++++++++ + 3 files changed, 66 insertions(+) + create mode 120000 test/TEST-53-TIMER/Makefile + create mode 100755 test/TEST-53-TIMER/test.sh + create mode 100755 test/TEST-53-TIMER/testsuite.sh + +diff --git a/test/TEST-53-TIMER/Makefile b/test/TEST-53-TIMER/Makefile +new file mode 120000 +index 0000000000..e9f93b1104 +--- /dev/null ++++ b/test/TEST-53-TIMER/Makefile +@@ -0,0 +1 @@ ++../TEST-01-BASIC/Makefile +\ No newline at end of file +diff --git a/test/TEST-53-TIMER/test.sh b/test/TEST-53-TIMER/test.sh +new file mode 100755 +index 0000000000..3619ff92b4 +--- /dev/null ++++ b/test/TEST-53-TIMER/test.sh +@@ -0,0 +1,51 @@ ++#!/usr/bin/env bash ++set -e ++TEST_DESCRIPTION="Tests for systemd timers" ++TEST_NO_NSPAWN=1 ++ ++# shellcheck source=test/test-functions ++. "$TEST_BASE_DIR/test-functions" ++ ++test_setup() { ++ create_empty_image ++ mkdir -p "${TESTDIR:?}/root" ++ mount "${LOOPDEV:?}p1" "$TESTDIR/root" ++ ++ ( ++ LOG_LEVEL=5 ++ # shellcheck disable=SC2046 ++ eval $(udevadm info --export --query=env --name="${LOOPDEV}p2") ++ ++ setup_basic_environment ++ ++ # mask some services that we do not want to run in these tests ++ ln -fs /dev/null "$initdir/etc/systemd/system/systemd-hwdb-update.service" ++ ln -fs /dev/null "$initdir/etc/systemd/system/systemd-journal-catalog-update.service" ++ ln -fs /dev/null "$initdir/etc/systemd/system/systemd-networkd.service" ++ ln -fs /dev/null "$initdir/etc/systemd/system/systemd-networkd.socket" ++ ln -fs /dev/null "$initdir/etc/systemd/system/systemd-resolved.service" ++ ln -fs /dev/null "$initdir/etc/systemd/system/systemd-machined.service" ++ ++ # setup the testsuite service ++ cat >"$initdir/etc/systemd/system/testsuite.service" </failed ++ ++for script in "${0%.sh}".*.sh; do ++ echo "Running $script" ++ "./$script" ++done ++ ++touch /testok ++rm /failed diff --git a/1044-test-restarting-elapsed-timer-shouldn-t-trigger-the-.patch b/1044-test-restarting-elapsed-timer-shouldn-t-trigger-the-.patch new file mode 100644 index 0000000..0c886f2 --- /dev/null +++ b/1044-test-restarting-elapsed-timer-shouldn-t-trigger-the-.patch @@ -0,0 +1,98 @@ +From 9cb832f3c26c292d31109cb54d142277f8751e52 Mon Sep 17 00:00:00 2001 +From: Frantisek Sumsal +Date: Tue, 23 Sep 2025 17:42:01 +0200 +Subject: [PATCH] test: restarting elapsed timer shouldn't trigger the + corresponding service + +Provides coverage for: + - https://github.com/systemd/systemd/issues/31231 + - https://github.com/systemd/systemd/issues/35805 + +(cherry picked from commit 5730a400fd5ee82566fe03eb832121a0d4bc26b6) + +Related: RHEL-108744 +--- + .../testsuite.restart-trigger.sh | 74 +++++++++++++++++++ + 1 file changed, 74 insertions(+) + create mode 100755 test/TEST-53-TIMER/testsuite.restart-trigger.sh + +diff --git a/test/TEST-53-TIMER/testsuite.restart-trigger.sh b/test/TEST-53-TIMER/testsuite.restart-trigger.sh +new file mode 100755 +index 0000000000..313b5a7fd8 +--- /dev/null ++++ b/test/TEST-53-TIMER/testsuite.restart-trigger.sh +@@ -0,0 +1,74 @@ ++#!/usr/bin/env bash ++# SPDX-License-Identifier: LGPL-2.1-or-later ++# ++# Restarting an already elapsed timer shouldn't immediately trigger the corresponding service unit. ++# ++# Provides coverage for: ++# - https://github.com/systemd/systemd/issues/31231 ++# - https://github.com/systemd/systemd/issues/35805 ++set -eux ++set -o pipefail ++ ++UNIT_NAME="timer-restart-$RANDOM" ++TEST_MESSAGE="Hello from timer $RANDOM" ++ ++# Setup ++cat >"/run/systemd/system/$UNIT_NAME.timer" <"/run/systemd/system/$UNIT_NAME.service" <"/run/systemd/system/$UNIT_NAME.timer.d/99-override.conf" < +Date: Tue, 23 Sep 2025 21:04:12 +0200 +Subject: [PATCH] test: check the next elapse timer timestamp after + deserialization + +When deserializing a serialized timer unit with RandomizedDelaySec= set, +systemd should use the last inactive exit timestamp instead of current +realtime to calculate the new next elapse, so the timer unit actually +runs in the given calendar window. + +Provides coverage for: + - https://github.com/systemd/systemd/issues/18678 + - https://github.com/systemd/systemd/pull/27752 + +(cherry picked from commit f4c3c107d9be4e922a080fc292ed3889c4e0f4a5) + +Related: RHEL-108744 +--- + .../testsuite.RandomizedDelaySec-reload.sh | 94 +++++++++++++++++++ + test/test-functions | 2 +- + 2 files changed, 95 insertions(+), 1 deletion(-) + create mode 100755 test/TEST-53-TIMER/testsuite.RandomizedDelaySec-reload.sh + +diff --git a/test/TEST-53-TIMER/testsuite.RandomizedDelaySec-reload.sh b/test/TEST-53-TIMER/testsuite.RandomizedDelaySec-reload.sh +new file mode 100755 +index 0000000000..54b90d3dd1 +--- /dev/null ++++ b/test/TEST-53-TIMER/testsuite.RandomizedDelaySec-reload.sh +@@ -0,0 +1,94 @@ ++#!/usr/bin/env bash ++# SPDX-License-Identifier: LGPL-2.1-or-later ++# ++# When deserializing a serialized timer unit with RandomizedDelaySec= set, systemd should use the last ++# inactive exit timestamp instead of current realtime to calculate the new next elapse, so the timer unit ++# actually runs in the given calendar window. ++# ++# Provides coverage for: ++# - https://github.com/systemd/systemd/issues/18678 ++# - https://github.com/systemd/systemd/pull/27752 ++set -eux ++set -o pipefail ++ ++UNIT_NAME="timer-RandomizedDelaySec-$RANDOM" ++TARGET_TS="$(date --date="tomorrow 00:10")" ++TARGET_TS_S="$(date --date="$TARGET_TS" "+%s")" ++# Maximum possible next elapse timestamp: $TARGET_TS (OnCalendar=) + 22 hours (RandomizedDelaySec=) ++MAX_NEXT_ELAPSE_REALTIME_S="$((TARGET_TS_S + 22 * 60 * 60))" ++MAX_NEXT_ELAPSE_REALTIME="$(date --date="@$MAX_NEXT_ELAPSE_REALTIME_S")" ++ ++# Let's make sure to return the date & time back to the original state once we're done with our time ++# shenigans. One way to do this would be to use hwclock, but the RTC in VMs can be unreliable or slow to ++# respond, causing unexpected test fails/timeouts. ++# ++# Instead, let's save the realtime timestamp before we start with the test together with a current monotonic ++# timestamp, after the test ends take the difference between the current monotonic timestamp and the "start" ++# one, add it to the originally saved realtime timestamp, and finally use that timestamp to set the system ++# time. This should advance the system time by the amount of time the test actually ran, and hence restore it ++# to some sane state after the time jumps performed by the test. It won't be perfect, but it should be close ++# enough for our needs. ++START_REALTIME="$(date "+%s")" ++START_MONOTONIC="$(cut -d . -f 1 /proc/uptime)" ++at_exit() { ++ : "Restore the system date to a sane state" ++ END_MONOTONIC="$(cut -d . -f 1 /proc/uptime)" ++ date --set="@$((START_REALTIME + END_MONOTONIC - START_MONOTONIC))" ++} ++trap at_exit EXIT ++ ++# Set some predictable time so we can schedule the first timer elapse in a deterministic-ish way ++date --set="23:00" ++ ++# Setup ++cat >"/run/systemd/system/$UNIT_NAME.timer" <"/run/systemd/system/$UNIT_NAME.service" < +Date: Tue, 9 Sep 2025 15:24:22 +0200 +Subject: [PATCH] timer: don't run service immediately after restart of a timer + +When a timer is restarted, don't reset the last_trigger field. +This prevents the timer from triggering immediately. + +Fixes: #31231 +(cherry picked from commit 3fc44a0f68412b649e16f12ff2f97a36c615457d) + +Resolves: RHEL-108744 +--- + src/core/timer.c | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/src/core/timer.c b/src/core/timer.c +index 81468d4ca6..ef48a62781 100644 +--- a/src/core/timer.c ++++ b/src/core/timer.c +@@ -601,8 +601,6 @@ static int timer_start(Unit *u) { + if (r < 0) + return r; + +- t->last_trigger = DUAL_TIMESTAMP_NULL; +- + /* Reenable all timers that depend on unit activation time */ + LIST_FOREACH(value, v, t->values) + if (v->base == TIMER_ACTIVE) diff --git a/1047-Revert-test-extend-testcase-to-ensure-controller-mem.patch b/1047-Revert-test-extend-testcase-to-ensure-controller-mem.patch new file mode 100644 index 0000000..5efa3ce --- /dev/null +++ b/1047-Revert-test-extend-testcase-to-ensure-controller-mem.patch @@ -0,0 +1,47 @@ +From 3aa7f6e335b388a38ef756ecd2acdf545894d3fb Mon Sep 17 00:00:00 2001 +From: David Tardon +Date: Thu, 2 Oct 2025 10:06:01 +0200 +Subject: [PATCH] Revert "test: extend testcase to ensure controller membership + doesn't regress" + +This reverts commit a3ce5bf1ff531f29c329b3298f3ef69d99e3cbed. + +Related: RHEL-9322 +--- + test/TEST-19-DELEGATE/testsuite.sh | 21 ++------------------- + 1 file changed, 2 insertions(+), 19 deletions(-) + +diff --git a/test/TEST-19-DELEGATE/testsuite.sh b/test/TEST-19-DELEGATE/testsuite.sh +index 8a3e9eb5fb..c4c948cc11 100755 +--- a/test/TEST-19-DELEGATE/testsuite.sh ++++ b/test/TEST-19-DELEGATE/testsuite.sh +@@ -21,27 +21,10 @@ if grep -q cgroup2 /proc/filesystems ; then + -w /sys/fs/cgroup/system.slice/test0.service/cgroup.subtree_control + + systemd-run --wait --unit=test1.service -p "DynamicUser=1" -p "Delegate=memory pids" \ +- grep -q memory /sys/fs/cgroup/system.slice/test1.service/cgroup.controllers ++ grep memory /sys/fs/cgroup/system.slice/test1.service/cgroup.controllers + + systemd-run --wait --unit=test2.service -p "DynamicUser=1" -p "Delegate=memory pids" \ +- grep -q pids /sys/fs/cgroup/system.slice/test2.service/cgroup.controllers +- +- # "io" is not among the controllers enabled by default for all units, verify that +- grep -qv io /sys/fs/cgroup/system.slice/cgroup.controllers +- +- # Run a service with "io" enabled, and verify it works +- systemd-run --wait --unit=test3.service -p "IOAccounting=yes" -p "Slice=system-foo-bar-baz.slice" \ +- grep -q io /sys/fs/cgroup/system.slice/system-foo.slice/system-foo-bar.slice/system-foo-bar-baz.slice/test3.service/cgroup.controllers +- +- # We want to check if "io" is removed again from the controllers +- # list. However, PID 1 (rightfully) does this asynchronously. In order +- # to force synchronization on this, let's start a short-lived service +- # which requires PID 1 to refresh the cgroup tree, so that we can +- # verify that this all works. +- systemd-run --wait --unit=test4.service true +- +- # And now check again, "io" should have vanished +- grep -qv io /sys/fs/cgroup/system.slice/cgroup.controllers ++ grep pids /sys/fs/cgroup/system.slice/test2.service/cgroup.controllers + + # Check that unprivileged delegation works for scopes + test_scope_unpriv_delegation diff --git a/systemd.spec b/systemd.spec index abb38c4..ea8ce28 100644 --- a/systemd.spec +++ b/systemd.spec @@ -13,7 +13,7 @@ Name: systemd Url: http://www.freedesktop.org/wiki/Software/systemd Version: 239 -Release: 82%{?dist}.7 +Release: 82%{?dist}.8 # For a breakdown of the licensing, see README License: LGPLv2+ and MIT and GPLv2+ Summary: System and Service Manager @@ -1090,6 +1090,13 @@ Patch1037: 1037-cgroup-extend-reasons-when-we-realize-the-enable-mas.patch Patch1038: 1038-cgroup-drastically-simplify-caching-of-cgroups-membe.patch Patch1039: 1039-cgroup-when-we-unload-a-unit-also-update-all-its-par.patch Patch1040: 1040-test-extend-testcase-to-ensure-controller-membership.patch +Patch1041: 1041-test-execute-let-s-ignore-the-difference-between-CLD.patch +Patch1042: 1042-test-execute-turn-off-coredump-generation-in-test-se.patch +Patch1043: 1043-test-introduce-TEST-53-TIMER.patch +Patch1044: 1044-test-restarting-elapsed-timer-shouldn-t-trigger-the-.patch +Patch1045: 1045-test-check-the-next-elapse-timer-timestamp-after-des.patch +Patch1046: 1046-timer-don-t-run-service-immediately-after-restart-of.patch +Patch1047: 1047-Revert-test-extend-testcase-to-ensure-controller-mem.patch %ifarch %{ix86} x86_64 aarch64 %global have_gnu_efi 1 @@ -1716,6 +1723,15 @@ fi %files tests -f .file-list-tests %changelog +* Thu Oct 02 2025 systemd maintenance team - 239-82.8 +- test-execute: let's ignore the difference between CLD_KILLED and CLD_DUMPED (RHEL-108744) +- test-execute: turn off coredump generation in test services (RHEL-108744) +- test: introduce TEST-53-TIMER (RHEL-108744) +- test: restarting elapsed timer shouldn't trigger the corresponding service (RHEL-108744) +- test: check the next elapse timer timestamp after deserialization (RHEL-108744) +- timer: don't run service immediately after restart of a timer (RHEL-108744) +- Revert "test: extend testcase to ensure controller membership doesn't regress" (RHEL-9322) + * Fri Aug 29 2025 systemd maintenance team - 239-82.7 - cgroup-util: add mask definitions for sets of controllers supported by cgroupsv1 vs. cgroupsv2 (RHEL-9322) - cgroup: dump delegation mask too (RHEL-9322)