diff --git a/backport-core-fix-assert-when-AddDependencyUnitFiles-is-calle.patch b/backport-core-fix-assert-when-AddDependencyUnitFiles-is-calle.patch new file mode 100644 index 0000000000000000000000000000000000000000..078ff58d1812228db7e4286009a6eeaf5ec16fe8 --- /dev/null +++ b/backport-core-fix-assert-when-AddDependencyUnitFiles-is-calle.patch @@ -0,0 +1,45 @@ +From 71efbe69b6b7a0d6a663b8dbe6fe4d8f5655848a Mon Sep 17 00:00:00 2001 +From: Luca Boccassi +Date: Mon, 6 Jan 2025 18:16:29 +0000 +Subject: [PATCH] core: fix assert when AddDependencyUnitFiles is called with + invalid parameter + +unit_file_add_dependency() asserts, so check before calling it that the +type is expected, or return EINVAL to the caller. + +root@localhost:~# busctl call org.freedesktop.systemd1 /org/freedesktop/systemd1 org.freedesktop.systemd1.Manager AddDependencyUnitFiles "asssbb" 0 uwhatm8 After 1 1 + +Broadcast message from systemd-journald@localhost (Mon 2025-01-06 18:12:14 UTC): + +systemd[1]: Caught , from our own process. + +Fixes https://github.com/systemd/systemd/issues/35882 + +(cherry picked from commit d87dc74e8f1a30d72a0f202e411400bab34ab55a) +(cherry picked from commit b6792202f31c4e83d23a944b845e1f17fc14f619) +(cherry picked from commit c65056e1318fe20cf9b62771ffa589abe2c21a76) +(cherry picked from commit 4d47117b05f2bd836c465c3efdee69c5a573e8d6) + +Conflict:context adaptation +Reference:https://github.com/systemd/systemd-stable/commit/71efbe69b6b7a0d6a663b8dbe6fe4d8f5655848a + +--- + src/core/dbus-manager.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/core/dbus-manager.c b/src/core/dbus-manager.c +index 856dd3b5dc..dea69bb6e2 100644 +--- a/src/core/dbus-manager.c ++++ b/src/core/dbus-manager.c +@@ -2820,7 +2820,7 @@ static int method_add_dependency_unit_files(sd_bus_message *message, void *userd + flags = unit_file_bools_to_flags(runtime, force); + + dep = unit_dependency_from_string(type); +- if (dep < 0) ++ if (dep < 0 || !IN_SET(dep, UNIT_WANTS, UNIT_REQUIRES)) + return -EINVAL; + + r = unit_file_add_dependency(m->unit_file_scope, flags, NULL, l, target, dep, &changes, &n_changes); +-- +2.33.0 + diff --git a/backport-execute-free-syscall_log-hashmap-when-done.patch b/backport-execute-free-syscall_log-hashmap-when-done.patch new file mode 100644 index 0000000000000000000000000000000000000000..24e3b0d3053e954f21c7b2b35e7d30f37b7a270f --- /dev/null +++ b/backport-execute-free-syscall_log-hashmap-when-done.patch @@ -0,0 +1,33 @@ +From 742f3232bcddbbb47bfad3ad22e2de15c49f0325 Mon Sep 17 00:00:00 2001 +From: David Tardon +Date: Thu, 28 Nov 2024 13:33:55 +0100 +Subject: [PATCH] execute: free syscall_log hashmap when done + +Fixes #35394 + +(cherry picked from commit c3dc460b6c3f062af540e4233c65ac12c01077fa) +(cherry picked from commit f15fd96efd5ebdfb18746acb0cbb35a4331b4d8b) +(cherry picked from commit a9c650b207369d047ac9c0f21d6d70590173df45) + +Conflict:NA +Reference:https://github.com/systemd/systemd-stable/commit/742f3232bcddbbb47bfad3ad22e2de15c49f0325 + +--- + src/core/execute.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/core/execute.c b/src/core/execute.c +index e6fcb115b7..7b7b97ae9c 100644 +--- a/src/core/execute.c ++++ b/src/core/execute.c +@@ -6225,6 +6225,7 @@ void exec_context_done(ExecContext *c) { + + c->syscall_filter = hashmap_free(c->syscall_filter); + c->syscall_archs = set_free(c->syscall_archs); ++ c->syscall_log = hashmap_free(c->syscall_log); + c->address_families = set_free(c->address_families); + + for (ExecDirectoryType t = 0; t < _EXEC_DIRECTORY_TYPE_MAX; t++) +-- +2.33.0 + diff --git a/backport-logind-let-system-wide-idle-begin-at-the-time-logind.patch b/backport-logind-let-system-wide-idle-begin-at-the-time-logind.patch new file mode 100644 index 0000000000000000000000000000000000000000..34883a7d31f07fccbc2511e95d247a48ca087095 --- /dev/null +++ b/backport-logind-let-system-wide-idle-begin-at-the-time-logind.patch @@ -0,0 +1,77 @@ +From dcb86edde5ef3b70f68abb7ed8bb0be63f28485b Mon Sep 17 00:00:00 2001 +From: Florian Schmaus +Date: Sat, 16 Nov 2024 10:29:35 +0100 +Subject: [PATCH] logind: let system-wide idle begin at the time logind was + initialized + +Initialize the start of the system-wide idle time with the time logind was +initialized and not with the start of the Unix epoch. This means that systemd +will not repport a unreasonable long idle time (around 54 years at the time of +writing this), especially at in the early boot, while no login manager session, +e.g,. gdm, had a chance to provide a more accurate start of the idle period. + +Fixes #35163 + +(cherry picked from commit 718b31138b9a93f262259f297ad6b521454decc6) +(cherry picked from commit 9d36809256c6d92c6d8358769479ad2c2b695664) +(cherry picked from commit 77b963c31712ef81786fcc6623fe1b10a46b62e0) +(cherry picked from commit cd6f07effafdcb9e1c903589a8cf398cd46b8acd) + +Conflict:NA +Reference:https://github.com/systemd/systemd-stable/commit/dcb86edde5ef3b70f68abb7ed8bb0be63f28485b + +--- + src/login/logind-core.c | 6 +++++- + src/login/logind.c | 2 ++ + src/login/logind.h | 2 ++ + 3 files changed, 9 insertions(+), 1 deletion(-) + +diff --git a/src/login/logind-core.c b/src/login/logind-core.c +index af86e92c01..fe95f90f74 100644 +--- a/src/login/logind-core.c ++++ b/src/login/logind-core.c +@@ -395,10 +395,14 @@ int manager_get_user_by_pid(Manager *m, pid_t pid, User **ret) { + int manager_get_idle_hint(Manager *m, dual_timestamp *t) { + Session *s; + bool idle_hint; +- dual_timestamp ts = DUAL_TIMESTAMP_NULL; ++ dual_timestamp ts; + + assert(m); + ++ /* Initialize the baseline timestamp with the time the manager got initialized to avoid reporting ++ * unreasonable large idle periods starting with the Unix epoch. */ ++ ts = m->init_ts; ++ + idle_hint = !manager_is_inhibited(m, INHIBIT_IDLE, INHIBIT_BLOCK, t, false, false, 0, NULL); + + HASHMAP_FOREACH(s, m->sessions) { +diff --git a/src/login/logind.c b/src/login/logind.c +index f30f7f9370..75474e2c08 100644 +--- a/src/login/logind.c ++++ b/src/login/logind.c +@@ -96,6 +96,8 @@ static int manager_new(Manager **ret) { + + (void) sd_event_set_watchdog(m->event, true); + ++ dual_timestamp_get(&m->init_ts); ++ + manager_reset_config(m); + + *ret = TAKE_PTR(m); +diff --git a/src/login/logind.h b/src/login/logind.h +index e6a04e0834..787406adac 100644 +--- a/src/login/logind.h ++++ b/src/login/logind.h +@@ -139,6 +139,8 @@ struct Manager { + + char *efi_loader_entry_one_shot; + struct stat efi_loader_entry_one_shot_stat; ++ ++ dual_timestamp init_ts; + }; + + void manager_reset_config(Manager *m); +-- +2.33.0 + diff --git a/backport-shutdown-close-DM-block-device-before-issuing-DM_DEV.patch b/backport-shutdown-close-DM-block-device-before-issuing-DM_DEV.patch new file mode 100644 index 0000000000000000000000000000000000000000..edd3ea9cbb3ccacebccdd75c98c215be8fef56dc --- /dev/null +++ b/backport-shutdown-close-DM-block-device-before-issuing-DM_DEV.patch @@ -0,0 +1,54 @@ +From c7689286f631b1dc6b4d7a56c9f056eb1d2eead1 Mon Sep 17 00:00:00 2001 +From: Yu Watanabe +Date: Sat, 23 Nov 2024 05:47:40 +0900 +Subject: [PATCH] shutdown: close DM block device before issuing DM_DEV_REMOVE + ioctl + +Otherwise, the ioctl() may fail with EBUSY. + +Follow-up for b4b66b26620bfaf5818c95d5cffafd85207694e7. +Hopefully fixes #35243. + +(cherry picked from commit b76730f3fe0e824db001b38c8ea848302be786ee) +(cherry picked from commit b30364a0378881c6f0d0ff3124f56f4da989d91c) +(cherry picked from commit bb1823d3ffcf432b5175ef24049b65e7b348705b) + +Conflict:the delete_dm() function is located in src/shutdown/umount.c rather than src/shutdown/detach-dm.c +Reference:https://github.com/systemd/systemd-stable/commit/c7689286f631b1dc6b4d7a56c9f056eb1d2eead1 + +--- + src/shutdown/umount.c | 16 +++++++++------- + 1 file changed, 9 insertions(+), 7 deletions(-) + +diff --git a/src/shutdown/umount.c b/src/shutdown/umount.c +index 0d1b0fc451..d6bc78df41 100644 +--- a/src/shutdown/umount.c ++++ b/src/shutdown/umount.c +@@ -98,15 +98,17 @@ static int delete_dm(MountPoint *m) { + assert(major(m->devnum) != 0); + assert(m->path); + +- fd = open("/dev/mapper/control", O_RDWR|O_CLOEXEC); ++ fd = open(m->path, O_RDONLY|O_CLOEXEC|O_NONBLOCK); + if (fd < 0) +- return -errno; +- +- _cleanup_close_ int block_fd = open(m->path, O_RDONLY|O_CLOEXEC|O_NONBLOCK); +- if (block_fd < 0) + log_debug_errno(errno, "Failed to open DM block device %s for syncing, ignoring: %m", m->path); +- else +- (void) sync_with_progress(block_fd); ++ else { ++ (void) sync_with_progress(fd); ++ fd = safe_close(fd); ++ } ++ ++ fd = open("/dev/mapper/control", O_RDWR|O_CLOEXEC); ++ if (fd < 0) ++ return log_debug_errno(errno, "Failed to open /dev/mapper/control: %m"); + + if (ioctl(fd, DM_DEV_REMOVE, &(struct dm_ioctl) { + .version = { +-- +2.33.0 + diff --git a/systemd.spec b/systemd.spec index ddfeb7bbaaf523cc02316bccdee78344d095ad82..4211657a59700d5619a724e53da381c176663ef6 100644 --- a/systemd.spec +++ b/systemd.spec @@ -25,7 +25,7 @@ Name: systemd Url: https://systemd.io/ Version: 249 -Release: 101 +Release: 102 License: MIT and LGPLv2+ and GPLv2+ Summary: System and Service Manager @@ -736,6 +736,10 @@ Patch6683: backport-sysctl-drop-proc-sys-in-prefix.patch Patch6684: backport-sysctl-split-out-code-for-applying-glob-option.patch Patch6685: backport-path-util-introduce-path_glob_can_match.patch Patch6686: backport-sysctl-apply-prefix-before-calling-glob.patch +Patch6687: backport-shutdown-close-DM-block-device-before-issuing-DM_DEV.patch +Patch6688: backport-execute-free-syscall_log-hashmap-when-done.patch +Patch6689: backport-logind-let-system-wide-idle-begin-at-the-time-logind.patch +Patch6690: backport-core-fix-assert-when-AddDependencyUnitFiles-is-calle.patch Patch9001: update-rtc-with-system-clock-when-shutdown.patch Patch9002: udev-add-actions-while-rename-netif-failed.patch @@ -2252,6 +2256,13 @@ grep -q -E '^KEYMAP="?fi-latin[19]"?' /etc/vconsole.conf 2>/dev/null && /usr/bin/systemd-cryptenroll %changelog +* Mon Mar 31 2025 hugel - 249-102 +- sync patch from systemd community +- add backport-shutdown-close-DM-block-device-before-issuing-DM_DEV.patch + backport-execute-free-syscall_log-hashmap-when-done.patch + backport-logind-let-system-wide-idle-begin-at-the-time-logind.patch + backport-core-fix-assert-when-AddDependencyUnitFiles-is-calle.patch + * Mon Feb 17 2025 zhangyao - 249-101 - sysctl: improve performance for applying glob pattern