import UBI systemd-252-67.el9_8.2

This commit is contained in:
AlmaLinux RelEng Bot 2026-05-19 20:28:39 -04:00
parent d6b5f2a8dd
commit d406a554c3
119 changed files with 9363 additions and 249 deletions

View File

@ -0,0 +1,96 @@
From 3d54c58e3d4c720a9a95a39879b795e7154f0209 Mon Sep 17 00:00:00 2001
From: Jan Janssen <medhefgo@web.de>
Date: Fri, 23 Dec 2022 14:14:53 +0100
Subject: [PATCH] Revert "boot: Use EFI_BOOT_MANAGER_POLICY_PROTOCOL to connect
console devices"
This reverts commit b99bf5811850afdb2502ba37251c48348da63c82.
It seems that using this protocol on some firmwares to forcibly
initialize console devices may break handles (already opened file
handles and the device handle itself) that we rely on to access the
boot filesystem, making it impossible to load the selected entry.
It might be possible to get a new handle by querying for the device
handle by using its device path after calling into this protocol, but
this is untested. The firmware might also be so buggy that accessing
devices after using this protocol is impossible.
It seems prudent to revert this for now until some reliable way is found
to initialize console devices without introducing huge boot delays. Any
users on firmware where console devices cannot be accessed would have to
rely on disabling fastboot.
Fixes: #25737, #25846
(cherry picked from commit f151abb0e5fa4f820109eb0541bfdcba319d2b92)
Resolves: RHEL-108596
---
src/boot/efi/console.c | 16 ----------------
src/boot/efi/missing_efi.h | 19 -------------------
2 files changed, 35 deletions(-)
diff --git a/src/boot/efi/console.c b/src/boot/efi/console.c
index 85a76e6e68..3b8b6b2e41 100644
--- a/src/boot/efi/console.c
+++ b/src/boot/efi/console.c
@@ -12,20 +12,6 @@
#define VERTICAL_MAX_OK 1080
#define VIEWPORT_RATIO 10
-static EFI_STATUS console_connect(void) {
- EFI_BOOT_MANAGER_POLICY_PROTOCOL *boot_policy;
- EFI_STATUS err;
-
- /* This should make console devices appear/fully initialize on fastboot firmware. */
-
- err = BS->LocateProtocol(
- &(EFI_GUID) EFI_BOOT_MANAGER_POLICY_PROTOCOL_GUID, NULL, (void **) &boot_policy);
- if (err != EFI_SUCCESS)
- return err;
-
- return boot_policy->ConnectDeviceClass(boot_policy, &(EFI_GUID) EFI_BOOT_MANAGER_POLICY_CONSOLE_GUID);
-}
-
static inline void event_closep(EFI_EVENT *event) {
if (!*event)
return;
@@ -61,8 +47,6 @@ EFI_STATUS console_key_read(uint64_t *key, uint64_t timeout_usec) {
assert(key);
if (!checked) {
- console_connect();
-
/* Get the *first* TextInputEx device.*/
err = BS->LocateProtocol(
MAKE_GUID_PTR(EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL), NULL, (void **) &extraInEx);
diff --git a/src/boot/efi/missing_efi.h b/src/boot/efi/missing_efi.h
index d34dfc3379..3c35a85e46 100644
--- a/src/boot/efi/missing_efi.h
+++ b/src/boot/efi/missing_efi.h
@@ -399,25 +399,6 @@ typedef struct {
} EFI_SHELL_PARAMETERS_PROTOCOL;
#endif
-#ifndef EFI_BOOT_MANAGER_POLICY_PROTOCOL_GUID
-#define EFI_BOOT_MANAGER_POLICY_PROTOCOL_GUID \
- { 0xFEDF8E0C, 0xE147, 0x11E3, { 0x99, 0x03, 0xB8, 0xE8, 0x56, 0x2C, 0xBA, 0xFA } }
-#define EFI_BOOT_MANAGER_POLICY_CONSOLE_GUID \
- { 0xCAB0E94C, 0xE15F, 0x11E3, { 0x91, 0x8D, 0xB8, 0xE8, 0x56, 0x2C, 0xBA, 0xFA } }
-
-typedef struct EFI_BOOT_MANAGER_POLICY_PROTOCOL EFI_BOOT_MANAGER_POLICY_PROTOCOL;
-struct EFI_BOOT_MANAGER_POLICY_PROTOCOL {
- UINT64 Revision;
- EFI_STATUS (EFIAPI *ConnectDevicePath)(
- EFI_BOOT_MANAGER_POLICY_PROTOCOL *This,
- EFI_DEVICE_PATH *DevicePath,
- BOOLEAN Recursive);
- EFI_STATUS (EFIAPI *ConnectDeviceClass)(
- EFI_BOOT_MANAGER_POLICY_PROTOCOL *This,
- EFI_GUID *Class);
-};
-#endif
-
#ifndef EFI_WARN_UNKNOWN_GLYPH
# define EFI_WARN_UNKNOWN_GLYPH 1
#endif

View File

@ -0,0 +1,38 @@
From bcb456e590fd6994a6b38e9b2d89e3ef0417d402 Mon Sep 17 00:00:00 2001
From: Jan Janssen <medhefgo@web.de>
Date: Tue, 2 May 2023 19:41:58 +0200
Subject: [PATCH] boot: Use correct memory type for allocations
We were using the wrong memory type when allocating pool memory. This
does not seem to cause a problem on x86, but the kernel will fail to
boot at least on ARM in QEMU.
This is caused by mixing different allocation types which ended up
breaking the kernel or EDK2 during boot services exit. Commit
2f3c3b0bee5534f2338439f04b0aa517479f8b76 appears to fix this boot
failure because it was replacing the gnu-efi xpool_print with xasprintf
thereby unifying the allocation type.
But this same issue can also happen without this fix somehow when the
random-seed logic is in use.
Fixes: #27371
(cherry picked from commit ec232e4abd7aebfec06b4814b30129532b2bcefd)
Resolves: RHEL-108555
---
src/boot/efi/util.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/boot/efi/util.h b/src/boot/efi/util.h
index f7452e3cf5..16c9fcc3e1 100644
--- a/src/boot/efi/util.h
+++ b/src/boot/efi/util.h
@@ -47,7 +47,7 @@ static inline void freep(void *p) {
_malloc_ _alloc_(1) _returns_nonnull_ _warn_unused_result_
static inline void *xmalloc(size_t size) {
void *p;
- assert_se(BS->AllocatePool(EfiBootServicesData, size, &p) == EFI_SUCCESS);
+ assert_se(BS->AllocatePool(EfiLoaderData, size, &p) == EFI_SUCCESS);
return p;
}

View File

@ -1,11 +1,11 @@
From 6757a16e8fc9df8b36f9b2bcd26a346f44860961 Mon Sep 17 00:00:00 2001
From 7ee5909a539f7a4a65c35e86404ceecb499c54c5 Mon Sep 17 00:00:00 2001
From: Yu Watanabe <watanabe.yu+github@gmail.com>
Date: Thu, 2 Nov 2023 14:20:11 +0900
Subject: [PATCH] meson: /etc/systemd/network is also used by udevd
(cherry picked from commit 6256c65aad2a719ac9054961561bb26e497208ce)
Resolves: RHEL-111611
Resolves: RHEL-109096
---
network/meson.build | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)

View File

@ -1,11 +1,11 @@
From 0156030d3b8298f099389489b7fcb68df6de4516 Mon Sep 17 00:00:00 2001
From 3b49b68593cbca6ee4e08a34a780fd5b5c3ab9fb Mon Sep 17 00:00:00 2001
From: licunlong <licunlong1@huawei.com>
Date: Thu, 15 Jun 2023 16:28:28 +0800
Subject: [PATCH] sd-bus: make bus_add_match_full accept timeout
(cherry picked from commit bb30e58f644689feaa87d8136d1686b6c3a6f42a)
Related: RHEL-111630
Related: RHEL-31756
---
src/libsystemd/sd-bus/bus-control.c | 48 +++++++++++++++++++++-------
src/libsystemd/sd-bus/bus-control.h | 4 +--

View File

@ -1,4 +1,4 @@
From 42c47cd24767a8d1903905735ec4abfa5571cc17 Mon Sep 17 00:00:00 2001
From 1a5720577ae6791ae64795486c5902b7c5aceb6b Mon Sep 17 00:00:00 2001
From: licunlong <licunlong1@huawei.com>
Date: Thu, 15 Jun 2023 10:47:32 +0800
Subject: [PATCH] core/unit: add get_timeout_start_usec in UnitVTable and
@ -6,7 +6,7 @@ Subject: [PATCH] core/unit: add get_timeout_start_usec in UnitVTable and
(cherry picked from commit f5a9d2ee2a849aca1f2d15485d020142ff33cc30)
Related: RHEL-111630
Related: RHEL-31756
---
src/core/service.c | 6 ++++++
src/core/unit.h | 3 +++

View File

@ -1,4 +1,4 @@
From 3f378aafe5cd51fa4e53c7d22be9e3e9fc9fa6d5 Mon Sep 17 00:00:00 2001
From 6b2f0e500e6688d1b2d9ad8b9947e03bd58f27a2 Mon Sep 17 00:00:00 2001
From: licunlong <licunlong1@huawei.com>
Date: Wed, 24 May 2023 11:45:31 +0800
Subject: [PATCH] core/unit: increase the NameOwnerChanged/GetNameOwner timeout
@ -11,7 +11,7 @@ unit's start timeout.
(cherry picked from commit 8df433d7cd268ae96cfe795feaa59f4d3e87b85c)
Related: RHEL-111630
Related: RHEL-31756
---
src/core/unit.c | 39 ++++++++++++++++++++++++++++++++++-----
1 file changed, 34 insertions(+), 5 deletions(-)

View File

@ -1,4 +1,4 @@
From 4fcc6acb1227491c5f76bb15560e34adb7b7f01a Mon Sep 17 00:00:00 2001
From 14c6c9a0a58a99d66f541cec50a5cc860303ae7e Mon Sep 17 00:00:00 2001
From: Yu Watanabe <watanabe.yu+github@gmail.com>
Date: Sun, 29 Dec 2024 15:10:53 +0900
Subject: [PATCH] core,sd-bus: drop empty lines between function call and error
@ -6,7 +6,7 @@ Subject: [PATCH] core,sd-bus: drop empty lines between function call and error
(cherry picked from commit 7baf4d234a70f136014f9e92f00c078a55c7adba)
Related: RHEL-111630
Related: RHEL-31756
---
src/core/unit.c | 1 -
src/libsystemd/sd-bus/sd-bus.c | 1 -

View File

@ -1,4 +1,4 @@
From d250fbcd7247ed2da554e1041c91709c8ed107c7 Mon Sep 17 00:00:00 2001
From 899e94d72119c5e5f3d0ae75f39abd376bc28b0e Mon Sep 17 00:00:00 2001
From: Yu Watanabe <watanabe.yu+github@gmail.com>
Date: Sun, 29 Dec 2024 15:50:43 +0900
Subject: [PATCH] core: do not disconnect from bus when failed to install
@ -14,7 +14,7 @@ the situation when the issue is triggered.
(cherry picked from commit db6b214f95aa42f9a9fa3d94a3c6492cc57b58fb)
Related: RHEL-111630
Related: RHEL-31756
---
src/core/unit.c | 30 ++++++++++++++++++++++++++++--
1 file changed, 28 insertions(+), 2 deletions(-)

View File

@ -1,4 +1,4 @@
From a9dcedfb661c6ae82d3e5cd4542ab75b64a4e70e Mon Sep 17 00:00:00 2001
From 5917dd6d4667ed4f97b63baaa3b35e2c1410f3c0 Mon Sep 17 00:00:00 2001
From: Ronan Pigott <ronan@rjp.ie>
Date: Thu, 28 Nov 2024 12:53:32 -0700
Subject: [PATCH] dbus: stash the subscriber list when we disconenct from the
@ -14,7 +14,7 @@ subscriptions.
(cherry picked from commit 8402ca04d1a063c3d8a9e3d5c16df8bb8778ae98)
Related: RHEL-111630
Related: RHEL-31756
---
src/core/dbus.c | 21 +++++++++++++++------
src/core/dbus.h | 2 +-

View File

@ -1,4 +1,4 @@
From ef32d4747836ecab0190f8780b98d2f29dfd7c6d Mon Sep 17 00:00:00 2001
From 435d53448b8c427dc1b61b4d27342fb593185acf Mon Sep 17 00:00:00 2001
From: Ronan Pigott <ronan@rjp.ie>
Date: Wed, 11 Dec 2024 12:47:10 -0700
Subject: [PATCH] manager: s/deserialized_subscribed/subscribed_as_strv
@ -8,7 +8,7 @@ is misleading. Change the name to reflect its updated purpose.
(cherry picked from commit e1315a621ae26473fcc9cd0d6013836f5f498d40)
Related: RHEL-111630
Related: RHEL-31756
---
src/core/dbus.c | 6 +++---
src/core/manager-serialize.c | 2 +-

View File

@ -1,4 +1,4 @@
From 812ba08785cfe86b3523b168eab7e9eb24dde6e0 Mon Sep 17 00:00:00 2001
From da904dede254800cdbac51905db9423f8f88fefa Mon Sep 17 00:00:00 2001
From: Mike Yuan <me@yhndnzj.com>
Date: Sat, 11 Jan 2025 16:26:55 +0100
Subject: [PATCH] bus-util: do not reset the count returned by
@ -14,7 +14,7 @@ Addresses https://github.com/systemd/systemd/pull/35406#discussion_r1912066774
(cherry picked from commit 33eeea4128f31df7ab4bd8866b582062d70114ae)
Related: RHEL-111630
Related: RHEL-31756
---
src/shared/bus-util.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)

View File

@ -1,4 +1,4 @@
From 15270c9122882650fd355cda22006a2224590cf9 Mon Sep 17 00:00:00 2001
From 02e5c4076ce3981fb2b0c7830197b2f13e225efe Mon Sep 17 00:00:00 2001
From: Mike Yuan <me@yhndnzj.com>
Date: Mon, 13 Jan 2025 17:30:51 +0100
Subject: [PATCH] core/manager: restore bus track deserialization cleanup in
@ -9,7 +9,7 @@ There's zero explanation why it got (spuriously) removed in
(cherry picked from commit 34f4b817f67b002eae7e2c09b19bf4b66c4791b6)
Related: RHEL-111630
Related: RHEL-31756
---
src/core/manager.c | 4 ++++
1 file changed, 4 insertions(+)

View File

@ -1,4 +1,4 @@
From 938b1847f5eee87ad0e0e95d62ee15ac73b50b87 Mon Sep 17 00:00:00 2001
From 8e451eebfe6f37bacb02543d9a38c4ddaa6f8400 Mon Sep 17 00:00:00 2001
From: Mike Yuan <me@yhndnzj.com>
Date: Sat, 11 Jan 2025 18:38:49 +0100
Subject: [PATCH] core/manager: drop duplicate bus track deserialization
@ -8,7 +8,7 @@ bus_init_api() now does this internally
(cherry picked from commit af0e10354e567bfd0b9521376b2aad55f12a4e3d)
Related: RHEL-111630
Related: RHEL-31756
---
src/core/manager.c | 6 ------
1 file changed, 6 deletions(-)

View File

@ -1,4 +1,4 @@
From 2ea409070b1e863d243476c20f0b2229acff6878 Mon Sep 17 00:00:00 2001
From f18c7dd568ba87c6aa9a045878c0a9ef7c23208e Mon Sep 17 00:00:00 2001
From: Michal Sekletar <msekleta@redhat.com>
Date: Thu, 31 Jul 2025 18:26:09 +0200
Subject: [PATCH] sd-bus/bus-track: use install_callback in
@ -15,7 +15,7 @@ Fixes #32381
(cherry picked from commit dcf42d1ee21222ee698e5e0ab3ecf3411b63da40)
Related: RHEL-111630
Related: RHEL-31756
---
src/libsystemd/sd-bus/bus-track.c | 32 +++++++++++++++++++++++++++----
1 file changed, 28 insertions(+), 4 deletions(-)

View File

@ -0,0 +1,38 @@
From 9f940102616443911fff789aae63546c1da3138e Mon Sep 17 00:00:00 2001
From: Luca Boccassi <luca.boccassi@gmail.com>
Date: Tue, 18 Feb 2025 21:15:08 +0000
Subject: [PATCH] shell completion: add kernel-identify/inspect verbs for
bootctl
Follow-up for a05255981ba5b04f1cf54ea656fbce1dfd9c3a68
Follow-up for 3e0a3a0259324b4c40a9a62c8506fe683cd0273b
(cherry picked from commit 6a6d4c3f3c123a1cbb6770f1cae8c130a48333e1)
Resolves: RHEL-108576
---
shell-completion/bash/bootctl | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/shell-completion/bash/bootctl b/shell-completion/bash/bootctl
index 0b7cef7871..328289e0cf 100644
--- a/shell-completion/bash/bootctl
+++ b/shell-completion/bash/bootctl
@@ -70,6 +70,7 @@ _bootctl() {
[STANDALONE]='help status install update remove is-installed random-seed systemd-efi-options list set-timeout set-timeout-oneshot'
[BOOTENTRY]='set-default set-oneshot'
[BOOLEAN]='reboot-to-firmware'
+ [FILE]='kernel-identify kernel-inspect'
)
for ((i=0; i < COMP_CWORD; i++)); do
@@ -100,6 +101,9 @@ _bootctl() {
fi
elif __contains_word "$verb" ${VERBS[BOOLEAN]}; then
comps="yes no"
+ elif __contains_word "$verb" ${VERBS[FILE]}; then
+ comps=$( compgen -A file -- "$cur" )
+ compopt -o filenames
fi
COMPREPLY=( $(compgen -W '$comps' -- "$cur") )

View File

@ -1,4 +1,4 @@
From b60dbde3b1a767239dbaf1025eb9ac55585eac2f Mon Sep 17 00:00:00 2001
From 05b4623cb23c6f083a5bee9769e5cd22d8ff4e16 Mon Sep 17 00:00:00 2001
From: Yu Watanabe <watanabe.yu+github@gmail.com>
Date: Sun, 12 Feb 2023 05:30:49 +0900
Subject: [PATCH] test: add tests for format_timestamp() and parse_timestamp()
@ -6,7 +6,7 @@ Subject: [PATCH] test: add tests for format_timestamp() and parse_timestamp()
(cherry picked from commit 8b51c41fd0796b1299f3b7f2f11eaf4efae8c2db)
Related: RHEL-110954
Related: RHEL-109488
---
src/test/test-time-util.c | 378 ++++++++++++++++++++++++++++++++++++--
1 file changed, 366 insertions(+), 12 deletions(-)

View File

@ -1,4 +1,4 @@
From 46941d4ae57a6d197ab212fea499fe8ab537a769 Mon Sep 17 00:00:00 2001
From c7a62e108ffbe41ccf1bb5fba4b5a37daf317939 Mon Sep 17 00:00:00 2001
From: David Tardon <dtardon@redhat.com>
Date: Fri, 15 Aug 2025 15:12:14 +0200
Subject: [PATCH] test-time-util: disable failing tests
@ -9,7 +9,7 @@ PR.
RHEL-only: ci
Related: RHEL-110954
Related: RHEL-109488
---
src/test/test-time-util.c | 4 ++++
1 file changed, 4 insertions(+)

View File

@ -1,11 +1,11 @@
From b90ba17e5858dd6fc6f199a360ae0892d531c4df Mon Sep 17 00:00:00 2001
From 9010f2b16067fbe974cd1922b596bcd526de07bc Mon Sep 17 00:00:00 2001
From: Yu Watanabe <watanabe.yu+github@gmail.com>
Date: Fri, 3 Mar 2023 12:09:59 +0900
Subject: [PATCH] test: test parse_timestamp() in various timezone
(cherry picked from commit d8f3ad627c9a857d46d442f8ab722c1efab30d5c)
Related: RHEL-110954
Related: RHEL-109488
---
src/test/test-time-util.c | 57 +++++++++++++++++++++++++++++----------
1 file changed, 43 insertions(+), 14 deletions(-)

View File

@ -1,11 +1,11 @@
From 0c887fd73e8d9ade1a4e93fa8e258633d7000a52 Mon Sep 17 00:00:00 2001
From 41b7fedf9ed75f6dfa9fec03a70964b897fbf9ba Mon Sep 17 00:00:00 2001
From: Mike Yuan <me@yhndnzj.com>
Date: Tue, 14 Mar 2023 06:56:17 +0800
Subject: [PATCH] systemctl: logind: add missing asserts
(cherry picked from commit 9071eea01bd26d838bfd793db497efd849ad44da)
Related: RHEL-110954
Related: RHEL-109488
---
src/systemctl/systemctl-logind.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)

View File

@ -1,4 +1,4 @@
From 3e641f30f6ad6990d06bd677aabffdc47ef6e200 Mon Sep 17 00:00:00 2001
From 5085c1c72a52d6c4e8b47d91a6cd08ceec9c49cc Mon Sep 17 00:00:00 2001
From: Mike Yuan <me@yhndnzj.com>
Date: Sun, 5 Mar 2023 23:11:48 +0800
Subject: [PATCH] systemctl: logind: make logind_schedule_shutdown accept
@ -6,7 +6,7 @@ Subject: [PATCH] systemctl: logind: make logind_schedule_shutdown accept
(cherry picked from commit 92b00e867844948bdf559758739343c4308570c0)
Related: RHEL-110954
Related: RHEL-109488
---
src/systemctl/systemctl-compat-halt.c | 2 +-
src/systemctl/systemctl-logind.c | 8 +++++---

View File

@ -1,4 +1,4 @@
From 83f2c59faf0ba979b27824821096dd322336ef2f Mon Sep 17 00:00:00 2001
From 87f8db36eb01b805e7000aeb69ebfaf1c8c323b8 Mon Sep 17 00:00:00 2001
From: Mike Yuan <me@yhndnzj.com>
Date: Sun, 5 Mar 2023 23:27:44 +0800
Subject: [PATCH] systemctl: add option --when for scheduled shutdown
@ -10,7 +10,7 @@ Replaces #17258
(cherry picked from commit 1433e1f998465b7acf472c73d58c14e7e2eb3f13)
Resolves: RHEL-110954
Resolves: RHEL-109488
---
man/systemctl.xml | 41 ++++++++++++++-----------
src/systemctl/systemctl-logind.c | 26 ++++++++++------

View File

@ -1,4 +1,4 @@
From b58bad789badd3872c25c411734fc670f17fe846 Mon Sep 17 00:00:00 2001
From e8f66d4c6570765fd60111ec7e3b5dbdb7d14c69 Mon Sep 17 00:00:00 2001
From: Mike Yuan <me@yhndnzj.com>
Date: Tue, 14 Mar 2023 07:16:18 +0800
Subject: [PATCH] test-time-util: add test cases to invalidate "show" and
@ -8,7 +8,7 @@ Ensure that systemctl reboot --when=show and --when=cancel will not result in am
(cherry picked from commit 165655cb1de2e79d954d9165459143140e52c53b)
Related: RHEL-110954
Related: RHEL-109488
---
src/test/test-time-util.c | 5 +++++
1 file changed, 5 insertions(+)

View File

@ -0,0 +1,128 @@
From 5bec9826a14483e7e612879fe2630f1b517e37be Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Sun, 9 Jul 2023 13:25:42 -0600
Subject: [PATCH] Introduce RET_GATHER and use it in src/shared/
The idea is to make it easier to implement the common pattern of
accumulating errors (negative values) in an accumulator to return
the first error.
(cherry picked from commit 809c3a84e1a572ccaaa7eca5394c0b842118c22f)
Resolves: RHEL-108598
---
src/basic/errno-util.h | 10 ++++++++++
src/shared/bus-util.c | 10 ++--------
src/shared/devnode-acl.c | 4 ++--
src/shared/nscd-flush.c | 16 +++++-----------
src/test/test-errno-util.c | 11 +++++++++++
5 files changed, 30 insertions(+), 21 deletions(-)
diff --git a/src/basic/errno-util.h b/src/basic/errno-util.h
index b10dd755c9..27804e6382 100644
--- a/src/basic/errno-util.h
+++ b/src/basic/errno-util.h
@@ -74,6 +74,16 @@ static inline int RET_NERRNO(int ret) {
return ret;
}
+/* Collect possible errors in <acc>, so that the first error can be returned.
+ * Returns (possibly updated) <acc>. */
+#define RET_GATHER(acc, err) \
+ ({ \
+ int *__a = &(acc), __e = (err); \
+ if (*__a >= 0 && __e < 0) \
+ *__a = __e; \
+ *__a; \
+ })
+
static inline int errno_or_else(int fallback) {
/* To be used when invoking library calls where errno handling is not defined clearly: we return
* errno if it is set, and the specified error otherwise. The idea is that the caller initializes
diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c
index 5e6d17d201..7c8d2aa6f5 100644
--- a/src/shared/bus-util.c
+++ b/src/shared/bus-util.c
@@ -484,14 +484,8 @@ int bus_track_add_name_many(sd_bus_track *t, char **l) {
/* Continues adding after failure, and returns the first failure. */
- STRV_FOREACH(i, l) {
- int k;
-
- k = sd_bus_track_add_name(t, *i);
- if (k < 0 && r >= 0)
- r = k;
- }
-
+ STRV_FOREACH(i, l)
+ RET_GATHER(r, sd_bus_track_add_name(t, *i));
return r;
}
diff --git a/src/shared/devnode-acl.c b/src/shared/devnode-acl.c
index 66e3a40f2f..8c961061cf 100644
--- a/src/shared/devnode-acl.c
+++ b/src/shared/devnode-acl.c
@@ -220,8 +220,8 @@ int devnode_acl_all(const char *seat,
k = devnode_acl(n, flush, del, old_uid, add, new_uid);
if (k == -ENOENT)
log_debug("Device %s disappeared while setting ACLs", n);
- else if (k < 0 && r == 0)
- r = k;
+ else
+ RET_GATHER(r, k);
}
return r;
diff --git a/src/shared/nscd-flush.c b/src/shared/nscd-flush.c
index 9b0ba2d67a..d2b41f2b4d 100644
--- a/src/shared/nscd-flush.c
+++ b/src/shared/nscd-flush.c
@@ -128,21 +128,15 @@ static int nscd_flush_cache_one(const char *database, usec_t end) {
}
int nscd_flush_cache(char **databases) {
- usec_t end;
int r = 0;
- /* Tries to invalidate the specified database in nscd. We do this carefully, with a 5s timeout, so that we
- * don't block indefinitely on another service. */
+ /* Tries to invalidate the specified database in nscd. We do this carefully, with a 5s timeout,
+ * so that we don't block indefinitely on another service. */
- end = usec_add(now(CLOCK_MONOTONIC), NSCD_FLUSH_CACHE_TIMEOUT_USEC);
+ usec_t end = usec_add(now(CLOCK_MONOTONIC), NSCD_FLUSH_CACHE_TIMEOUT_USEC);
- STRV_FOREACH(i, databases) {
- int k;
-
- k = nscd_flush_cache_one(*i, end);
- if (k < 0 && r >= 0)
- r = k;
- }
+ STRV_FOREACH(i, databases)
+ RET_GATHER(r, nscd_flush_cache_one(*i, end));
return r;
}
diff --git a/src/test/test-errno-util.c b/src/test/test-errno-util.c
index cac0d5402b..77fb7d0011 100644
--- a/src/test/test-errno-util.c
+++ b/src/test/test-errno-util.c
@@ -67,4 +67,15 @@ TEST(ERRNO_IS_TRANSIENT) {
assert_se(!ERRNO_IS_NEG_TRANSIENT(INTMAX_MIN));
}
+TEST(RET_GATHER) {
+ int x = 0, y = 2;
+
+ assert_se(RET_GATHER(x, 5) == 0);
+ assert_se(RET_GATHER(x, -5) == -5);
+ assert_se(RET_GATHER(x, -1) == -5);
+
+ assert_se(RET_GATHER(x, y++) == -5);
+ assert_se(y == 3);
+}
+
DEFINE_TEST_MAIN(LOG_INFO);

View File

@ -0,0 +1,50 @@
From c2dc44abd4014f13a40dde350af92e2d74201359 Mon Sep 17 00:00:00 2001
From: Mike Yuan <me@yhndnzj.com>
Date: Fri, 29 Dec 2023 17:57:59 +0800
Subject: [PATCH] fd-util: don't eat up errors in fd_cloexec_many
Follow-up for ed18c22c989495aab36512f03449222cfcf79aa7
Before this commit, a successful fd_cloexec() call would
discard all previously gathered errors.
(cherry picked from commit 6b9cac874c33f4fa27aa4b4b5b980f60c28ee043)
Resolves: RHEL-108598
---
src/basic/fd-util.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/src/basic/fd-util.c b/src/basic/fd-util.c
index 66bb7569bb..932c5a8d80 100644
--- a/src/basic/fd-util.c
+++ b/src/basic/fd-util.c
@@ -175,7 +175,7 @@ int fd_cloexec(int fd, bool cloexec) {
}
int fd_cloexec_many(const int fds[], size_t n_fds, bool cloexec) {
- int ret = 0, r;
+ int r = 0;
assert(n_fds == 0 || fds);
@@ -183,14 +183,13 @@ int fd_cloexec_many(const int fds[], size_t n_fds, bool cloexec) {
if (fds[i] < 0) /* Skip gracefully over already invalidated fds */
continue;
- r = fd_cloexec(fds[i], cloexec);
- if (r < 0 && ret >= 0) /* Continue going, but return first error */
- ret = r;
- else
- ret = 1; /* report if we did anything */
+ RET_GATHER(r, fd_cloexec(fds[i], cloexec));
+
+ if (r >= 0)
+ r = 1; /* report if we did anything */
}
- return ret;
+ return r;
}
_pure_ static bool fd_in_set(int fd, const int fdset[], size_t n_fdset) {

View File

@ -0,0 +1,52 @@
From 762a8dc0c328e256847b111249bbff8e70f98942 Mon Sep 17 00:00:00 2001
From: Yu Watanabe <watanabe.yu+github@gmail.com>
Date: Fri, 19 May 2023 04:33:39 +0900
Subject: [PATCH] sd-bus: refuse to send messages with an invalid string
Prompted by aaf7b0e41105d7b7cf30912cdac32820f011a219 and
4804da58536ab7ad46178a03f4d2da49fd8e4ba2.
(cherry picked from commit 26a9dd6f55bb757e0033995cbb16bca12986b7cd)
Resolves: RHEL-108584
---
src/libsystemd/sd-bus/bus-message.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/src/libsystemd/sd-bus/bus-message.c b/src/libsystemd/sd-bus/bus-message.c
index 213b276e33..c51af56dda 100644
--- a/src/libsystemd/sd-bus/bus-message.c
+++ b/src/libsystemd/sd-bus/bus-message.c
@@ -1324,12 +1324,21 @@ int message_append_basic(sd_bus_message *m, char type, const void *p, const void
* into the empty string */
p = strempty(p);
- _fallthrough_;
+ if (!utf8_is_valid(p))
+ return -EINVAL;
+
+ align = 4;
+ sz = 4 + strlen(p) + 1;
+ break;
+
case SD_BUS_TYPE_OBJECT_PATH:
if (!p)
return -EINVAL;
+ if (!object_path_is_valid(p))
+ return -EINVAL;
+
align = 4;
sz = 4 + strlen(p) + 1;
break;
@@ -1338,6 +1347,9 @@ int message_append_basic(sd_bus_message *m, char type, const void *p, const void
p = strempty(p);
+ if (!signature_is_valid(p, /* allow_dict_entry = */ true))
+ return -EINVAL;
+
align = 1;
sz = 1 + strlen(p) + 1;
break;

View File

@ -0,0 +1,92 @@
From f3f939b236636fdca38e89ca564a669f0da4fd4d Mon Sep 17 00:00:00 2001
From: Frantisek Sumsal <frantisek@sumsal.cz>
Date: Fri, 19 May 2023 18:42:36 +0200
Subject: [PATCH] test: check if we correctly handle invalid UTF-8 in mount
stuff
Provides coverage for #27611.
(cherry picked from commit b74df879fc81d4668ce14532a76c23b85e651170)
Resolves: RHEL-108584
---
.../units/testsuite-07.mount-invalid-chars.sh | 70 +++++++++++++++++++
1 file changed, 70 insertions(+)
create mode 100755 test/units/testsuite-07.mount-invalid-chars.sh
diff --git a/test/units/testsuite-07.mount-invalid-chars.sh b/test/units/testsuite-07.mount-invalid-chars.sh
new file mode 100755
index 0000000000..617ea697c8
--- /dev/null
+++ b/test/units/testsuite-07.mount-invalid-chars.sh
@@ -0,0 +1,70 @@
+#!/usr/bin/env bash
+# SPDX-License-Identifier: LGPL-2.1-or-later
+set -eux
+set -o pipefail
+
+# Don't send invalid characters over dbus if a mount contains them
+
+at_exit() {
+ mountpoint -q /proc/1/mountinfo && umount /proc/1/mountinfo
+ [[ -e /tmp/fstab.bak ]] && mv -f /tmp/fstab /etc/fstab
+ rm -f /run/systemd/system/foo-*.mount
+ systemctl daemon-reload
+}
+
+trap at_exit EXIT
+
+# Check invalid characters directly in /proc/mountinfo
+#
+# This is a bit tricky (and hacky), since we have to temporarily replace
+# PID 1's /proc/mountinfo, but we have to keep the original mounts intact,
+# otherwise systemd would unmount them on reload
+TMP_MOUNTINFO="$(mktemp)"
+
+cp /proc/1/mountinfo "$TMP_MOUNTINFO"
+# Add a mount entry with a "Unicode non-character" in it
+echo -ne '69 1 252:2 / /foo/mountinfo rw,relatime shared:1 - cifs //foo\ufffebar rw,seclabel\n' >>"$TMP_MOUNTINFO"
+mount --bind "$TMP_MOUNTINFO" /proc/1/mountinfo
+systemctl daemon-reload
+# On affected versions this would throw an error:
+# Failed to get properties: Bad message
+systemctl status foo-mountinfo.mount
+
+umount /proc/1/mountinfo
+systemctl daemon-reload
+rm -f "$TMP_MOUNTINFO"
+
+# Check invalid characters in a mount unit
+#
+# systemd already handles this and refuses to load the invalid string, e.g.:
+# foo-fstab.mount:9: String is not UTF-8 clean, ignoring assignment: What=//localhost/foo<6F><6F><EFBFBD>bar
+#
+# a) Unit generated from /etc/fstab
+[[ -e /etc/fstab ]] && cp -f /etc/fstab /tmp/fstab.bak
+
+echo -ne '//localhost/foo\ufffebar /foo/fstab cifs defaults 0 0\n' >/etc/fstab
+systemctl daemon-reload
+[[ "$(systemctl show -P UnitFileState foo-fstab.mount)" == bad ]]
+
+# b) Unit generated from /etc/fstab (but the invalid character is in options)
+echo -ne '//localhost/foobar /foo/fstab/opt cifs nosuid,a\ufffeb,noexec 0 0\n' >/etc/fstab
+systemctl daemon-reload
+[[ "$(systemctl show -P UnitFileState foo-fstab-opt.mount)" == bad ]]
+rm -f /etc/fstab
+
+[[ -e /tmp/fstab.bak ]] && mv -f /tmp/fstab /etc/fstab
+systemctl daemon-reload
+
+# c) Mount unit
+mkdir -p /run/systemd/system
+echo -ne '[Mount]\nWhat=//localhost/foo\ufffebar\nWhere=/foo/unit\nType=cifs\nOptions=noexec\n' >/run/systemd/system/foo-unit.mount
+systemctl daemon-reload
+[[ "$(systemctl show -P UnitFileState foo-unit.mount)" == bad ]]
+rm -f /run/systemd/system/foo-unit.mount
+
+# d) Mount unit (but the invalid character is in Options=)
+mkdir -p /run/systemd/system
+echo -ne '[Mount]\nWhat=//localhost/foobar\nWhere=/foo/unit/opt\nType=cifs\nOptions=noexec,a\ufffeb,nosuid\n' >/run/systemd/system/foo-unit-opt.mount
+systemctl daemon-reload
+[[ "$(systemctl show -P UnitFileState foo-unit-opt.mount)" == bad ]]
+rm -f /run/systemd/system/foo-unit-opt.mount

View File

@ -0,0 +1,25 @@
From e882eabc5c9115413db1e6d83f4542ad618fec23 Mon Sep 17 00:00:00 2001
From: Frantisek Sumsal <frantisek@sumsal.cz>
Date: Mon, 22 May 2023 12:06:16 +0200
Subject: [PATCH] test: fix a typo in the cleanup stuff
(cherry picked from commit 7942811255f3d6973b246ebf6b26b690bbceab37)
Resolves: RHEL-108584
---
test/units/testsuite-07.mount-invalid-chars.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test/units/testsuite-07.mount-invalid-chars.sh b/test/units/testsuite-07.mount-invalid-chars.sh
index 617ea697c8..b70e621126 100755
--- a/test/units/testsuite-07.mount-invalid-chars.sh
+++ b/test/units/testsuite-07.mount-invalid-chars.sh
@@ -7,7 +7,7 @@ set -o pipefail
at_exit() {
mountpoint -q /proc/1/mountinfo && umount /proc/1/mountinfo
- [[ -e /tmp/fstab.bak ]] && mv -f /tmp/fstab /etc/fstab
+ [[ -e /tmp/fstab.bak ]] && mv -f /tmp/fstab.bak /etc/fstab
rm -f /run/systemd/system/foo-*.mount
systemctl daemon-reload
}

View File

@ -0,0 +1,62 @@
From 78641d8a552eb95dd85cad9686d829af48478727 Mon Sep 17 00:00:00 2001
From: Frantisek Sumsal <frantisek@sumsal.cz>
Date: Mon, 14 Aug 2023 20:09:31 +0200
Subject: [PATCH] test: explicitly specify a UTF-8 locale for UTF-8 shenanigans
As things don't work well without it:
$ LANG=C printf "\ufffe\n"
\uFFFE
(cherry picked from commit 01febfcdce0326aa1888d085c1009c9399f6a930)
Resolves: RHEL-108584
---
test/units/testsuite-07.mount-invalid-chars.sh | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/test/units/testsuite-07.mount-invalid-chars.sh b/test/units/testsuite-07.mount-invalid-chars.sh
index b70e621126..5a07d14d04 100755
--- a/test/units/testsuite-07.mount-invalid-chars.sh
+++ b/test/units/testsuite-07.mount-invalid-chars.sh
@@ -23,7 +23,7 @@ TMP_MOUNTINFO="$(mktemp)"
cp /proc/1/mountinfo "$TMP_MOUNTINFO"
# Add a mount entry with a "Unicode non-character" in it
-echo -ne '69 1 252:2 / /foo/mountinfo rw,relatime shared:1 - cifs //foo\ufffebar rw,seclabel\n' >>"$TMP_MOUNTINFO"
+LANG="C.UTF-8" printf '69 1 252:2 / /foo/mountinfo rw,relatime shared:1 - cifs //foo\ufffebar rw,seclabel\n' >>"$TMP_MOUNTINFO"
mount --bind "$TMP_MOUNTINFO" /proc/1/mountinfo
systemctl daemon-reload
# On affected versions this would throw an error:
@@ -42,12 +42,12 @@ rm -f "$TMP_MOUNTINFO"
# a) Unit generated from /etc/fstab
[[ -e /etc/fstab ]] && cp -f /etc/fstab /tmp/fstab.bak
-echo -ne '//localhost/foo\ufffebar /foo/fstab cifs defaults 0 0\n' >/etc/fstab
+LANG="C.UTF-8" printf '//localhost/foo\ufffebar /foo/fstab cifs defaults 0 0\n' >/etc/fstab
systemctl daemon-reload
[[ "$(systemctl show -P UnitFileState foo-fstab.mount)" == bad ]]
# b) Unit generated from /etc/fstab (but the invalid character is in options)
-echo -ne '//localhost/foobar /foo/fstab/opt cifs nosuid,a\ufffeb,noexec 0 0\n' >/etc/fstab
+LANG="C.UTF-8" printf '//localhost/foobar /foo/fstab/opt cifs nosuid,a\ufffeb,noexec 0 0\n' >/etc/fstab
systemctl daemon-reload
[[ "$(systemctl show -P UnitFileState foo-fstab-opt.mount)" == bad ]]
rm -f /etc/fstab
@@ -57,14 +57,14 @@ systemctl daemon-reload
# c) Mount unit
mkdir -p /run/systemd/system
-echo -ne '[Mount]\nWhat=//localhost/foo\ufffebar\nWhere=/foo/unit\nType=cifs\nOptions=noexec\n' >/run/systemd/system/foo-unit.mount
+LANG="C.UTF-8" printf '[Mount]\nWhat=//localhost/foo\ufffebar\nWhere=/foo/unit\nType=cifs\nOptions=noexec\n' >/run/systemd/system/foo-unit.mount
systemctl daemon-reload
[[ "$(systemctl show -P UnitFileState foo-unit.mount)" == bad ]]
rm -f /run/systemd/system/foo-unit.mount
# d) Mount unit (but the invalid character is in Options=)
mkdir -p /run/systemd/system
-echo -ne '[Mount]\nWhat=//localhost/foobar\nWhere=/foo/unit/opt\nType=cifs\nOptions=noexec,a\ufffeb,nosuid\n' >/run/systemd/system/foo-unit-opt.mount
+LANG="C.UTF-8" printf '[Mount]\nWhat=//localhost/foobar\nWhere=/foo/unit/opt\nType=cifs\nOptions=noexec,a\ufffeb,nosuid\n' >/run/systemd/system/foo-unit-opt.mount
systemctl daemon-reload
[[ "$(systemctl show -P UnitFileState foo-unit-opt.mount)" == bad ]]
rm -f /run/systemd/system/foo-unit-opt.mount

View File

@ -0,0 +1,26 @@
From 15ad0f0a0145640ee290d805030338f8c01051f4 Mon Sep 17 00:00:00 2001
From: Frantisek Sumsal <frantisek@sumsal.cz>
Date: Wed, 23 Aug 2023 15:10:23 +0200
Subject: [PATCH] test: use the correct file name when restoring the original
fstab
(cherry picked from commit 9541addff028b56724df79fcf5b88e1544403957)
Resolves: RHEL-108584
---
test/units/testsuite-07.mount-invalid-chars.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test/units/testsuite-07.mount-invalid-chars.sh b/test/units/testsuite-07.mount-invalid-chars.sh
index 5a07d14d04..a879334869 100755
--- a/test/units/testsuite-07.mount-invalid-chars.sh
+++ b/test/units/testsuite-07.mount-invalid-chars.sh
@@ -52,7 +52,7 @@ systemctl daemon-reload
[[ "$(systemctl show -P UnitFileState foo-fstab-opt.mount)" == bad ]]
rm -f /etc/fstab
-[[ -e /tmp/fstab.bak ]] && mv -f /tmp/fstab /etc/fstab
+[[ -e /tmp/fstab.bak ]] && mv -f /tmp/fstab.bak /etc/fstab
systemctl daemon-reload
# c) Mount unit

View File

@ -0,0 +1,134 @@
From b280191167ddc52a77da5b4047297d288f9ce73b Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Fri, 20 Jun 2025 13:16:10 +0200
Subject: [PATCH] core: escape UTF-8 in mount unit Where field before sending
to clients
Followup for: 4804da58536ab7ad46178a03f4d2da49fd8e4ba2 #27541
Fixes: #36206
(cherry picked from commit 222b0b05ce9ac29283cd89cf98444c4da3373568)
Resolves: RHEL-108584
---
src/core/dbus-mount.c | 23 ++++++++++++++++++-
src/core/mount.c | 16 ++++++++++++-
src/core/mount.h | 2 ++
.../units/testsuite-07.mount-invalid-chars.sh | 5 ++--
4 files changed, 42 insertions(+), 4 deletions(-)
diff --git a/src/core/dbus-mount.c b/src/core/dbus-mount.c
index 55ad4f2c98..7006ebbbba 100644
--- a/src/core/dbus-mount.c
+++ b/src/core/dbus-mount.c
@@ -11,6 +11,27 @@
#include "unit.h"
#include "utf8.h"
+static int property_get_where(
+ sd_bus *bus,
+ const char *path,
+ const char *interface,
+ const char *property,
+ sd_bus_message *reply,
+ void *userdata,
+ sd_bus_error *error) {
+
+ Mount *m = ASSERT_PTR(userdata);
+
+ assert(bus);
+ assert(reply);
+
+ _cleanup_free_ char *escaped = mount_get_where_escaped(m);
+ if (!escaped)
+ return -ENOMEM;
+
+ return sd_bus_message_append_basic(reply, 's', escaped);
+}
+
static int property_get_what(
sd_bus *bus,
const char *path,
@@ -84,7 +105,7 @@ static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_result, mount_result, MountResu
const sd_bus_vtable bus_mount_vtable[] = {
SD_BUS_VTABLE_START(0),
- SD_BUS_PROPERTY("Where", "s", NULL, offsetof(Mount, where), SD_BUS_VTABLE_PROPERTY_CONST),
+ SD_BUS_PROPERTY("Where", "s", property_get_where, 0, SD_BUS_VTABLE_PROPERTY_CONST),
SD_BUS_PROPERTY("What", "s", property_get_what, 0, SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE),
SD_BUS_PROPERTY("Options","s", property_get_options, 0, SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE),
SD_BUS_PROPERTY("Type", "s", property_get_type, 0, SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE),
diff --git a/src/core/mount.c b/src/core/mount.c
index cfe3f40302..79772fb6f1 100644
--- a/src/core/mount.c
+++ b/src/core/mount.c
@@ -31,6 +31,7 @@
#include "strv.h"
#include "unit-name.h"
#include "unit.h"
+#include "utf8.h"
#define RETRY_UMOUNT_MAX 32
@@ -657,7 +658,11 @@ static int mount_add_extras(Mount *m) {
path_simplify(m->where);
if (!u->description) {
- r = unit_set_description(u, m->where);
+ _cleanup_free_ char *w = mount_get_where_escaped(m);
+ if (!w)
+ return log_oom();
+
+ r = unit_set_description(u, w);
if (r < 0)
return r;
}
@@ -2207,6 +2212,15 @@ static int mount_can_start(Unit *u) {
return 1;
}
+char* mount_get_where_escaped(const Mount *m) {
+ assert(m);
+
+ if (!m->where)
+ return strdup("");
+
+ return utf8_escape_invalid(m->where);
+}
+
static const char* const mount_exec_command_table[_MOUNT_EXEC_COMMAND_MAX] = {
[MOUNT_EXEC_MOUNT] = "ExecMount",
[MOUNT_EXEC_UNMOUNT] = "ExecUnmount",
diff --git a/src/core/mount.h b/src/core/mount.h
index 1a0d9fc5e5..db4a915202 100644
--- a/src/core/mount.h
+++ b/src/core/mount.h
@@ -93,6 +93,8 @@ extern const UnitVTable mount_vtable;
void mount_fd_event(Manager *m, int events);
+char* mount_get_where_escaped(const Mount *m);
+
const char* mount_exec_command_to_string(MountExecCommand i) _const_;
MountExecCommand mount_exec_command_from_string(const char *s) _pure_;
diff --git a/test/units/testsuite-07.mount-invalid-chars.sh b/test/units/testsuite-07.mount-invalid-chars.sh
index a879334869..cd2ca78fdf 100755
--- a/test/units/testsuite-07.mount-invalid-chars.sh
+++ b/test/units/testsuite-07.mount-invalid-chars.sh
@@ -23,12 +23,13 @@ TMP_MOUNTINFO="$(mktemp)"
cp /proc/1/mountinfo "$TMP_MOUNTINFO"
# Add a mount entry with a "Unicode non-character" in it
-LANG="C.UTF-8" printf '69 1 252:2 / /foo/mountinfo rw,relatime shared:1 - cifs //foo\ufffebar rw,seclabel\n' >>"$TMP_MOUNTINFO"
+LANG="C.UTF-8" printf '69 1 252:2 / /foo/mount\ufffeinfo rw,relatime shared:1 - cifs //foo\ufffebar rw,seclabel\n' >>"$TMP_MOUNTINFO"
mount --bind "$TMP_MOUNTINFO" /proc/1/mountinfo
systemctl daemon-reload
# On affected versions this would throw an error:
# Failed to get properties: Bad message
-systemctl status foo-mountinfo.mount
+systemctl list-units -t mount
+systemctl status foo-mount\\xef\\xbf\\xbeinfo.mount
umount /proc/1/mountinfo
systemctl daemon-reload

View File

@ -1,4 +1,4 @@
From bdbf4f6041c4d21d50c87ca05ab82e28e9eea338 Mon Sep 17 00:00:00 2001
From 4d4f5e617bb467be81274dc32b7066fc5ce52b75 Mon Sep 17 00:00:00 2001
From: Frantisek Sumsal <fsumsal@redhat.com>
Date: Wed, 3 Sep 2025 13:55:00 +0200
Subject: [PATCH] Revert "test-time-util: disable failing tests"
@ -8,7 +8,7 @@ This won't be needed anymore.
This reverts commit c7a62e108ffbe41ccf1bb5fba4b5a37daf317939.
rhel-only: ci
Related: RHEL-110954
Related: RHEL-109488
---
src/test/test-time-util.c | 4 ----
1 file changed, 4 deletions(-)

View File

@ -1,11 +1,11 @@
From f54fa1e74a446bb0470ae321ddad090a3889fb4c Mon Sep 17 00:00:00 2001
From 03dff755efde1a311969636e11fe95c398b7d878 Mon Sep 17 00:00:00 2001
From: Yu Watanabe <watanabe.yu+github@gmail.com>
Date: Fri, 3 Mar 2023 19:40:40 +0900
Subject: [PATCH] test: use get_timezones() to iterate all known timezones
(cherry picked from commit 0b20d70d1c7c190fb943dd4d1f28e6f456d2193e)
Related: RHEL-110954
Related: RHEL-109488
---
src/test/test-time-util.c | 50 +++++++++------------------------------
1 file changed, 11 insertions(+), 39 deletions(-)

View File

@ -1,11 +1,11 @@
From c3b2149222607cdf6a73cb6d268605f41f33b3dc Mon Sep 17 00:00:00 2001
From c1e4badeadf75e75b6059a6d644d28414013c102 Mon Sep 17 00:00:00 2001
From: Yu Watanabe <watanabe.yu+github@gmail.com>
Date: Mon, 13 Mar 2023 03:47:45 +0900
Subject: [PATCH] test-time-util: do not fail on DST change
(cherry picked from commit cfacd245e798282fcb9b3231bd6e857abfe124fc)
Related: RHEL-110954
Related: RHEL-109488
---
src/test/test-time-util.c | 37 ++++++++++++++++++++++++++++++-------
1 file changed, 30 insertions(+), 7 deletions(-)

View File

@ -1,4 +1,4 @@
From ca17098a803ab2aa72a12237a383d649db973ba7 Mon Sep 17 00:00:00 2001
From 8e8569467616ee982df2cc73ac39240482c92d36 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Sun, 26 Nov 2023 20:58:43 +0100
Subject: [PATCH] test-time-util: suppress timestamp conversion failures for
@ -30,7 +30,7 @@ Fixes https://github.com/systemd/systemd/issues/28472.
(cherry picked from commit 78b95ccad864e1f993fe0776841dd8f39856581b)
Related: RHEL-110954
Related: RHEL-109488
---
src/test/test-time-util.c | 22 ++++++++++++++++++----
1 file changed, 18 insertions(+), 4 deletions(-)

View File

@ -1,4 +1,4 @@
From 0078cf3a12a57fc0576407752c88881dfe7ed4d6 Mon Sep 17 00:00:00 2001
From 846cb844c3e8b5621745798f62bfbfb4275735f1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Thu, 5 Dec 2024 13:32:19 +0100
Subject: [PATCH] test-time-util: do more suppression of time zone checks
@ -31,7 +31,7 @@ Extend the override to suppress this.
(cherry picked from commit 3cf362f6f57b7d0b5f6b86a49316303b0dda7599)
Related: RHEL-110954
Related: RHEL-109488
---
src/test/test-time-util.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)

View File

@ -1,4 +1,4 @@
From 442b74d5a4aca7f9bde1b8fb10bf295e26524a8d Mon Sep 17 00:00:00 2001
From cb442eb90085aae9db3bdf0cd7a4730912dba3ef Mon Sep 17 00:00:00 2001
From: Yu Watanabe <watanabe.yu+github@gmail.com>
Date: Sat, 14 Dec 2024 16:49:54 +0900
Subject: [PATCH] test-time-util: fix truncation of usec to sec
@ -9,7 +9,7 @@ Also
(cherry picked from commit 3f1d499964abb6a4c0141d7ea8f852829880adff)
Related: RHEL-110954
Related: RHEL-109488
---
src/test/test-time-util.c | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)

View File

@ -1,4 +1,4 @@
From 7e8c2a88b4896519c83470e1a25983a5a89f7c2d Mon Sep 17 00:00:00 2001
From e0ac4a4632c99750ad63476c3ae62a1988b2883b Mon Sep 17 00:00:00 2001
From: Luca Boccassi <bluca@debian.org>
Date: Fri, 26 Jan 2024 00:22:38 +0000
Subject: [PATCH] test: unset TZ before timezone-sensitive unit tests are run
@ -9,7 +9,7 @@ is the case during reproducible build tests. Unset it.
(cherry picked from commit 1e902c3463024bb328bf0d01a5d58a69e1ccf739)
Related: RHEL-110954
Related: RHEL-109488
---
src/test/test-calendarspec.c | 9 ++++++++-
src/test/test-date.c | 3 +++

View File

@ -1,4 +1,4 @@
From 6960aaa9c4b19bfd73f7390ececf626ab29700e6 Mon Sep 17 00:00:00 2001
From bef180f6ddc06bc6e669024b5d1fb9b97a1e3f4d Mon Sep 17 00:00:00 2001
From: Frantisek Sumsal <fsumsal@redhat.com>
Date: Tue, 2 Sep 2025 17:33:35 +0200
Subject: [PATCH] meson: extend timeout for test-time-util
@ -9,7 +9,7 @@ running under sanitizers.
Based on upstream's b66b3c409900a77b3da7b366ae5a0179abacea99.
rhel-only: ci
Related: RHEL-110954
Related: RHEL-109488
---
src/test/meson.build | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

View File

@ -1,11 +1,11 @@
From a5eaf78908b562cdc63a916a479fce4b7a61ce8f Mon Sep 17 00:00:00 2001
From c5bdf8c148fc9ab18d3412756ada7317caece6fe Mon Sep 17 00:00:00 2001
From: Yu Watanabe <watanabe.yu+github@gmail.com>
Date: Tue, 14 Feb 2023 01:40:56 +0900
Subject: [PATCH] time-util: use DEFINE_STRING_TABLE_LOOKUP_TO_STRING() macro
(cherry picked from commit d227a42aadf04c23c668ac3089bc7b4a9baaf7e1)
Related: RHEL-110954
Related: RHEL-109488
---
src/basic/time-util.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

View File

@ -1,11 +1,11 @@
From 5b8414e3b28303c4b81148329f2b3d781701f20b Mon Sep 17 00:00:00 2001
From 243ecafd63c2c0f8cbdecee770626143bf4def62 Mon Sep 17 00:00:00 2001
From: Yu Watanabe <watanabe.yu+github@gmail.com>
Date: Tue, 14 Feb 2023 01:41:38 +0900
Subject: [PATCH] time-util: align string table
(cherry picked from commit e01a8fdd2645c06cdb9057bd5b8a45ab02c0d6ee)
Related: RHEL-110954
Related: RHEL-109488
---
src/basic/time-util.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

View File

@ -1,11 +1,11 @@
From c7d103bae26ae6eec9fc7f0a272ec7ea9eeede5c Mon Sep 17 00:00:00 2001
From 753dd2e5f28a9b5a552efda75bcbec20ad501e69 Mon Sep 17 00:00:00 2001
From: Yu Watanabe <watanabe.yu+github@gmail.com>
Date: Tue, 14 Feb 2023 02:04:31 +0900
Subject: [PATCH] time-util: rename variables
(cherry picked from commit cf98b66d1ad0ff0e9ee0444861069ebade038dbb)
Related: RHEL-110954
Related: RHEL-109488
---
src/basic/time-util.c | 86 +++++++++++++++++++++----------------------
src/basic/time-util.h | 16 ++++----

View File

@ -1,11 +1,11 @@
From 8763258128be54c83c480b72d64b7ac17f649087 Mon Sep 17 00:00:00 2001
From 23f6608ffa05ce80ebfbca9a28369ff858e9d42e Mon Sep 17 00:00:00 2001
From: Yu Watanabe <watanabe.yu+github@gmail.com>
Date: Tue, 14 Feb 2023 02:06:13 +0900
Subject: [PATCH] time-util: add assertions
(cherry picked from commit dff3bddc5416834d42cc682cb544732a4b91db3b)
Related: RHEL-110954
Related: RHEL-109488
---
src/basic/time-util.c | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)

View File

@ -1,11 +1,11 @@
From c8e89ba084dd8c8984d546599a4f77f8d23436cd Mon Sep 17 00:00:00 2001
From a3c08667c9abaf60793ed35e93123bc5f89981f3 Mon Sep 17 00:00:00 2001
From: Yu Watanabe <watanabe.yu+github@gmail.com>
Date: Tue, 14 Feb 2023 03:43:58 +0900
Subject: [PATCH] time-util: drop redundant else
(cherry picked from commit 17d1ebfc43c3b971d20ff2806acc634ee153eef6)
Related: RHEL-110954
Related: RHEL-109488
---
src/basic/time-util.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)

View File

@ -1,4 +1,4 @@
From 9a60636d53e7a38445546e34231dbd2885d6beaf Mon Sep 17 00:00:00 2001
From 50a7d58a24a381e265436c14303e7bb368a4b147 Mon Sep 17 00:00:00 2001
From: Yu Watanabe <watanabe.yu+github@gmail.com>
Date: Tue, 14 Feb 2023 03:41:26 +0900
Subject: [PATCH] time-util: do not use strdupa()
@ -7,7 +7,7 @@ The input string may come from command line, config files.
(cherry picked from commit 804537bdc420bb82e54b455b7a10d542c8f029dd)
Related: RHEL-110954
Related: RHEL-109488
---
src/basic/time-util.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)

View File

@ -1,4 +1,4 @@
From a5bec1b4303dcc62be2cf58c1fb86e043011ee55 Mon Sep 17 00:00:00 2001
From eabf4db441c885a78d5726838004bbb9436dbf91 Mon Sep 17 00:00:00 2001
From: Yu Watanabe <watanabe.yu+github@gmail.com>
Date: Tue, 14 Feb 2023 04:14:24 +0900
Subject: [PATCH] time-util: use result from startswith_no_case()
@ -7,7 +7,7 @@ No functional change, just refactoring.
(cherry picked from commit f2ecfd8bc1e6d09173e9f98c5ac1b19b755a3c25)
Related: RHEL-110954
Related: RHEL-109488
---
src/basic/time-util.c | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)

View File

@ -1,4 +1,4 @@
From 66f38176c44a379f6ffdef619f7d83095469a77a Mon Sep 17 00:00:00 2001
From 9f7d490b1c16f0444987dab7ce70287b59d98cf9 Mon Sep 17 00:00:00 2001
From: Yu Watanabe <watanabe.yu+github@gmail.com>
Date: Tue, 14 Feb 2023 04:27:27 +0900
Subject: [PATCH] time-util: use usec_add() and usec_sub_unsigned()
@ -8,7 +8,7 @@ as usec_add() can handle overflow correctly.
(cherry picked from commit db43717e982e1361eee4bdcd92167d6c47eb627c)
Related: RHEL-110954
Related: RHEL-109488
---
src/basic/time-util.c | 17 +++++++----------
1 file changed, 7 insertions(+), 10 deletions(-)

View File

@ -1,4 +1,4 @@
From 634908732d300cc014368c95023e64dc8260759d Mon Sep 17 00:00:00 2001
From 2dafd8e6be624f93c757ca9c739d502ed73d79c0 Mon Sep 17 00:00:00 2001
From: Yu Watanabe <watanabe.yu+github@gmail.com>
Date: Tue, 14 Feb 2023 04:27:52 +0900
Subject: [PATCH] time-util: shorten code a bit
@ -7,7 +7,7 @@ No functional change, just refactoring.
(cherry picked from commit 1d2c42c5dc765c57b4fba6b7c629093aa20685a8)
Related: RHEL-110954
Related: RHEL-109488
---
src/basic/time-util.c | 25 +++++++++----------------
1 file changed, 9 insertions(+), 16 deletions(-)

View File

@ -1,4 +1,4 @@
From 8fb4c5d8a9df069effe63c66be9a7bfb8fe7e3e6 Mon Sep 17 00:00:00 2001
From 5bfcf206bd16079ae8030a2c912ee8377a3f6d5f Mon Sep 17 00:00:00 2001
From: Yu Watanabe <watanabe.yu+github@gmail.com>
Date: Wed, 15 Feb 2023 13:46:50 +0900
Subject: [PATCH] time-util: rename variables
@ -7,7 +7,7 @@ No functional changes, just refactoring.
(cherry picked from commit a83c1baaeb510f1916d2d8cf0324d100708c7073)
Related: RHEL-110954
Related: RHEL-109488
---
src/basic/time-util.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)

View File

@ -1,4 +1,4 @@
From 270d5ab1358d916483f2da0a7b060c433ed35ecc Mon Sep 17 00:00:00 2001
From a1a7ab09cf96e30cfd0c89efaf8d03a5dc81e928 Mon Sep 17 00:00:00 2001
From: Yu Watanabe <watanabe.yu+github@gmail.com>
Date: Wed, 15 Feb 2023 13:51:15 +0900
Subject: [PATCH] time-util: drop unnecessary assignment of timezone name
@ -7,7 +7,7 @@ As mktime() does not use timezone neme.
(cherry picked from commit 97c5f7ba1f50fcd7b982b995b46692c8cad4afaa)
Related: RHEL-110954
Related: RHEL-109488
---
src/basic/time-util.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)

View File

@ -1,4 +1,4 @@
From cba84e37fc5b4968b3058e6af6a1ff64f1cc95b3 Mon Sep 17 00:00:00 2001
From e4b1932cd1c0ad2d42a6271cb651e6979b5962ed Mon Sep 17 00:00:00 2001
From: Yu Watanabe <watanabe.yu+github@gmail.com>
Date: Tue, 14 Feb 2023 03:39:15 +0900
Subject: [PATCH] time-util: make parse_timestamp() use the RFC-822/ISO 8601
@ -22,7 +22,7 @@ Fixes #26370.
(cherry picked from commit 7a9afae6040af0417d893328cb44b622dcdcb94f)
Related: RHEL-110954
Related: RHEL-109488
---
src/basic/time-util.c | 174 +++++++++++++++++++++++++++---------------
1 file changed, 112 insertions(+), 62 deletions(-)

View File

@ -1,4 +1,4 @@
From 17fc013d01a1c04de0841bd0b61644d70ba9e07a Mon Sep 17 00:00:00 2001
From 008aed2736dac288700f1c177690904da9c5137d Mon Sep 17 00:00:00 2001
From: Yu Watanabe <watanabe.yu+github@gmail.com>
Date: Fri, 3 Mar 2023 15:24:23 +0900
Subject: [PATCH] time-util: fix typo
@ -7,7 +7,7 @@ Follow-up for 7a9afae6040af0417d893328cb44b622dcdcb94f.
(cherry picked from commit ca9c9d8d8e999fd80fc43d002c8d5b20c4c1a0a4)
Related: RHEL-110954
Related: RHEL-109488
---
src/basic/time-util.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

View File

@ -1,4 +1,4 @@
From e6a8da48184d8054ab49f65decaaf339a2a608db Mon Sep 17 00:00:00 2001
From 5e10617a3a450a2bb6fbe031d1861559192bc85c Mon Sep 17 00:00:00 2001
From: Frantisek Sumsal <fsumsal@redhat.com>
Date: Thu, 4 Sep 2025 15:31:27 +0200
Subject: [PATCH] ci: bump the tools tree to F42
@ -16,7 +16,7 @@ EFI stub: Loaded initrd from LINUX_EFI_INITRD_MEDIA_GUID device path
EFI stub: Measured initrd data into PCR 9
rhel-only: ci
Related: RHEL-110954
Related: RHEL-109488
---
.github/workflows/mkosi.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

View File

@ -0,0 +1,27 @@
From 8cec69eb3fe332ac618c34780dd5275d931d9bf8 Mon Sep 17 00:00:00 2001
From: Yu Watanabe <watanabe.yu+github@gmail.com>
Date: Sun, 1 Dec 2024 14:46:40 +0900
Subject: [PATCH] journald: extend STDOUT_STREAMS_MAX to 64k
Closes #35390.
(cherry picked from commit c576ba7182f54f352c03f0768c9178b173fb8bcb)
Resolves: RHEL-111065
---
src/journal/journald-stream.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/journal/journald-stream.c b/src/journal/journald-stream.c
index 8bdcd8c2ae..3ec6e7fcf3 100644
--- a/src/journal/journald-stream.c
+++ b/src/journal/journald-stream.c
@@ -38,7 +38,7 @@
#include "unit-name.h"
#include "user-util.h"
-#define STDOUT_STREAMS_MAX 4096
+#define STDOUT_STREAMS_MAX (64*1024)
/* During the "setup" protocol phase of the stream logic let's define a different maximum line length than
* during the actual operational phase. We want to allow users to specify very short line lengths after all,

View File

@ -0,0 +1,163 @@
From fa27bab14e2ede08dcac41ab78901ab3b653e556 Mon Sep 17 00:00:00 2001
From: Jan Macku <jamacku@redhat.com>
Date: Tue, 26 Aug 2025 15:30:49 +0200
Subject: [PATCH] Revert "Revert "udev-builtin-net_id: use firmware_node/sun
for ID_NET_NAME_SLOT""
This reverts commit ae92c09f0ddfea2ff6042e152eec9af86013da38.
Also introduce rhel-9.8 naming scheme.
rhel-only: policy
Resolves: RHEL-50103
---
man/systemd.net-naming-scheme.xml | 9 ++++-
src/shared/netif-naming-scheme.c | 1 +
src/shared/netif-naming-scheme.h | 2 +
src/udev/udev-builtin-net_id.c | 66 +++++++++++++++++++++++++++----
4 files changed, 70 insertions(+), 8 deletions(-)
diff --git a/man/systemd.net-naming-scheme.xml b/man/systemd.net-naming-scheme.xml
index 34e8e46459..c6ee7b4b6e 100644
--- a/man/systemd.net-naming-scheme.xml
+++ b/man/systemd.net-naming-scheme.xml
@@ -526,6 +526,13 @@
<listitem><para>Same as naming scheme <constant>rhel-9.5</constant>.</para></listitem>
</varlistentry>
+ <varlistentry>
+ <term><constant>rhel-9.8</constant></term>
+
+ <listitem>
+ <para>PCI slot number is now read from <constant>firmware_node/sun</constant> sysfs file.</para></listitem>
+ </varlistentry>
+
</variablelist>
<para>By default <constant>rhel-9.0</constant> is used.</para>
@@ -679,7 +686,7 @@ ID_NET_NAME_ONBOARD_LABEL=Ethernet Port 1
</example>
<example>
- <title>PCI Ethernet card in hotplug slot with firmware index number</title>
+ <title>PCI Ethernet card in slot with firmware index number</title>
<programlisting># /sys/devices/pci0000:00/0000:00:1c.3/0000:05:00.0/net/ens1
ID_NET_NAME_MAC=enx000000000466
diff --git a/src/shared/netif-naming-scheme.c b/src/shared/netif-naming-scheme.c
index a38c3f1e2f..4ed866491e 100644
--- a/src/shared/netif-naming-scheme.c
+++ b/src/shared/netif-naming-scheme.c
@@ -47,6 +47,7 @@ static const NamingScheme naming_schemes[] = {
{ "rhel-9.5", NAMING_RHEL_9_5 },
{ "rhel-9.6", NAMING_RHEL_9_6 },
{ "rhel-9.7", NAMING_RHEL_9_7 },
+ { "rhel-9.8", NAMING_RHEL_9_8 },
/* … add more schemes here, as the logic to name devices is updated … */
EXTRA_NET_NAMING_MAP
diff --git a/src/shared/netif-naming-scheme.h b/src/shared/netif-naming-scheme.h
index 3cba656707..c16476522a 100644
--- a/src/shared/netif-naming-scheme.h
+++ b/src/shared/netif-naming-scheme.h
@@ -42,6 +42,7 @@ typedef enum NamingSchemeFlags {
* This is disabled since rhel-9.5, as it seems not to work at least for some setups. See upstream issue #28929. */
NAMING_DEVICETREE_ALIASES = 1 << 15, /* Generate names from devicetree aliases */
NAMING_SR_IOV_R = 1 << 17, /* Use "r" suffix for SR-IOV VF representors */
+ NAMING_FIRMWARE_NODE_SUN = 1 << 18, /* Use firmware_node/sun to get PCI slot number */
/* And now the masks that combine the features above */
NAMING_V238 = 0,
@@ -76,6 +77,7 @@ typedef enum NamingSchemeFlags {
NAMING_RHEL_9_5 = NAMING_RHEL_9_4 & ~NAMING_BRIDGE_MULTIFUNCTION_SLOT,
NAMING_RHEL_9_6 = NAMING_RHEL_9_5,
NAMING_RHEL_9_7 = NAMING_RHEL_9_5,
+ NAMING_RHEL_9_8 = NAMING_RHEL_9_5 | NAMING_FIRMWARE_NODE_SUN,
EXTRA_NET_NAMING_SCHEMES
diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c
index 16c9971876..291fb4ba36 100644
--- a/src/udev/udev-builtin-net_id.c
+++ b/src/udev/udev-builtin-net_id.c
@@ -442,6 +442,51 @@ static int pci_get_hotplug_slot(sd_device *dev, uint32_t *ret) {
return -ENOENT;
}
+static int get_device_firmware_node_sun(sd_device *dev, uint32_t *ret) {
+ const char *attr;
+ int r;
+
+ assert(dev);
+ assert(ret);
+
+ r = device_get_sysattr_value_filtered(dev, "firmware_node/sun", &attr);
+ if (r < 0)
+ return log_device_debug_errno(dev, r, "Failed to read firmware_node/sun, ignoring: %m");
+
+ r = safe_atou32(attr, ret);
+ if (r < 0)
+ return log_device_warning_errno(dev, r, "Failed to parse firmware_node/sun '%s', ignoring: %m", attr);
+
+ return 0;
+}
+
+static int pci_get_slot_from_firmware_node_sun(sd_device *dev, uint32_t *ret) {
+ int r;
+ sd_device *slot_dev;
+
+ assert(dev);
+ assert(ret);
+
+ /* Try getting the ACPI _SUN for the device */
+ if (get_device_firmware_node_sun(dev, ret) >= 0)
+ return 0;
+
+ r = sd_device_get_parent_with_subsystem_devtype(dev, "pci", NULL, &slot_dev);
+ if (r < 0)
+ return log_device_debug_errno(dev, r, "Failed to find pci parent, ignoring: %m");
+
+ if (is_pci_bridge(slot_dev) && is_pci_multifunction(dev) <= 0)
+ return log_device_debug_errno(dev, SYNTHETIC_ERRNO(ESTALE),
+ "Not using slot information because the parent pcieport "
+ "is a bridge and the PCI device is not multifunction.");
+
+ /* Try getting the ACPI _SUN from the parent pcieport */
+ if (get_device_firmware_node_sun(slot_dev, ret) >= 0)
+ return 0;
+
+ return -ENOENT;
+}
+
static int dev_pci_slot(sd_device *dev, const LinkInfo *info, NetNames *names) {
const char *sysname, *attr;
unsigned domain, bus, slot, func;
@@ -517,13 +562,20 @@ static int dev_pci_slot(sd_device *dev, const LinkInfo *info, NetNames *names) {
domain, bus, slot, func, strempty(info->phys_port_name), dev_port,
special_glyph(SPECIAL_GLYPH_ARROW_RIGHT), empty_to_na(names->pci_path));
- r = pci_get_hotplug_slot(names->pcidev, &hotplug_slot);
- if (r < 0)
- return r;
- if (r > 0)
- /* If the hotplug slot is found through the function ID, then drop the domain from the name.
- * See comments in parse_hotplug_slot_from_function_id(). */
- domain = 0;
+ if (naming_scheme_has(NAMING_FIRMWARE_NODE_SUN))
+ r = pci_get_slot_from_firmware_node_sun(names->pcidev, &hotplug_slot);
+ else
+ r = -1;
+ /* If we don't find a slot using firmware_node/sun, fallback to hotplug_slot */
+ if (r < 0) {
+ r = pci_get_hotplug_slot(names->pcidev, &hotplug_slot);
+ if (r < 0)
+ return r;
+ if (r > 0)
+ /* If the hotplug slot is found through the function ID, then drop the domain from the name.
+ * See comments in parse_hotplug_slot_from_function_id(). */
+ domain = 0;
+ }
s = names->pci_slot;
l = sizeof(names->pci_slot);

View File

@ -0,0 +1,43 @@
From 743c0fbd5ea56f926b36d6bbfc2d609bacd4353e Mon Sep 17 00:00:00 2001
From: Etienne Champetier <e.champetier@ateme.com>
Date: Thu, 22 Aug 2024 16:30:56 -0400
Subject: [PATCH] udev-builtin-net_id: ignore firmware_node/sun == 0
Since ID_NET_NAME_SLOT was introduced we ignore slot == 0
https://github.com/systemd/systemd/blob/0035597a30d120f70df2dd7da3d6128fb8ba6051/src/udev/udev-builtin-net_id.c#L139
Qemu sets _SUN to PCI_SLOT() for all NICs, so _SUN is not unique.
https://gitlab.com/qemu-project/qemu/-/issues/2530
In my tests with libvirt I can only set 'slot="0x00"' in interface definition,
so all NICs end up with _SUN == 0, and this commit is enough to avoid the issue.
Fixes 0a4ecc54cb9f2d3418b970c51bfadb69c34ae9eb
(cherry picked from commit 448f9f81fd32f8658449101ada2eadd853f6b06b)
Resolves: RHEL-50103
---
src/udev/udev-builtin-net_id.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c
index 291fb4ba36..e1895a38c0 100644
--- a/src/udev/udev-builtin-net_id.c
+++ b/src/udev/udev-builtin-net_id.c
@@ -453,10 +453,14 @@ static int get_device_firmware_node_sun(sd_device *dev, uint32_t *ret) {
if (r < 0)
return log_device_debug_errno(dev, r, "Failed to read firmware_node/sun, ignoring: %m");
- r = safe_atou32(attr, ret);
+ uint32_t sun;
+ r = safe_atou32(attr, &sun);
if (r < 0)
return log_device_warning_errno(dev, r, "Failed to parse firmware_node/sun '%s', ignoring: %m", attr);
+ if (sun == 0)
+ return log_device_debug_errno(dev, SYNTHETIC_ERRNO(EINVAL), "firmware_node/sun == 0, ignoring: %m");
+ *ret = sun;
return 0;
}

View File

@ -0,0 +1,36 @@
From c14ed0d0bf700b9959359004d5eef50d4d2db951 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Tue, 10 Jan 2023 14:08:41 +0100
Subject: [PATCH] fundamental: fix compile check for explicit_bzero
Our HAVE_* variables are defined to 0 or 1, so '#if defined(HAVE_*)' is always true.
The variable is not defined when compiling for EFI though, so we need the
additional guard.
Fixup for 3f92dc2fd4070b213e6bc85263a9bef06ec9a486.
(I don't want to do something like add -DHAVE_EXPLICIT_BZERO=0 to the commandline
in src/efi/boot/meson.build, because this quite verbose. Our compilation commandlines
are very long already. Let's instead keep this localized in this one spot in the
source file.)x
(cherry picked from commit 5deb391c6e6d2b8fd7b94234efea49cd6bee0d76)
Resolves: RHEL-108568
---
src/fundamental/memory-util-fundamental.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/fundamental/memory-util-fundamental.h b/src/fundamental/memory-util-fundamental.h
index 8f50d8b8e1..e0ae33dc0d 100644
--- a/src/fundamental/memory-util-fundamental.h
+++ b/src/fundamental/memory-util-fundamental.h
@@ -11,7 +11,7 @@
#include "macro-fundamental.h"
-#if defined(HAVE_EXPLICIT_BZERO)
+#if !defined(SD_BOOT) && HAVE_EXPLICIT_BZERO
static inline void *explicit_bzero_safe(void *p, size_t l) {
if (p && l > 0)
explicit_bzero(p, l);

View File

@ -1,4 +1,4 @@
From a8ef307f05961e142b99cbbdda8855a24a44d4a1 Mon Sep 17 00:00:00 2001
From 9906687d228f71768ddf115799ebb39272d1f655 Mon Sep 17 00:00:00 2001
From: Yu Watanabe <watanabe.yu+github@gmail.com>
Date: Sun, 12 Mar 2023 20:57:16 +0900
Subject: [PATCH] time-util: make USEC_TIMESTAMP_FORMATTABLE_MAX for 32bit
@ -10,7 +10,7 @@ This also makes both upper bounds always defined for testing.
(cherry picked from commit bd5770da76ee157d3b31323ed2d22f5d9082bb36)
Related: RHEL-118294
Related: RHEL-109488
---
src/basic/time-util.h | 14 +++++++++-----
src/test/test-date.c | 4 ++--

View File

@ -1,4 +1,4 @@
From 1e97dc426766eef1590d9054952aa0d7d5882b79 Mon Sep 17 00:00:00 2001
From 0abac4254115db7d86549b517163a13de9377346 Mon Sep 17 00:00:00 2001
From: Frantisek Sumsal <frantisek@sumsal.cz>
Date: Tue, 23 Sep 2025 14:28:33 +0200
Subject: [PATCH] test: rename TEST-53-ISSUE-16347 to TEST-53-TIMER
@ -7,7 +7,7 @@ And split the existing test into a separate subtest.
(cherry picked from commit 953c347fb6f293acbd6da009646bfc071b68ddd7)
Related: RHEL-127022
Related: RHEL-118215
---
.../Makefile | 0
.../test.sh | 0

View File

@ -1,4 +1,4 @@
From 9fbd356a6453822d0472d8f1488adfc902a8d241 Mon Sep 17 00:00:00 2001
From 53b158318d6bfbb1e59b91bfad15e7d128622efb Mon Sep 17 00:00:00 2001
From: Frantisek Sumsal <frantisek@sumsal.cz>
Date: Tue, 23 Sep 2025 17:42:01 +0200
Subject: [PATCH] test: restarting elapsed timer shouldn't trigger the
@ -10,7 +10,7 @@ Provides coverage for:
(cherry picked from commit 5730a400fd5ee82566fe03eb832121a0d4bc26b6)
Related: RHEL-127022
Related: RHEL-118215
---
test/units/testsuite-53.restart-trigger.sh | 77 ++++++++++++++++++++++
1 file changed, 77 insertions(+)

View File

@ -1,4 +1,4 @@
From c282dc4e58279b4db6f735228e210a6e46ec5638 Mon Sep 17 00:00:00 2001
From 14aa00df0638e8011dd7360eb58d3b0ac64a818a Mon Sep 17 00:00:00 2001
From: Frantisek Sumsal <frantisek@sumsal.cz>
Date: Tue, 23 Sep 2025 21:04:12 +0200
Subject: [PATCH] test: check the next elapse timer timestamp after
@ -15,7 +15,7 @@ Provides coverage for:
(cherry picked from commit f4c3c107d9be4e922a080fc292ed3889c4e0f4a5)
Related: RHEL-127022
Related: RHEL-118215
---
.../testsuite-53.RandomizedDelaySec-reload.sh | 97 +++++++++++++++++++
test/units/util.sh | 18 ++++

View File

@ -1,4 +1,4 @@
From 7dc588429e48ba6017fd75f6a266288768230025 Mon Sep 17 00:00:00 2001
From a5e7446ae2442558f9c13d814e778f13a7018e23 Mon Sep 17 00:00:00 2001
From: Lukas Nykryn <lnykryn@redhat.com>
Date: Tue, 9 Sep 2025 15:24:22 +0200
Subject: [PATCH] timer: don't run service immediately after restart of a timer
@ -9,7 +9,7 @@ This prevents the timer from triggering immediately.
Fixes: #31231
(cherry picked from commit 3fc44a0f68412b649e16f12ff2f97a36c615457d)
Resolves: RHEL-127022
Resolves: RHEL-118215
---
src/core/timer.c | 2 --
1 file changed, 2 deletions(-)

View File

@ -1,4 +1,4 @@
From 5f0eda80175f04929c34cdb46cd85e3f4d64b6d1 Mon Sep 17 00:00:00 2001
From c603c6cb569f0900ddf07f0311ffa038a242fac8 Mon Sep 17 00:00:00 2001
From: Frantisek Sumsal <frantisek@sumsal.cz>
Date: Mon, 29 Sep 2025 16:11:27 +0200
Subject: [PATCH] test: store and compare just the property value
@ -7,7 +7,7 @@ Follow-up for 5730a400fd5ee82566fe03eb832121a0d4bc26b6.
(cherry picked from commit 0cb252d50f35256bff569fa6213784f2d45ad6a1)
Related: RHEL-127022
Related: RHEL-118215
---
test/units/testsuite-53.restart-trigger.sh | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

View File

@ -0,0 +1,94 @@
From d4299294d40b7fe713d0c9df0f7a42c70654e886 Mon Sep 17 00:00:00 2001
From: Frantisek Sumsal <frantisek@sumsal.cz>
Date: Fri, 5 Apr 2024 12:18:58 +0200
Subject: [PATCH] test: make test-fd-util more lenient when using
fd_move_above_stdio()
On s390x this test fails when the SUT uses the z90crypt kernel module,
as it's an another FD the test doesn't account for:
/* test_rearrange_stdio */
Successfully forked off 'rearrange' as PID 57293.
test_rearrange_stdio: r=0
/proc/57293/fd:
total 0
lrwx------. 1 root root 64 Apr 5 06:18 0 -> /dev/pts/0
lrwx------. 1 root root 64 Apr 5 06:18 1 -> /dev/pts/0
lrwx------. 1 root root 64 Apr 5 06:18 2 -> /dev/pts/0
lrwx------. 1 root root 64 Apr 5 06:18 3 -> /dev/z90crypt
rearrange terminated by signal ABRT.
Debugging this was pain, since the child process didn't log anything
once we closed stdout/stderr (for obvious reasons). Let's fix both
issues by switching logging to kmsg once we close stdin/stdout/stderr,
and also by making the test work fine when there are some extra FDs in
the child's environment.
(cherry picked from commit a9805f8ca9c1561e373355fe7175579b31e1c08c)
Related: RHEL-114974
---
src/test/test-fd-util.c | 22 +++++++++++++---------
1 file changed, 13 insertions(+), 9 deletions(-)
diff --git a/src/test/test-fd-util.c b/src/test/test-fd-util.c
index 5b5a712469..5d6c5325a5 100644
--- a/src/test/test-fd-util.c
+++ b/src/test/test-fd-util.c
@@ -127,6 +127,7 @@ TEST(rearrange_stdio) {
if (r == 0) {
_cleanup_free_ char *path = NULL;
+ int pipe_read_fd, pair[2];
char buffer[10];
/* Child */
@@ -134,6 +135,10 @@ TEST(rearrange_stdio) {
safe_close(STDERR_FILENO); /* Let's close an fd < 2, to make it more interesting */
assert_se(rearrange_stdio(-1, -1, -1) >= 0);
+ /* Reconfigure logging after rearranging stdout/stderr, so we still log to somewhere if the
+ * following tests fail, making it slightly less annoying to debug */
+ log_set_target(LOG_TARGET_KMSG);
+ log_open();
assert_se(fd_get_path(STDIN_FILENO, &path) >= 0);
assert_se(path_equal(path, "/dev/null"));
@@ -151,13 +156,12 @@ TEST(rearrange_stdio) {
safe_close(STDOUT_FILENO);
safe_close(STDERR_FILENO);
- {
- int pair[2];
- assert_se(pipe(pair) >= 0);
- assert_se(pair[0] == 0);
- assert_se(pair[1] == 1);
- assert_se(fd_move_above_stdio(0) == 3);
- }
+ assert_se(pipe(pair) >= 0);
+ assert_se(pair[0] == 0);
+ assert_se(pair[1] == 1);
+ pipe_read_fd = fd_move_above_stdio(0);
+ assert_se(pipe_read_fd >= 3);
+
assert_se(open("/dev/full", O_WRONLY|O_CLOEXEC) == 0);
assert_se(acquire_data_fd("foobar", 6, 0) == 2);
@@ -165,7 +169,7 @@ TEST(rearrange_stdio) {
assert_se(write(1, "x", 1) < 0 && errno == ENOSPC);
assert_se(write(2, "z", 1) == 1);
- assert_se(read(3, buffer, sizeof(buffer)) == 1);
+ assert_se(read(pipe_read_fd, buffer, sizeof(buffer)) == 1);
assert_se(buffer[0] == 'z');
assert_se(read(0, buffer, sizeof(buffer)) == 6);
assert_se(memcmp(buffer, "foobar", 6) == 0);
@@ -173,7 +177,7 @@ TEST(rearrange_stdio) {
assert_se(rearrange_stdio(-1, 1, 2) >= 0);
assert_se(write(1, "a", 1) < 0 && errno == ENOSPC);
assert_se(write(2, "y", 1) == 1);
- assert_se(read(3, buffer, sizeof(buffer)) == 1);
+ assert_se(read(pipe_read_fd, buffer, sizeof(buffer)) == 1);
assert_se(buffer[0] == 'y');
assert_se(fd_get_path(0, &path) >= 0);

View File

@ -1,4 +1,4 @@
From 4d9bb355df2ba60d734a73a62bf489abbb8ec54c Mon Sep 17 00:00:00 2001
From 2c74cdb28bad7e8122bfd51a6d4897f792ef3e2f Mon Sep 17 00:00:00 2001
From: cpackham-atlnz <85916201+cpackham-atlnz@users.noreply.github.com>
Date: Tue, 12 Mar 2024 00:55:36 +1300
Subject: [PATCH] basic: add PIDFS magic (#31709)
@ -15,7 +15,7 @@ Filesystem found in kernel header but not in filesystems-gperf.gperf: PID_FS_MAG
(cherry picked from commit ed01b92e1c92871bbd92711f280e2b2d15753f0e)
Resolves: RHEL-118294
Resolves: RHEL-114974
---
src/basic/filesystems-gperf.gperf | 1 +
src/basic/missing_magic.h | 5 +++++

View File

@ -0,0 +1,27 @@
From 5844efbf70321f5dd902f987947786d1ab4409c6 Mon Sep 17 00:00:00 2001
From: Frantisek Sumsal <frantisek@sumsal.cz>
Date: Wed, 8 Oct 2025 17:23:31 +0200
Subject: [PATCH] man: fix a missing word
Follow-up for 6d48c7cf736ced70c1c2fef1e1f03618911d04bc.
(cherry picked from commit 67111e1bd918f9e1b4b542d1e0fe84f1d571876e)
Resolves: RHEL-115182
---
man/systemd.resource-control.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/man/systemd.resource-control.xml b/man/systemd.resource-control.xml
index 2a0e40a17d..9431fb20a1 100644
--- a/man/systemd.resource-control.xml
+++ b/man/systemd.resource-control.xml
@@ -365,7 +365,7 @@
an absolute number of tasks or a percentage value that is taken relative to the configured maximum
number of tasks on the system. If assigned the special value <literal>infinity</literal>, no tasks
limit is applied. This controls the <literal>pids.max</literal> control group attribute. For
- details about this control group attribute, the
+ details about this control group attribute, see the
<ulink url="https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v2.html#pid">pids controller
</ulink>.</para>

View File

@ -1,4 +1,4 @@
From a8c056f2847f080e8ceb5d43fe0d36b5c5ee8655 Mon Sep 17 00:00:00 2001
From 26d6ea70cfb9232dc9ab66ee0927fb546fe0418b Mon Sep 17 00:00:00 2001
From: Ondrej Kozina <okozina@redhat.com>
Date: Wed, 31 Jan 2024 13:11:21 +0100
Subject: [PATCH] cryptsetup: Add optional support for linking volume key in
@ -15,7 +15,7 @@ in case of kernel crash.
(cherry picked from commit c5daf14c88ba44cefabe052de93a29d28b6b0175)
Resolves: RHEL-118294
Resolves: RHEL-97175
---
man/crypttab.xml | 21 ++++++++++++
meson.build | 3 +-

View File

@ -1,4 +1,4 @@
From 9807259b544cbf4f7a0a05bd426b95c788a89bd4 Mon Sep 17 00:00:00 2001
From 44f65e9b9a0f67a69886d25367875e9707affc81 Mon Sep 17 00:00:00 2001
From: Yu Watanabe <watanabe.yu+github@gmail.com>
Date: Wed, 14 Feb 2024 04:01:36 +0900
Subject: [PATCH] cryptsetup: fix typo
@ -7,7 +7,7 @@ Follow-up for c5daf14c88ba44cefabe052de93a29d28b6b0175.
(cherry picked from commit a14d3b48f7647676a0c43bceaecd56d9a77e3de6)
Resolves: RHEL-118294
Resolves: RHEL-97175
---
src/cryptsetup/cryptsetup.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

View File

@ -1,4 +1,4 @@
From 4920d1ca6823abe29e8cf2eceea497d9b677ee95 Mon Sep 17 00:00:00 2001
From be6acfdfd0ddd5625d68bdeb1fb5962d710557be Mon Sep 17 00:00:00 2001
From: Yu Watanabe <watanabe.yu+github@gmail.com>
Date: Sun, 17 Aug 2025 21:05:24 +0900
Subject: [PATCH] cryptsetup: HAVE_CRYPT_SET_KEYRING_TO_LINK is always defined
@ -7,7 +7,7 @@ Follow-up for c5daf14c88ba44cefabe052de93a29d28b6b0175 (v256).
(cherry picked from commit fb4aabf4432d523b97376099ce4353b5c268ae82)
Resolves: RHEL-118294
Resolves: RHEL-97175
---
src/cryptsetup/cryptsetup.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

View File

@ -1,4 +1,4 @@
From a257453e7febc1c984b180e14095c2e6092dc850 Mon Sep 17 00:00:00 2001
From 9109aaae160fe7dcb9390829db619e4e8f90274f Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Thu, 31 Oct 2024 17:02:59 +0100
Subject: [PATCH] coredump: make check that all argv[] meta data fields are

View File

@ -1,4 +1,4 @@
From de05f30a12a0f1ce03dc21a29a606c70e42d1de4 Mon Sep 17 00:00:00 2001
From 38d7a52bcdad1cef1dba218f86e3905c24d51d9a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Tue, 29 Apr 2025 14:47:59 +0200
Subject: [PATCH] coredump: restore compatibility with older patterns

View File

@ -1,4 +1,4 @@
From 58550ccfee8cdf87e623aa70318a45a5e7c19901 Mon Sep 17 00:00:00 2001
From fbc5015c95298c71c806b5e80207e52688aad69a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Tue, 29 Apr 2025 14:47:59 +0200
Subject: [PATCH] coredump: use %d in kernel core pattern

View File

@ -1,4 +1,4 @@
From c762a9a8764f8c6ce6640579ae8cf04f80360d16 Mon Sep 17 00:00:00 2001
From e638eb667af0e8ac9d3d409edbbf51507a4eef0e Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Sat, 9 Sep 2023 09:29:27 +0200
Subject: [PATCH] pidref: add structure that can reference a pid via both pidfd

View File

@ -1,4 +1,4 @@
From 9cf24f219925df6e449eb0838af6e309d84cbb0c Mon Sep 17 00:00:00 2001
From 8219e46540ddf0d6a7d3f97481debf297723a58f Mon Sep 17 00:00:00 2001
From: David Tardon <dtardon@redhat.com>
Date: Fri, 5 May 2023 08:09:14 +0200
Subject: [PATCH] fd-util: introduce parse_fd()

View File

@ -1,4 +1,4 @@
From bbd5aec472b90aa55e184f58691085142b7e3aaa Mon Sep 17 00:00:00 2001
From 27faf1af778849841d7c3140bd3d92aceaea2ee3 Mon Sep 17 00:00:00 2001
From: Luca Boccassi <luca.boccassi@gmail.com>
Date: Sun, 13 Apr 2025 22:10:36 +0100
Subject: [PATCH] coredump: add support for new %F PIDFD specifier

View File

@ -1,4 +1,4 @@
From e71140d217b3a2a75a52b488da39568d6ea942bd Mon Sep 17 00:00:00 2001
From 69c124810e3b4bc4b7aa441cfed65d3d7594d443 Mon Sep 17 00:00:00 2001
From: Frantisek Sumsal <frantisek@sumsal.cz>
Date: Mon, 13 Oct 2025 17:36:55 +0200
Subject: [PATCH] timer: rebase the next elapse timestamp only if timer didn't
@ -75,7 +75,7 @@ already run should prevent this from happening during daemon-reload.
(cherry picked from commit bdb8e584f4509de0daebbe2357d23156160c3a90)
Related: RHEL-127022
Related: RHEL-118215
---
src/core/timer.c | 25 +++++++++++++++----------
1 file changed, 15 insertions(+), 10 deletions(-)

View File

@ -0,0 +1,85 @@
From e16ede11dab405749b776aa6d58a9c7461a0dda5 Mon Sep 17 00:00:00 2001
From: Yu Watanabe <watanabe.yu+github@gmail.com>
Date: Tue, 28 Jan 2025 08:50:14 +0900
Subject: [PATCH] strv: introduce string_strv_hashmap_remove()
(cherry picked from commit c540875cd3b024f64980966376637ecc284d643c)
Related: RHEL-14112
---
src/basic/strv.c | 17 +++++++++++++++++
src/basic/strv.h | 5 +++++
src/test/test-hashmap-plain.c | 16 ++++++++++++++++
3 files changed, 38 insertions(+)
diff --git a/src/basic/strv.c b/src/basic/strv.c
index 66b70befd6..1f5d6f058f 100644
--- a/src/basic/strv.c
+++ b/src/basic/strv.c
@@ -920,6 +920,23 @@ int fputstrv(FILE *f, char * const *l, const char *separator, bool *space) {
return 0;
}
+void string_strv_hashmap_remove(Hashmap *h, const char *key, const char *value) {
+ assert(key);
+
+ if (value) {
+ char **l = hashmap_get(h, key);
+ if (!l)
+ return;
+
+ strv_remove(l, value);
+ if (!strv_isempty(l))
+ return;
+ }
+
+ _unused_ _cleanup_free_ char *key_free = NULL;
+ strv_free(hashmap_remove2(h, key, (void**) &key_free));
+}
+
static int string_strv_hashmap_put_internal(Hashmap *h, const char *key, const char *value) {
char **l;
int r;
diff --git a/src/basic/strv.h b/src/basic/strv.h
index 6c9fa47943..9eb685fb86 100644
--- a/src/basic/strv.h
+++ b/src/basic/strv.h
@@ -261,6 +261,11 @@ int fputstrv(FILE *f, char * const *l, const char *separator, bool *space);
free_and_replace_full(a, b, strv_free)
extern const struct hash_ops string_strv_hash_ops;
+
+void string_strv_hashmap_remove(Hashmap *h, const char *key, const char *value);
+static inline void string_strv_ordered_hashmap_remove(OrderedHashmap *h, const char *key, const char *value) {
+ string_strv_hashmap_remove(PLAIN_HASHMAP(h), key, value);
+}
int _string_strv_hashmap_put(Hashmap **h, const char *key, const char *value HASHMAP_DEBUG_PARAMS);
int _string_strv_ordered_hashmap_put(OrderedHashmap **h, const char *key, const char *value HASHMAP_DEBUG_PARAMS);
#define string_strv_hashmap_put(h, k, v) _string_strv_hashmap_put(h, k, v HASHMAP_DEBUG_SRC_ARGS)
diff --git a/src/test/test-hashmap-plain.c b/src/test/test-hashmap-plain.c
index 36a775012b..3bc96fc944 100644
--- a/src/test/test-hashmap-plain.c
+++ b/src/test/test-hashmap-plain.c
@@ -996,6 +996,22 @@ TEST(string_strv_hashmap) {
s = hashmap_get(m, "xxx");
assert_se(strv_equal(s, STRV_MAKE("bar", "BAR")));
+
+ string_strv_hashmap_remove(m, "foo", "bar");
+ ASSERT_NOT_NULL(s = hashmap_get(m, "foo"));
+ ASSERT_TRUE(strv_equal(s, STRV_MAKE("BAR")));
+
+ string_strv_hashmap_remove(m, "foo", "BAR");
+ ASSERT_NULL(hashmap_get(m, "foo"));
+
+ string_strv_hashmap_remove(m, "xxx", "BAR");
+ ASSERT_NOT_NULL(s = hashmap_get(m, "xxx"));
+ ASSERT_TRUE(strv_equal(s, STRV_MAKE("bar")));
+
+ string_strv_hashmap_remove(m, "xxx", "bar");
+ ASSERT_NULL(hashmap_get(m, "xxx"));
+
+ ASSERT_TRUE(hashmap_isempty(m));
}
/* Signal to test-hashmap.c that tests from this compilation unit were run. */

View File

@ -0,0 +1,230 @@
From fe5bad818a26875914f3b0c59fa3d4f5e6b3a41d Mon Sep 17 00:00:00 2001
From: Yu Watanabe <watanabe.yu+github@gmail.com>
Date: Tue, 28 Jan 2025 09:55:12 +0900
Subject: [PATCH] unit-file: introduce unit_file_remove_from_name_map()
(cherry picked from commit d8b34aaef24599917d4e7fa04c78fffac3afe7cf)
Related: RHEL-14112
[msekleta: I've backported strv_equal_ignore_order() in the same commit
in order to get this to compile.]
---
src/basic/strv.c | 20 ++++++++++
src/basic/strv.h | 1 +
src/basic/unit-file.c | 35 +++++++++++++++++
src/basic/unit-file.h | 8 ++++
src/test/test-unit-file.c | 81 +++++++++++++++++++++++++++++++++++++++
5 files changed, 145 insertions(+)
diff --git a/src/basic/strv.c b/src/basic/strv.c
index 1f5d6f058f..47cc6931c1 100644
--- a/src/basic/strv.c
+++ b/src/basic/strv.c
@@ -775,6 +775,26 @@ int strv_compare(char * const *a, char * const *b) {
return 0;
}
+bool strv_equal_ignore_order(char **a, char **b) {
+
+ /* Just like strv_equal(), but doesn't care about the order of elements or about redundant entries
+ * (i.e. it's even ok if the number of entries in the array differ, as long as the difference just
+ * consists of repititions) */
+
+ if (a == b)
+ return true;
+
+ STRV_FOREACH(i, a)
+ if (!strv_contains(b, *i))
+ return false;
+
+ STRV_FOREACH(i, b)
+ if (!strv_contains(a, *i))
+ return false;
+
+ return true;
+}
+
void strv_print(char * const *l) {
STRV_FOREACH(s, l)
puts(*s);
diff --git a/src/basic/strv.h b/src/basic/strv.h
index 9eb685fb86..1de3c98e5c 100644
--- a/src/basic/strv.h
+++ b/src/basic/strv.h
@@ -160,6 +160,7 @@ bool strv_overlap(char * const *a, char * const *b) _pure_;
_STRV_FOREACH_PAIR(x, y, l, UNIQ_T(i, UNIQ))
char** strv_sort(char **l);
+bool strv_equal_ignore_order(char **a, char **b);
void strv_print(char * const *l);
#define strv_from_stdarg_alloca(first) \
diff --git a/src/basic/unit-file.c b/src/basic/unit-file.c
index c81c69db30..d7d7fd70f6 100644
--- a/src/basic/unit-file.c
+++ b/src/basic/unit-file.c
@@ -627,6 +627,41 @@ int unit_file_build_name_map(
return 1;
}
+int unit_file_remove_from_name_map(
+ const LookupPaths *lp,
+ uint64_t *cache_timestamp_hash,
+ Hashmap **unit_ids_map,
+ Hashmap **unit_names_map,
+ Set **path_cache,
+ const char *path) {
+
+ int r;
+
+ assert(path);
+
+ /* This assumes the specified path is already removed, and drops the relevant entries from the maps. */
+
+ /* If one of the lookup paths we are monitoring is already changed, let's rebuild the map. Then, the
+ * new map should not contain entries relevant to the specified path. */
+ r = unit_file_build_name_map(lp, cache_timestamp_hash, unit_ids_map, unit_names_map, path_cache);
+ if (r != 0)
+ return r;
+
+ /* If not, drop the relevant entries. */
+
+ _cleanup_free_ char *name = NULL;
+ r = path_extract_filename(path, &name);
+ if (r < 0)
+ return log_warning_errno(r, "Failed to extract file name from '%s': %m", path);
+
+ _unused_ _cleanup_free_ char *key = NULL;
+ free(hashmap_remove2(*unit_ids_map, name, (void**) &key));
+ string_strv_hashmap_remove(*unit_names_map, name, name);
+ free(set_remove(*path_cache, path));
+
+ return 0;
+}
+
static int add_name(
const char *unit_name,
Set **names,
diff --git a/src/basic/unit-file.h b/src/basic/unit-file.h
index 1c43861f00..78f65dbc8e 100644
--- a/src/basic/unit-file.h
+++ b/src/basic/unit-file.h
@@ -52,6 +52,14 @@ int unit_file_build_name_map(
Hashmap **unit_names_map,
Set **path_cache);
+int unit_file_remove_from_name_map(
+ const LookupPaths *lp,
+ uint64_t *cache_timestamp_hash,
+ Hashmap **unit_ids_map,
+ Hashmap **unit_names_map,
+ Set **path_cache,
+ const char *path);
+
int unit_file_find_fragment(
Hashmap *unit_ids_map,
Hashmap *unit_name_map,
diff --git a/src/test/test-unit-file.c b/src/test/test-unit-file.c
index dffa2822e6..389113c336 100644
--- a/src/test/test-unit-file.c
+++ b/src/test/test-unit-file.c
@@ -1,10 +1,15 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
+#include "fileio.h"
#include "path-lookup.h"
+#include "path-util.h"
+#include "random-util.h"
+#include "rm-rf.h"
#include "set.h"
#include "special.h"
#include "strv.h"
#include "tests.h"
+#include "tmpfile-util.h"
#include "unit-file.h"
TEST(unit_validate_alias_symlink_and_warn) {
@@ -85,6 +90,82 @@ TEST(unit_file_build_name_map) {
}
}
+static bool test_unit_file_remove_from_name_map_trail(const LookupPaths *lp, size_t trial) {
+ int r;
+
+ log_debug("/* %s(trial=%zu) */", __func__, trial);
+
+ _cleanup_hashmap_free_ Hashmap *unit_ids = NULL, *unit_names = NULL;
+ _cleanup_set_free_ Set *path_cache = NULL;
+ assert_se(unit_file_build_name_map(lp, NULL, &unit_ids, &unit_names, &path_cache) > 0);
+
+ _cleanup_free_ char *name = NULL;
+ for (size_t i = 0; i < 100; i++) {
+ ASSERT_OK(asprintf(&name, "test-unit-file-%"PRIx64".service", random_u64()));
+ if (!hashmap_contains(unit_ids, name))
+ break;
+ name = mfree(name);
+ }
+ ASSERT_NOT_NULL(name);
+
+ _cleanup_free_ char *path = path_join(lp->transient, name);
+ ASSERT_NOT_NULL(path);
+ ASSERT_OK(write_string_file(path, "[Unit]\n", WRITE_STRING_FILE_CREATE|WRITE_STRING_FILE_MKDIR_0755));
+
+ uint64_t cache_timestamp_hash = 0;
+ assert_se(unit_file_build_name_map(lp, &cache_timestamp_hash, &unit_ids, &unit_names, &path_cache) > 0);
+
+ ASSERT_STREQ(hashmap_get(unit_ids, name), path);
+ ASSERT_TRUE(strv_equal(hashmap_get(unit_names, name), STRV_MAKE(name)));
+ ASSERT_TRUE(set_contains(path_cache, path));
+
+ assert_se(unlink(path) >= 0);
+
+ ASSERT_OK(r = unit_file_remove_from_name_map(lp, &cache_timestamp_hash, &unit_ids, &unit_names, &path_cache, path));
+ if (r > 0)
+ return false; /* someone touches unit files. Retrying. */
+
+ ASSERT_FALSE(hashmap_contains(unit_ids, name));
+ ASSERT_FALSE(hashmap_contains(unit_names, path));
+ ASSERT_FALSE(set_contains(path_cache, path));
+
+ _cleanup_hashmap_free_ Hashmap *unit_ids_2 = NULL, *unit_names_2 = NULL;
+ _cleanup_set_free_ Set *path_cache_2 = NULL;
+ assert_se(unit_file_build_name_map(lp, NULL, &unit_ids_2, &unit_names_2, &path_cache_2) > 0);
+
+ if (hashmap_size(unit_ids) != hashmap_size(unit_ids_2) ||
+ hashmap_size(unit_names) != hashmap_size(unit_names_2) ||
+ !set_equal(path_cache, path_cache_2))
+ return false;
+
+ const char *k, *v;
+ HASHMAP_FOREACH_KEY(v, k, unit_ids)
+ if (!streq_ptr(hashmap_get(unit_ids_2, k), v))
+ return false;
+
+ char **l;
+ HASHMAP_FOREACH_KEY(l, k, unit_names)
+ if (!strv_equal_ignore_order(hashmap_get(unit_names_2, k), l))
+ return false;
+
+ return true;
+}
+
+
+TEST(unit_file_remove_from_name_map) {
+ _cleanup_(rm_rf_physical_and_freep) char *d = NULL;
+
+ _cleanup_(lookup_paths_free) LookupPaths lp = {};
+ ASSERT_OK(lookup_paths_init(&lp, LOOKUP_SCOPE_SYSTEM, LOOKUP_PATHS_TEMPORARY_GENERATED, NULL));
+ ASSERT_NOT_NULL(d = strdup(lp.temporary_dir));
+
+ for (size_t i = 0; i < 10; i++)
+ if (test_unit_file_remove_from_name_map_trail(&lp, i))
+ return;
+
+ assert_not_reached();
+}
+
TEST(runlevel_to_target) {
in_initrd_force(false);
assert_se(streq_ptr(runlevel_to_target(NULL), NULL));

View File

@ -0,0 +1,52 @@
From 4726233b421628eae405b3b3fb08222cf0befae4 Mon Sep 17 00:00:00 2001
From: Yu Watanabe <watanabe.yu+github@gmail.com>
Date: Tue, 28 Jan 2025 10:09:32 +0900
Subject: [PATCH] core/unit: remove path to transient unit file from unit name
maps on stop
Fixes #35190.
(cherry picked from commit fce94c5c563b8f6ede2b8f7f283d2d2faff4e062)
Resolves: RHEL-14112
---
src/core/unit.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/src/core/unit.c b/src/core/unit.c
index 9e349402ff..afe3fdab04 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -598,13 +598,11 @@ static void unit_clear_dependencies(Unit *u) {
static void unit_remove_transient(Unit *u) {
assert(u);
+ assert(u->manager);
if (!u->transient)
return;
- if (u->fragment_path)
- (void) unlink(u->fragment_path);
-
STRV_FOREACH(i, u->dropin_paths) {
_cleanup_free_ char *p = NULL, *pp = NULL;
@@ -621,6 +619,17 @@ static void unit_remove_transient(Unit *u) {
(void) unlink(*i);
(void) rmdir(p);
}
+
+ if (u->fragment_path) {
+ (void) unlink(u->fragment_path);
+ (void) unit_file_remove_from_name_map(
+ &u->manager->lookup_paths,
+ &u->manager->unit_cache_timestamp_hash,
+ &u->manager->unit_id_map,
+ &u->manager->unit_name_map,
+ &u->manager->unit_path_cache,
+ u->fragment_path);
+ }
}
static void unit_free_requires_mounts_for(Unit *u) {

View File

@ -0,0 +1,33 @@
From 1aa6c0d3bcac98d3442d07412f4296d5b9b18dc0 Mon Sep 17 00:00:00 2001
From: Yu Watanabe <watanabe.yu+github@gmail.com>
Date: Mon, 27 Jan 2025 22:24:16 +0900
Subject: [PATCH] TEST-07-PID1: add reprudcer for issue #35190
(cherry picked from commit 448e99251aa47a5986425a1783da44d1200fe733)
Related: RHEL-14112
---
test/units/testsuite-07.transient.sh | 14 ++++++++++++++
1 file changed, 14 insertions(+)
create mode 100755 test/units/testsuite-07.transient.sh
diff --git a/test/units/testsuite-07.transient.sh b/test/units/testsuite-07.transient.sh
new file mode 100755
index 0000000000..ae71a38143
--- /dev/null
+++ b/test/units/testsuite-07.transient.sh
@@ -0,0 +1,14 @@
+#!/usr/bin/env bash
+# SPDX-License-Identifier: LGPL-2.1-or-later
+set -ex
+set -o pipefail
+
+journalctl --sync
+TS="$(date '+%H:%M:%S')"
+
+systemd-run -u hogehoge.service sleep infinity
+systemctl daemon-reload
+systemctl stop hogehoge.service
+
+journalctl --sync
+[[ -z "$(journalctl -b -q --since "$TS" -u hogehoge.service -p notice)" ]]

View File

@ -1,4 +1,4 @@
From 6ae4c19c78b0daac097b4a7d88566f95daa9e60b Mon Sep 17 00:00:00 2001
From 2fe492a2f0fefa0f782cb04a248fc9dcd5667bf0 Mon Sep 17 00:00:00 2001
From: Michal Sekletar <msekleta@redhat.com>
Date: Fri, 24 Oct 2025 12:55:20 +0200
Subject: [PATCH] coredump: handle ENOBUFS and EMSGSIZE the same way
@ -14,7 +14,7 @@ the message.
(cherry picked from commit 28e62e684b631f928f1d857b04f45f0d34441675)
Resolves: RHEL-126114
Resolves: RHEL-103801
---
src/coredump/coredump.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

View File

@ -0,0 +1,32 @@
From 2a16be65ca89cf18adf63a99ae1b1748e63d6773 Mon Sep 17 00:00:00 2001
From: Li Tian <94442129+litian1992@users.noreply.github.com>
Date: Tue, 19 Aug 2025 05:43:41 +0800
Subject: [PATCH] ukify: rstrip and escape binary null characters from
'inspect' output (#38607)
SBAT section of UKI may contain \u000 null characters. Rstrip them, and if there's anything left in the middle,
escape them so they are displayed as text.
Fixes #38606
(cherry picked from commit 776991a3f349d9c99fd166a0c87fcd2bc1bf92a5)
Signed-off-by: Li Tian <litian@redhat.com>
Resolves: RHEL-109558
---
src/ukify/ukify.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/ukify/ukify.py b/src/ukify/ukify.py
index 08f505a271..2d5050eaca 100755
--- a/src/ukify/ukify.py
+++ b/src/ukify/ukify.py
@@ -986,7 +986,7 @@ def inspect_section(opts, section):
if ttype == 'text':
try:
- struct['text'] = data.decode()
+ struct['text'] = data.rstrip(b'\0').replace(b'\0', b'\\0').decode()
except UnicodeDecodeError as e:
print(f"Section {name!r} is not valid text: {e}")
struct['text'] = '(not valid UTF-8)'

View File

@ -1,4 +1,4 @@
From 6c05a35ce4d03cf25220de5e950970ef23417415 Mon Sep 17 00:00:00 2001
From 6085358791b712a60fb22c7870abf0aa75c5f157 Mon Sep 17 00:00:00 2001
From: Frantisek Sumsal <frantisek@sumsal.cz>
Date: Wed, 19 Nov 2025 14:44:13 +0100
Subject: [PATCH] timer: rebase last_trigger timestamp if needed
@ -21,7 +21,7 @@ Follow-up for bdb8e584f4509de0daebbe2357d23156160c3a90.
(cherry picked from commit 3605b3ba87833a9919bfde05952a7d9de10499a2)
Related: RHEL-127022
Related: RHEL-118215
---
src/core/timer.c | 15 +++--
...tsuite-53.RandomizedDelaySec-persistent.sh | 67 +++++++++++++++++++

View File

@ -0,0 +1,130 @@
From 01826a6ded513adea1dabeccc6b860baee277482 Mon Sep 17 00:00:00 2001
From: David Tardon <dtardon@redhat.com>
Date: Thu, 30 May 2024 10:44:36 +0200
Subject: [PATCH] cryptsetup-generator: refactor add_crypttab_devices()
Move the processing of a crypttab entry to a separate function.
No functional changes, just refactoring.
(cherry picked from commit a07cb7d404582f9c0bfaedb9dd07f93848aa91c6)
Related: RHEL-127859
---
src/cryptsetup/cryptsetup-generator.c | 87 +++++++++++++++------------
1 file changed, 49 insertions(+), 38 deletions(-)
diff --git a/src/cryptsetup/cryptsetup-generator.c b/src/cryptsetup/cryptsetup-generator.c
index 9e8e7e746f..6ab3b85b6b 100644
--- a/src/cryptsetup/cryptsetup-generator.c
+++ b/src/cryptsetup/cryptsetup-generator.c
@@ -779,6 +779,52 @@ static int parse_proc_cmdline_item(const char *key, const char *value, void *dat
return 0;
}
+static int add_crypttab_device(const char *name, const char *device, const char *keyspec, const char *options) {
+ _cleanup_free_ char *keyfile = NULL, *keydev = NULL, *headerdev = NULL, *filtered_header = NULL;
+ crypto_device *d = NULL;
+ char *uuid;
+ int r;
+
+ uuid = startswith(device, "UUID=");
+ if (!uuid)
+ uuid = path_startswith(device, "/dev/disk/by-uuid/");
+ if (!uuid)
+ uuid = startswith(name, "luks-");
+ if (uuid)
+ d = hashmap_get(arg_disks, uuid);
+
+ if (arg_allow_list && !d) {
+ log_info("Not creating device '%s' because it was not specified on the kernel command line.", name);
+ return 0;
+ }
+
+ r = split_locationspec(keyspec, &keyfile, &keydev);
+ if (r < 0)
+ return r;
+
+ if (options && (!d || !d->options)) {
+ r = filter_header_device(options, &headerdev, &filtered_header);
+ if (r < 0)
+ return r;
+ options = filtered_header;
+ }
+
+ r = create_disk(name,
+ device,
+ keyfile,
+ keydev,
+ (d && d->options) ? d->headerdev : headerdev,
+ (d && d->options) ? d->options : options,
+ arg_crypttab);
+ if (r < 0)
+ return r;
+
+ if (d)
+ d->create = false;
+
+ return 0;
+}
+
static int add_crypttab_devices(void) {
_cleanup_fclose_ FILE *f = NULL;
unsigned crypttab_line = 0;
@@ -795,10 +841,8 @@ static int add_crypttab_devices(void) {
}
for (;;) {
- _cleanup_free_ char *line = NULL, *name = NULL, *device = NULL, *keyspec = NULL, *options = NULL,
- *keyfile = NULL, *keydev = NULL, *headerdev = NULL, *filtered_header = NULL;
- crypto_device *d = NULL;
- char *l, *uuid;
+ _cleanup_free_ char *line = NULL, *name = NULL, *device = NULL, *keyspec = NULL, *options = NULL;
+ char *l;
int k;
r = read_line(f, LONG_LINE_MAX, &line);
@@ -819,42 +863,9 @@ static int add_crypttab_devices(void) {
continue;
}
- uuid = startswith(device, "UUID=");
- if (!uuid)
- uuid = path_startswith(device, "/dev/disk/by-uuid/");
- if (!uuid)
- uuid = startswith(name, "luks-");
- if (uuid)
- d = hashmap_get(arg_disks, uuid);
-
- if (arg_allow_list && !d) {
- log_info("Not creating device '%s' because it was not specified on the kernel command line.", name);
- continue;
- }
-
- r = split_locationspec(keyspec, &keyfile, &keydev);
+ r = add_crypttab_device(name, device, keyspec, options);
if (r < 0)
return r;
-
- if (options && (!d || !d->options)) {
- r = filter_header_device(options, &headerdev, &filtered_header);
- if (r < 0)
- return r;
- free_and_replace(options, filtered_header);
- }
-
- r = create_disk(name,
- device,
- keyfile,
- keydev,
- (d && d->options) ? d->headerdev : headerdev,
- (d && d->options) ? d->options : options,
- arg_crypttab);
- if (r < 0)
- return r;
-
- if (d)
- d->create = false;
}
return 0;

View File

@ -0,0 +1,43 @@
From 238dadc16fb2bb6ad2fef5602dac5cd2c9aa31ed Mon Sep 17 00:00:00 2001
From: David Tardon <dtardon@redhat.com>
Date: Thu, 30 May 2024 10:46:13 +0200
Subject: [PATCH] cryptsetup-generator: continue parsing after error
Let's make the crypttab parser more robust and continue even if parsing
of a line failed.
(cherry picked from commit 83813bae7ae471862ff84b038b5e4eaefae41c98)
Resolves: RHEL-127859
---
src/cryptsetup/cryptsetup-generator.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/src/cryptsetup/cryptsetup-generator.c b/src/cryptsetup/cryptsetup-generator.c
index 6ab3b85b6b..924a403ee5 100644
--- a/src/cryptsetup/cryptsetup-generator.c
+++ b/src/cryptsetup/cryptsetup-generator.c
@@ -828,7 +828,7 @@ static int add_crypttab_device(const char *name, const char *device, const char
static int add_crypttab_devices(void) {
_cleanup_fclose_ FILE *f = NULL;
unsigned crypttab_line = 0;
- int r;
+ int r, ret = 0;
if (!arg_read_crypttab)
return 0;
@@ -863,12 +863,10 @@ static int add_crypttab_devices(void) {
continue;
}
- r = add_crypttab_device(name, device, keyspec, options);
- if (r < 0)
- return r;
+ RET_GATHER(ret, add_crypttab_device(name, device, keyspec, options));
}
- return 0;
+ return ret;
}
static int add_proc_cmdline_devices(void) {

View File

@ -0,0 +1,39 @@
From 25a4e8e1d411f56fcee5b53d1620c42f3bba16e6 Mon Sep 17 00:00:00 2001
From: David Tardon <dtardon@redhat.com>
Date: Thu, 30 May 2024 13:32:20 +0200
Subject: [PATCH] cryptsetup-generator: parse all cmdline devices too
(cherry picked from commit 47c703d949e84997d11d657fade68064c04a46c8)
Related: RHEL-127859
---
src/cryptsetup/cryptsetup-generator.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/src/cryptsetup/cryptsetup-generator.c b/src/cryptsetup/cryptsetup-generator.c
index 924a403ee5..1136f5aed7 100644
--- a/src/cryptsetup/cryptsetup-generator.c
+++ b/src/cryptsetup/cryptsetup-generator.c
@@ -870,7 +870,7 @@ static int add_crypttab_devices(void) {
}
static int add_proc_cmdline_devices(void) {
- int r;
+ int r, ret = 0;
crypto_device *d;
HASHMAP_FOREACH(d, arg_disks) {
@@ -896,11 +896,10 @@ static int add_proc_cmdline_devices(void) {
d->headerdev,
d->options ?: arg_default_options,
"/proc/cmdline");
- if (r < 0)
- return r;
+ RET_GATHER(ret, r);
}
- return 0;
+ return ret;
}
DEFINE_PRIVATE_HASH_OPS_WITH_VALUE_DESTRUCTOR(crypt_device_hash_ops, char, string_hash_func, string_compare_func,

View File

@ -0,0 +1,33 @@
From 1ba4f74ed15a3b715eba0f21a12239af6e44146f Mon Sep 17 00:00:00 2001
From: David Tardon <dtardon@redhat.com>
Date: Thu, 30 May 2024 13:33:57 +0200
Subject: [PATCH] cryptsetup-generator: always process cmdline devices
(cherry picked from commit d181939e2e382631d9b067e0b4cfbf11b709a297)
Related: RHEL-127859
---
src/cryptsetup/cryptsetup-generator.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/src/cryptsetup/cryptsetup-generator.c b/src/cryptsetup/cryptsetup-generator.c
index 1136f5aed7..06292f7f73 100644
--- a/src/cryptsetup/cryptsetup-generator.c
+++ b/src/cryptsetup/cryptsetup-generator.c
@@ -925,14 +925,9 @@ static int run(const char *dest, const char *dest_early, const char *dest_late)
return 0;
r = add_crypttab_devices();
- if (r < 0)
- return r;
-
- r = add_proc_cmdline_devices();
- if (r < 0)
- return r;
+ RET_GATHER(r, add_proc_cmdline_devices());
- return 0;
+ return r;
}
DEFINE_MAIN_GENERATOR_FUNCTION(run);

View File

@ -0,0 +1,44 @@
From a48488d06e60af0d02387488d4de0abbaddf93ad Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Mon, 27 Nov 2023 18:39:02 +0100
Subject: [PATCH] logind: add "background-light" session class
This is the same as the "background" class, but does *not* pull in a
service manager. It might be useful for things like select cron jobs
that do not intend to call per-user IPC calls.
Replaces: #23569
Fixes: #23978
(cherry picked from commit b5100c736f1fce2b6b22c07cf2725e4ec3764a75)
Related: RHEL-109833
---
src/login/logind-session.c | 1 +
src/login/logind-session.h | 1 +
2 files changed, 2 insertions(+)
diff --git a/src/login/logind-session.c b/src/login/logind-session.c
index 8c8dd0d43e..5ba1e690ac 100644
--- a/src/login/logind-session.c
+++ b/src/login/logind-session.c
@@ -1525,6 +1525,7 @@ static const char* const session_class_table[_SESSION_CLASS_MAX] = {
[SESSION_GREETER] = "greeter",
[SESSION_LOCK_SCREEN] = "lock-screen",
[SESSION_BACKGROUND] = "background",
+ [SESSION_BACKGROUND_LIGHT] = "background-light",
};
DEFINE_STRING_TABLE_LOOKUP(session_class, SessionClass);
diff --git a/src/login/logind-session.h b/src/login/logind-session.h
index 5ee059aa4f..a02d72c211 100644
--- a/src/login/logind-session.h
+++ b/src/login/logind-session.h
@@ -23,6 +23,7 @@ typedef enum SessionClass {
SESSION_GREETER,
SESSION_LOCK_SCREEN,
SESSION_BACKGROUND,
+ SESSION_BACKGROUND_LIGHT, /* Like SESSION_BACKGROUND, but without the service manager */
_SESSION_CLASS_MAX,
_SESSION_CLASS_INVALID = -EINVAL,
} SessionClass;

View File

@ -0,0 +1,118 @@
From d5d08290cf66a0c491a875345902d5c3bfeb6c5a Mon Sep 17 00:00:00 2001
From: Michal Sekletar <msekleta@redhat.com>
Date: Mon, 25 Aug 2025 15:09:36 +0200
Subject: [PATCH] pam_systemd: honor session class provided via PAM environment
Replaces #38638
Co-authored-by: Lennart Poettering <lennart@poettering.net>
(cherry picked from commit cf2630acaa87ded5ad99ea30ed4bd895e71ca503)
Resolves: RHEL-109833
[msekleta: this is absolutely minimal version of the ideas implemented in
https://github.com/systemd/systemd/pull/30884. At this point I want to avoid
big/risky backports and what I am proposing here should suffice.]
---
man/pam_systemd.xml | 11 ++++++++++-
src/login/logind-session.c | 5 +++--
src/login/logind-user.c | 16 +++++++++++++++-
src/login/pam_systemd.c | 6 ++++--
4 files changed, 32 insertions(+), 6 deletions(-)
diff --git a/man/pam_systemd.xml b/man/pam_systemd.xml
index 60b8577822..55239ea3d7 100644
--- a/man/pam_systemd.xml
+++ b/man/pam_systemd.xml
@@ -95,8 +95,17 @@
<literal>lock-screen</literal> or <literal>background</literal>. See
<citerefentry><refentrytitle>sd_session_get_class</refentrytitle><manvolnum>3</manvolnum></citerefentry> for
details about the session class.</para></listitem>
- </varlistentry>
+ <para>If no session class is specified via either the PAM module option or via the
+ <varname>$XDG_SESSION_CLASS</varname> environment variable, the class is automatically chosen, depending on
+ various session parameters, such as the session type (if known), whether the session has a TTY or X11
+ display, and the user disposition. Note that various tools allow setting the session class for newly
+ allocated PAM sessions explicitly by means of the <varname>$XDG_SESSION_CLASS</varname> environment variable.
+ For example, classic UNIX cronjobs support environment variable assignments (see
+ <citerefentry project='man-pages'><refentrytitle>crontab</refentrytitle><manvolnum>5</manvolnum></citerefentry>),
+ which may be used to choose between the <constant>background</constant> and
+ <constant>background-light</constant> session class individually per cronjob.</para>
+ </varlistentry>
<varlistentry>
<term><varname>type=</varname></term>
diff --git a/src/login/logind-session.c b/src/login/logind-session.c
index 5ba1e690ac..2ad05e3798 100644
--- a/src/login/logind-session.c
+++ b/src/login/logind-session.c
@@ -680,8 +680,9 @@ static int session_start_scope(Session *s, sd_bus_message *properties, sd_bus_er
s->user->slice,
description,
/* These two have StopWhenUnneeded= set, hence add a dep towards them */
- STRV_MAKE(s->user->runtime_dir_service,
- s->user->service),
+ s->class == SESSION_BACKGROUND_LIGHT ?
+ STRV_MAKE(s->user->runtime_dir_service) :
+ STRV_MAKE(s->user->runtime_dir_service, s->user->service),
after,
user_record_home_directory(s->user->user_record),
properties,
diff --git a/src/login/logind-user.c b/src/login/logind-user.c
index e02ad754ee..ffa32c6ce5 100644
--- a/src/login/logind-user.c
+++ b/src/login/logind-user.c
@@ -441,6 +441,19 @@ static int user_update_slice(User *u) {
return 0;
}
+static bool user_wants_service_manager(User *u) {
+ assert(u);
+
+ LIST_FOREACH(sessions_by_user, s, u->sessions)
+ if (s->class != SESSION_BACKGROUND_LIGHT)
+ return true;
+
+ if (user_check_linger_file(u) > 0)
+ return true;
+
+ return false;
+}
+
int user_start(User *u) {
assert(u);
@@ -464,7 +477,8 @@ int user_start(User *u) {
(void) user_update_slice(u);
/* Start user@UID.service */
- user_start_service(u);
+ if (user_wants_service_manager(u))
+ user_start_service(u);
if (!u->started) {
if (!dual_timestamp_is_set(&u->timestamp))
diff --git a/src/login/pam_systemd.c b/src/login/pam_systemd.c
index a288b3602a..c7377e21a8 100644
--- a/src/login/pam_systemd.c
+++ b/src/login/pam_systemd.c
@@ -753,14 +753,16 @@ _public_ PAM_EXTERN int pam_sm_open_session(
* (as they otherwise even try to update it!) — but cron doesn't actually allocate a TTY for its forked
* off processes.) */
type = "unspecified";
- class = "background";
+ if (isempty(class))
+ class = "background";
tty = NULL;
} else if (streq(tty, "ssh")) {
/* ssh has been setting PAM_TTY to "ssh" (for the same reason as cron does this, see above. For further
* details look for "PAM_TTY_KLUDGE" in the openssh sources). */
type ="tty";
- class = "user";
+ if (isempty(class))
+ class = "user";
tty = NULL; /* This one is particularly sad, as this means that ssh sessions — even though usually
* associated with a pty — won't be tracked by their tty in logind. This is because ssh
* does the PAM session registration early for new connections, and registers a pty only

View File

@ -1,4 +1,4 @@
From ca32ed0b2451453eaff579d08f9e188f9c79ab0c Mon Sep 17 00:00:00 2001
From 52defa44074113197a8caade1254a61cfdcfa363 Mon Sep 17 00:00:00 2001
From: Florian Schmaus <flo@geekplace.eu>
Date: Thu, 9 Nov 2023 08:59:59 +0100
Subject: [PATCH] core: fix array size in unit_log_resources()
@ -10,16 +10,16 @@ messages was not adjusted.
Fixes: 0531bded79dc ("core: include peak memory in unit_log_resources()")
(cherry picked from commit 893028523469b3ec459388428ddc466942cdaf4d)
Resolves: RHEL-132120
Resolves: RHEL-131338
---
src/core/unit.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/core/unit.c b/src/core/unit.c
index 9e349402ff..3e04b12951 100644
index afe3fdab04..009f416280 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -2233,12 +2233,12 @@ static int raise_level(int log_level, bool condition_info, bool condition_notice
@@ -2242,12 +2242,12 @@ static int raise_level(int log_level, bool condition_info, bool condition_notice
}
static int unit_log_resources(Unit *u) {

View File

@ -0,0 +1,63 @@
From 8e0da3f5c5518350215a7186dfa748207ba921e8 Mon Sep 17 00:00:00 2001
From: Luca Boccassi <bluca@debian.org>
Date: Mon, 5 Dec 2022 21:05:54 +0000
Subject: [PATCH] pid1: add env var to override default mount rate limit burst
I am hitting the rate limit on a busy system with low resources, and
it stalls the boot process which is Very Bad (TM).
(cherry picked from commit 24a4542cfa674ee80b54afcc223f2490a011966b)
Related: RHEL-129153
---
docs/ENVIRONMENT.md | 7 +++++++
src/core/mount.c | 11 ++++++++++-
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/docs/ENVIRONMENT.md b/docs/ENVIRONMENT.md
index 54b779d312..88e6f5b372 100644
--- a/docs/ENVIRONMENT.md
+++ b/docs/ENVIRONMENT.md
@@ -281,6 +281,13 @@ All tools:
type as unsupported may not prevent loading some units of that type if they
are referenced by other units of another supported type.
+* `$SYSTEMD_DEFAULT_MOUNT_RATE_LIMIT_BURST` — can be set to override the mount
+ units burst rate limit for parsing `/proc/self/mountinfo`. On a system with
+ few resources but many mounts the rate limit may be hit, which will cause the
+ processing of mount units to stall. The burst limit may be adjusted when the
+ default is not appropriate for a given system. Defaults to `5`, accepts
+ positive integers.
+
`systemd-remount-fs`:
* `$SYSTEMD_REMOUNT_ROOT_RW=1` — if set and no entry for the root directory
diff --git a/src/core/mount.c b/src/core/mount.c
index 79772fb6f1..a8e101aa64 100644
--- a/src/core/mount.c
+++ b/src/core/mount.c
@@ -1910,6 +1910,7 @@ static void mount_enumerate(Manager *m) {
mnt_init_debug(0);
if (!m->mount_monitor) {
+ unsigned mount_rate_limit_burst = 5;
int fd;
m->mount_monitor = mnt_new_monitor();
@@ -1949,7 +1950,15 @@ static void mount_enumerate(Manager *m) {
goto fail;
}
- r = sd_event_source_set_ratelimit(m->mount_event_source, 1 * USEC_PER_SEC, 5);
+ /* Let users override the default (5 in 1s), as it stalls the boot sequence on busy systems. */
+ const char *e = secure_getenv("SYSTEMD_DEFAULT_MOUNT_RATE_LIMIT_BURST");
+ if (e) {
+ r = safe_atou(e, &mount_rate_limit_burst);
+ if (r < 0)
+ log_debug("Invalid value in $SYSTEMD_DEFAULT_MOUNT_RATE_LIMIT_BURST, ignoring: %s", e);
+ }
+
+ r = sd_event_source_set_ratelimit(m->mount_event_source, 1 * USEC_PER_SEC, mount_rate_limit_burst);
if (r < 0) {
log_error_errno(r, "Failed to enable rate limit for mount events: %m");
goto fail;

View File

@ -0,0 +1,75 @@
From 4f880e4dfc1b2e25046be380182535c39a931109 Mon Sep 17 00:00:00 2001
From: xujing <xujing125@huawei.com>
Date: Wed, 16 Oct 2024 15:19:09 +0800
Subject: [PATCH] pid1: add env var to override default mount rate limit
interval
Similar to 24a4542c. 24a4542c can only be set 1 in 1s at most,
sometimes we may need to set to something else(such as 1 in 2s).
So it's best to let the user decide.
This also allows users to solve #34690.
(cherry picked from commit cc2030f928981947db8fb9ec185a82024abab2c4)
Related: RHEL-129153
---
docs/ENVIRONMENT.md | 7 +++++++
src/core/mount.c | 14 +++++++++++---
2 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/docs/ENVIRONMENT.md b/docs/ENVIRONMENT.md
index 88e6f5b372..711364a2f7 100644
--- a/docs/ENVIRONMENT.md
+++ b/docs/ENVIRONMENT.md
@@ -288,6 +288,13 @@ All tools:
default is not appropriate for a given system. Defaults to `5`, accepts
positive integers.
+* `$SYSTEMD_DEFAULT_MOUNT_RATE_LIMIT_INTERVAL_SEC` — can be set to override the mount
+ units interval rate limit for parsing `/proc/self/mountinfo`. Similar to
+ `$SYSTEMD_DEFAULT_MOUNT_RATE_LIMIT_BURST`, the interval limit maybe adjusted when
+ the default is not appropriate for a given system. The default value is 1 and the
+ default application time unit is second, and the time unit can beoverriden as usual
+ by specifying it explicitly, see the systemd.time(7) man page.
+
`systemd-remount-fs`:
* `$SYSTEMD_REMOUNT_ROOT_RW=1` — if set and no entry for the root directory
diff --git a/src/core/mount.c b/src/core/mount.c
index a8e101aa64..be6fbf4cc4 100644
--- a/src/core/mount.c
+++ b/src/core/mount.c
@@ -1910,6 +1910,7 @@ static void mount_enumerate(Manager *m) {
mnt_init_debug(0);
if (!m->mount_monitor) {
+ usec_t mount_rate_limit_interval = 1 * USEC_PER_SEC;
unsigned mount_rate_limit_burst = 5;
int fd;
@@ -1951,14 +1952,21 @@ static void mount_enumerate(Manager *m) {
}
/* Let users override the default (5 in 1s), as it stalls the boot sequence on busy systems. */
- const char *e = secure_getenv("SYSTEMD_DEFAULT_MOUNT_RATE_LIMIT_BURST");
+ const char *e = secure_getenv("SYSTEMD_DEFAULT_MOUNT_RATE_LIMIT_INTERVAL_SEC");
+ if (e) {
+ r = parse_sec(e, &mount_rate_limit_interval);
+ if (r < 0)
+ log_debug_errno(r, "Invalid value in $SYSTEMD_DEFAULT_MOUNT_RATE_LIMIT_INTERVAL_SEC, ignoring: %s", e);
+ }
+
+ e = secure_getenv("SYSTEMD_DEFAULT_MOUNT_RATE_LIMIT_BURST");
if (e) {
r = safe_atou(e, &mount_rate_limit_burst);
if (r < 0)
- log_debug("Invalid value in $SYSTEMD_DEFAULT_MOUNT_RATE_LIMIT_BURST, ignoring: %s", e);
+ log_debug_errno(r, "Invalid value in $SYSTEMD_DEFAULT_MOUNT_RATE_LIMIT_BURST, ignoring: %s", e);
}
- r = sd_event_source_set_ratelimit(m->mount_event_source, 1 * USEC_PER_SEC, mount_rate_limit_burst);
+ r = sd_event_source_set_ratelimit(m->mount_event_source, mount_rate_limit_interval, mount_rate_limit_burst);
if (r < 0) {
log_error_errno(r, "Failed to enable rate limit for mount events: %m");
goto fail;

View File

@ -0,0 +1,28 @@
From de696eb8fc5caf5d5ad0a314fa21f8ca78bf8071 Mon Sep 17 00:00:00 2001
From: Yu Watanabe <watanabe.yu+github@gmail.com>
Date: Tue, 9 May 2023 00:21:20 +0900
Subject: [PATCH] core/service: fix error cause in the log
Fixes a bug caused by a5648b809457d120500b2acb18b31e2168a4817a.
Fixes #27575.
(cherry picked from commit f86a388de339bc9fd3bc90df7de0d9693b52369f)
Resolves: RHEL-138414
---
src/core/service.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/core/service.c b/src/core/service.c
index 305f3b7170..9c938aee91 100644
--- a/src/core/service.c
+++ b/src/core/service.c
@@ -989,7 +989,7 @@ static int service_load_pid_file(Service *s, bool may_warn) {
r = chase_symlinks(s->pid_file, NULL, 0, NULL, &fd);
}
if (r < 0)
- return log_unit_full_errno(UNIT(s), prio, fd,
+ return log_unit_full_errno(UNIT(s), prio, r,
"Can't open PID file %s (yet?) after %s: %m", s->pid_file, service_state_to_string(s->state));
/* Let's read the PID file now that we chased it down. But we need to convert the O_PATH fd

View File

@ -0,0 +1,45 @@
From 7640cebb70cc13ada4f0b6e3e26b7973be6d1b23 Mon Sep 17 00:00:00 2001
From: Mike Yuan <me@yhndnzj.com>
Date: Fri, 26 Jan 2024 00:47:23 +0800
Subject: [PATCH] fstab-generator: drop assertions for mount opts
fstab_filter_options accepts NULL and (with later changes)
might even return NULL.
(cherry picked from commit c521ce42b43ad542a8e3c6e5e83ceb653ca6a71e)
Related: RHEL-92752
---
src/fstab-generator/fstab-generator.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/fstab-generator/fstab-generator.c b/src/fstab-generator/fstab-generator.c
index b9606a5341..fe0283b4e7 100644
--- a/src/fstab-generator/fstab-generator.c
+++ b/src/fstab-generator/fstab-generator.c
@@ -486,7 +486,6 @@ static int add_mount(
assert(what);
assert(where);
- assert(opts);
assert(target_unit);
assert(source);
@@ -797,6 +796,9 @@ static int add_sysusr_sysroot_usr_bind_mount(const char *source) {
static MountPointFlags fstab_options_to_flags(const char *options, bool is_swap) {
MountPointFlags flags = 0;
+ if (isempty(options))
+ return 0;
+
if (fstab_test_option(options, "x-systemd.makefs\0"))
flags |= MOUNT_MAKEFS;
if (fstab_test_option(options, "x-systemd.growfs\0"))
@@ -872,7 +874,6 @@ static int parse_fstab_one(
assert(what_original);
assert(fstype);
- assert(options);
if (prefix_sysroot && !mount_in_initrd(where_original, options, accept_root))
return 0;

View File

@ -0,0 +1,114 @@
From 0a4f0be757c73e3320d1c611de9845f7713b10d0 Mon Sep 17 00:00:00 2001
From: Jules Lamur <contact@juleslamur.fr>
Date: Mon, 7 Apr 2025 18:49:26 +0200
Subject: [PATCH] fstab-generator: fix options in systemd.mount-extra= arg
Fixes a bug introduced by 55365b0a233ae3024411fd0815ad930e20f6a3d6 (v254).
The arguments `(rd.)systemd.mount-extra` take a value that looks like
`WHAT:WHERE[:FSTYPE[:OPTIONS]]`. The `OPTIONS` were parsed into a nulstr
where a comma-separated c-string was expected. This leads to a bug where
only the first option was taken into account by the generator.
For example, if you passed `systemd.mount-extra=/x:/y:baz:ro,defaults`
to the kernel, `systemd-fstab-generator` would translate that into a
nulstr: `ro\0defaults\0`.
Since methods processing options in the generator expected a
comma-separated c-string, they would only see the first option, `ro` in
this case.
(cherry picked from commit 06fadc4286fee6a7505a88659e5ae2e6f3ee60ba)
Resolves: RHEL-92752
---
src/fstab-generator/fstab-generator.c | 21 ++++---------------
.../hoge-withx20space.mount | 2 +-
.../dev-sdy3.swap | 2 +-
.../dev-sdy3.swap | 0
4 files changed, 6 insertions(+), 19 deletions(-)
rename test/test-fstab-generator/test-20-swap-from-cmdline.expected/{swap.target.requires => swap.target.wants}/dev-sdy3.swap (100%)
diff --git a/src/fstab-generator/fstab-generator.c b/src/fstab-generator/fstab-generator.c
index fe0283b4e7..28677a2f39 100644
--- a/src/fstab-generator/fstab-generator.c
+++ b/src/fstab-generator/fstab-generator.c
@@ -105,15 +105,15 @@ static int mount_array_add_internal(
char *in_what,
char *in_where,
const char *in_fstype,
- const char *in_options) {
+ char *in_options) {
_cleanup_free_ char *what = NULL, *where = NULL, *fstype = NULL, *options = NULL;
- int r;
/* This takes what and where. */
what = ASSERT_PTR(in_what);
where = in_where;
+ options = in_options;
fstype = strdup(isempty(in_fstype) ? "auto" : in_fstype);
if (!fstype)
@@ -122,19 +122,6 @@ static int mount_array_add_internal(
if (streq(fstype, "swap"))
where = mfree(where);
- if (!isempty(in_options)) {
- _cleanup_strv_free_ char **options_strv = NULL;
-
- r = strv_split_full(&options_strv, in_options, ",", 0);
- if (r < 0)
- return r;
-
- r = strv_make_nulstr(options_strv, &options, NULL);
- } else
- r = strv_make_nulstr(STRV_MAKE("defaults"), &options, NULL);
- if (r < 0)
- return r;
-
if (!GREEDY_REALLOC(arg_mounts, arg_n_mounts + 1))
return -ENOMEM;
@@ -164,7 +151,7 @@ static int mount_array_add(bool for_initrd, const char *str) {
if (!isempty(str))
return -EINVAL;
- return mount_array_add_internal(for_initrd, TAKE_PTR(what), TAKE_PTR(where), fstype, options);
+ return mount_array_add_internal(for_initrd, TAKE_PTR(what), TAKE_PTR(where), fstype, TAKE_PTR(options));
}
static int mount_array_add_swap(bool for_initrd, const char *str) {
@@ -182,7 +169,7 @@ static int mount_array_add_swap(bool for_initrd, const char *str) {
if (!isempty(str))
return -EINVAL;
- return mount_array_add_internal(for_initrd, TAKE_PTR(what), NULL, "swap", options);
+ return mount_array_add_internal(for_initrd, TAKE_PTR(what), NULL, "swap", TAKE_PTR(options));
}
static int write_options(FILE *f, const char *options) {
diff --git a/test/test-fstab-generator/test-19-mounts-from-cmdline.expected/hoge-withx20space.mount b/test/test-fstab-generator/test-19-mounts-from-cmdline.expected/hoge-withx20space.mount
index e9ffb4bbd9..d3797c9706 100644
--- a/test/test-fstab-generator/test-19-mounts-from-cmdline.expected/hoge-withx20space.mount
+++ b/test/test-fstab-generator/test-19-mounts-from-cmdline.expected/hoge-withx20space.mount
@@ -9,4 +9,4 @@ Before=remote-fs.target
What=//foo￾bar
Where=/hoge/with space
Type=cifs
-Options=rw
+Options=rw,seclabel
diff --git a/test/test-fstab-generator/test-20-swap-from-cmdline.expected/dev-sdy3.swap b/test/test-fstab-generator/test-20-swap-from-cmdline.expected/dev-sdy3.swap
index 3b6563d216..1b4b53c9b8 100644
--- a/test/test-fstab-generator/test-20-swap-from-cmdline.expected/dev-sdy3.swap
+++ b/test/test-fstab-generator/test-20-swap-from-cmdline.expected/dev-sdy3.swap
@@ -7,4 +7,4 @@ After=blockdev@dev-sdy3.target
[Swap]
What=/dev/sdy3
-Options=x-systemd.makefs
+Options=x-systemd.makefs,nofail
diff --git a/test/test-fstab-generator/test-20-swap-from-cmdline.expected/swap.target.requires/dev-sdy3.swap b/test/test-fstab-generator/test-20-swap-from-cmdline.expected/swap.target.wants/dev-sdy3.swap
similarity index 100%
rename from test/test-fstab-generator/test-20-swap-from-cmdline.expected/swap.target.requires/dev-sdy3.swap
rename to test/test-fstab-generator/test-20-swap-from-cmdline.expected/swap.target.wants/dev-sdy3.swap

View File

@ -0,0 +1,57 @@
From 88dfaa167328461ac18e8e764c97e19632b34161 Mon Sep 17 00:00:00 2001
From: Frantisek Sumsal <frantisek@sumsal.cz>
Date: Thu, 29 Jun 2023 13:31:19 +0200
Subject: [PATCH] core: reorder systemd arguments on reexec
When reexecuting system let's put our arguments carrying deserialization
info first followed by any existing arguments to make sure they get
parsed in case we get weird stuff from the kernel cmdline (like --).
See: https://github.com/systemd/systemd/issues/28184
(cherry picked from commit 06afda6b38d5d730fca3c65449096425933272bc)
Resolves: RHEL-111135
---
src/core/main.c | 6 +++++-
test/TEST-01-BASIC/test.sh | 5 +++++
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/src/core/main.c b/src/core/main.c
index f230270340..2eba3a3c50 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -1814,13 +1814,17 @@ static int do_reexecute(
xsprintf(sfd, "%i", fileno(arg_serialization));
i = 1; /* Leave args[0] empty for now. */
- filter_args(args, &i, argv, argc);
+ /* Put our stuff first to make sure it always gets parsed in case
+ * we get weird stuff from the kernel cmdline (like --) */
if (switch_root_dir)
args[i++] = "--switched-root";
args[i++] = arg_system ? "--system" : "--user";
args[i++] = "--deserialize";
args[i++] = sfd;
+
+ filter_args(args, &i, argv, argc);
+
args[i++] = NULL;
assert(i <= args_size);
diff --git a/test/TEST-01-BASIC/test.sh b/test/TEST-01-BASIC/test.sh
index cc6d0651c1..d0e714ac30 100755
--- a/test/TEST-01-BASIC/test.sh
+++ b/test/TEST-01-BASIC/test.sh
@@ -8,6 +8,11 @@ RUN_IN_UNPRIVILEGED_CONTAINER=${RUN_IN_UNPRIVILEGED_CONTAINER:-yes}
TEST_REQUIRE_INSTALL_TESTS=0
TEST_SUPPORTING_SERVICES_SHOULD_BE_MASKED=0
+# Check if we can correctly deserialize if the kernel cmdline contains "weird" stuff
+# like an invalid argument, "end of arguments" separator, or a sysvinit argument (-z)
+# See: https://github.com/systemd/systemd/issues/28184
+KERNEL_APPEND="foo -- -z bar --- baz $KERNEL_APPEND"
+
# shellcheck source=test/test-functions
. "${TEST_BASE_DIR:?}/test-functions"

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,68 @@
From 2728e6821ab6f5c0c5316a367bb1aa626b036779 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Thu, 9 Mar 2023 17:41:25 +0100
Subject: [PATCH] runtime-scope: add helper that turns RuntimeScope enum into
--system/--user string
(cherry picked from commit 40d73340faabb6073602ba3ff41896f3478a2cbf)
Related: RHEL-137252
---
src/basic/runtime-scope.c | 8 ++++++++
src/basic/runtime-scope.h | 2 ++
src/core/main.c | 2 +-
src/systemctl/systemctl-start-special.c | 2 +-
4 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/src/basic/runtime-scope.c b/src/basic/runtime-scope.c
index 88afb53d0b..3d653d6cef 100644
--- a/src/basic/runtime-scope.c
+++ b/src/basic/runtime-scope.c
@@ -10,3 +10,11 @@ static const char* const runtime_scope_table[_RUNTIME_SCOPE_MAX] = {
};
DEFINE_STRING_TABLE_LOOKUP(runtime_scope, RuntimeScope);
+
+static const char* const runtime_scope_cmdline_option_table[_RUNTIME_SCOPE_MAX] = {
+ [RUNTIME_SCOPE_SYSTEM] = "--system",
+ [RUNTIME_SCOPE_USER] = "--user",
+ [RUNTIME_SCOPE_GLOBAL] = "--global",
+};
+
+DEFINE_STRING_TABLE_LOOKUP_TO_STRING(runtime_scope_cmdline_option, RuntimeScope);
diff --git a/src/basic/runtime-scope.h b/src/basic/runtime-scope.h
index 6a7f9e65d4..6553e4c199 100644
--- a/src/basic/runtime-scope.h
+++ b/src/basic/runtime-scope.h
@@ -15,3 +15,5 @@ typedef enum RuntimeScope {
const char *runtime_scope_to_string(RuntimeScope scope) _const_;
RuntimeScope runtime_scope_from_string(const char *s) _const_;
+
+const char *runtime_scope_cmdline_option_to_string(RuntimeScope scope) _const_;
diff --git a/src/core/main.c b/src/core/main.c
index 3ef613a8b1..18f5781126 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -1821,7 +1821,7 @@ static int do_reexecute(
* we get weird stuff from the kernel cmdline (like --) */
if (switch_root_dir)
args[i++] = "--switched-root";
- args[i++] = arg_runtime_scope == RUNTIME_SCOPE_SYSTEM ? "--system" : "--user";
+ args[i++] = runtime_scope_cmdline_option_to_string(arg_runtime_scope);
args[i++] = "--deserialize";
args[i++] = sfd;
diff --git a/src/systemctl/systemctl-start-special.c b/src/systemctl/systemctl-start-special.c
index 503d69f2a0..8373dabe15 100644
--- a/src/systemctl/systemctl-start-special.c
+++ b/src/systemctl/systemctl-start-special.c
@@ -260,7 +260,7 @@ int verb_start_system_special(int argc, char *argv[], void *userdata) {
if (arg_runtime_scope != RUNTIME_SCOPE_SYSTEM)
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
"Bad action for %s mode.",
- arg_runtime_scope == RUNTIME_SCOPE_GLOBAL ? "--global" : "--user");
+ runtime_scope_cmdline_option_to_string(arg_runtime_scope));
return verb_start_special(argc, argv, userdata);
}

View File

@ -0,0 +1,79 @@
From 3be3354126953a51625015b43ab5abc11315cd40 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Mon, 26 Jun 2023 18:55:14 +0200
Subject: [PATCH] sd-path: add support for XDG_STATE_HOME
(cherry picked from commit 9a653235d12a795a8bd6adf6289ea735ccae71af)
Related: RHEL-137252
---
man/sd_path_lookup.xml | 1 +
src/libsystemd/sd-path/sd-path.c | 3 +++
src/path/path.c | 2 ++
src/systemd/sd-path.h | 5 ++++-
4 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/man/sd_path_lookup.xml b/man/sd_path_lookup.xml
index 01fb1ed8f1..c2ea6469a1 100644
--- a/man/sd_path_lookup.xml
+++ b/man/sd_path_lookup.xml
@@ -55,6 +55,7 @@
<constant>SD_PATH_USER_CONFIGURATION</constant>,
<constant>SD_PATH_USER_RUNTIME</constant>,
+ <constant>SD_PATH_USER_STATE_PRIVATE</constant>,
<constant>SD_PATH_USER_STATE_CACHE</constant>,
<constant>SD_PATH_USER</constant>,
diff --git a/src/libsystemd/sd-path/sd-path.c b/src/libsystemd/sd-path/sd-path.c
index 2c8181fbfb..73a51aebc2 100644
--- a/src/libsystemd/sd-path/sd-path.c
+++ b/src/libsystemd/sd-path/sd-path.c
@@ -281,6 +281,9 @@ static int get_path(uint64_t type, char **buffer, const char **ret) {
case SD_PATH_USER_STATE_CACHE:
return from_home_dir("XDG_CACHE_HOME", ".cache", buffer, ret);
+ case SD_PATH_USER_STATE_PRIVATE:
+ return from_home_dir("XDG_STATE_HOME", ".local/state", buffer, ret);
+
case SD_PATH_USER:
r = get_home_dir(buffer);
if (r < 0)
diff --git a/src/path/path.c b/src/path/path.c
index 0024a60611..9d9b24d5e2 100644
--- a/src/path/path.c
+++ b/src/path/path.c
@@ -41,6 +41,8 @@ static const char* const path_table[_SD_PATH_MAX] = {
[SD_PATH_USER_CONFIGURATION] = "user-configuration",
[SD_PATH_USER_RUNTIME] = "user-runtime",
[SD_PATH_USER_STATE_CACHE] = "user-state-cache",
+ [SD_PATH_USER_STATE_PRIVATE] = "user-state-private",
+
[SD_PATH_USER] = "user",
[SD_PATH_USER_DOCUMENTS] = "user-documents",
[SD_PATH_USER_MUSIC] = "user-music",
diff --git a/src/systemd/sd-path.h b/src/systemd/sd-path.h
index 161a8e0c8d..0c04e7c22e 100644
--- a/src/systemd/sd-path.h
+++ b/src/systemd/sd-path.h
@@ -53,9 +53,10 @@ enum {
SD_PATH_USER_SHARED,
/* User configuration, state, runtime ... */
- SD_PATH_USER_CONFIGURATION, /* takes both actual configuration (like /etc) and state (like /var/lib) */
+ SD_PATH_USER_CONFIGURATION,
SD_PATH_USER_RUNTIME,
SD_PATH_USER_STATE_CACHE,
+ /* → SD_PATH_USER_STATE_PRIVATE is added at the bottom */
/* User resources */
SD_PATH_USER, /* $HOME itself */
@@ -110,6 +111,8 @@ enum {
/* systemd-networkd search paths */
SD_PATH_SYSTEMD_SEARCH_NETWORK,
+ SD_PATH_USER_STATE_PRIVATE,
+
_SD_PATH_MAX
};

View File

@ -0,0 +1,57 @@
From c5a486e8816778e6b3c6c9b02e1fb57d24f60252 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Mon, 26 Jun 2023 18:55:39 +0200
Subject: [PATCH] sd-path: bring spacing in sd-path.h and systemd-path tool in
sync
(cherry picked from commit 4bbfc9eac53a9bd1d239312e2572ad352e418d20)
Related: RHEL-137252
---
src/path/path.c | 12 ++++++++----
src/systemd/sd-path.h | 1 +
2 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/src/path/path.c b/src/path/path.c
index 9d9b24d5e2..6762e2c553 100644
--- a/src/path/path.c
+++ b/src/path/path.c
@@ -62,18 +62,22 @@ static const char* const path_table[_SD_PATH_MAX] = {
[SD_PATH_SEARCH_CONFIGURATION] = "search-configuration",
[SD_PATH_SYSTEMD_UTIL] = "systemd-util",
+
[SD_PATH_SYSTEMD_SYSTEM_UNIT] = "systemd-system-unit",
[SD_PATH_SYSTEMD_SYSTEM_PRESET] = "systemd-system-preset",
[SD_PATH_SYSTEMD_SYSTEM_CONF] = "systemd-system-conf",
- [SD_PATH_SYSTEMD_SEARCH_SYSTEM_UNIT] = "systemd-search-system-unit",
- [SD_PATH_SYSTEMD_SYSTEM_GENERATOR] = "systemd-system-generator",
- [SD_PATH_SYSTEMD_SEARCH_SYSTEM_GENERATOR] = "systemd-search-system-generator",
[SD_PATH_SYSTEMD_USER_UNIT] = "systemd-user-unit",
[SD_PATH_SYSTEMD_USER_PRESET] = "systemd-user-preset",
[SD_PATH_SYSTEMD_USER_CONF] = "systemd-user-conf",
+
+ [SD_PATH_SYSTEMD_SEARCH_SYSTEM_UNIT] = "systemd-search-system-unit",
[SD_PATH_SYSTEMD_SEARCH_USER_UNIT] = "systemd-search-user-unit",
- [SD_PATH_SYSTEMD_SEARCH_USER_GENERATOR] = "systemd-search-user-generator",
+
+ [SD_PATH_SYSTEMD_SYSTEM_GENERATOR] = "systemd-system-generator",
[SD_PATH_SYSTEMD_USER_GENERATOR] = "systemd-user-generator",
+ [SD_PATH_SYSTEMD_SEARCH_SYSTEM_GENERATOR] = "systemd-search-system-generator",
+ [SD_PATH_SYSTEMD_SEARCH_USER_GENERATOR] = "systemd-search-user-generator",
+
[SD_PATH_SYSTEMD_SLEEP] = "systemd-sleep",
[SD_PATH_SYSTEMD_SHUTDOWN] = "systemd-shutdown",
diff --git a/src/systemd/sd-path.h b/src/systemd/sd-path.h
index 0c04e7c22e..a187cd6aee 100644
--- a/src/systemd/sd-path.h
+++ b/src/systemd/sd-path.h
@@ -83,6 +83,7 @@ enum {
* replaces "path" by "search"), since this API is about dirs/paths anyway, and contains "path"
* already in the prefix */
SD_PATH_SYSTEMD_UTIL,
+
SD_PATH_SYSTEMD_SYSTEM_UNIT,
SD_PATH_SYSTEMD_SYSTEM_PRESET,
SD_PATH_SYSTEMD_SYSTEM_CONF,

View File

@ -0,0 +1,25 @@
From 60180ce9e6f78cfaf20bb3b3f08c3395f11908a3 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Mon, 26 Jun 2023 18:55:52 +0200
Subject: [PATCH] path tool: add some basic ansi highlighing
(cherry picked from commit 17f06e97e4d07448b579086b2e0217f84236d634)
Related: RHEL-137252
---
src/path/path.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/path/path.c b/src/path/path.c
index 6762e2c553..77361b43af 100644
--- a/src/path/path.c
+++ b/src/path/path.c
@@ -108,7 +108,7 @@ static int list_homes(void) {
continue;
}
- printf("%s: %s\n", path_table[i], p);
+ printf("%s%s:%s %s\n", ansi_highlight(), path_table[i], ansi_normal(), p);
}
return r;

Some files were not shown because too many files have changed in this diff Show More