Skip to content

Commit 84db20b

Browse files
committed
rebase and patch systemd for CVE-2026-40226
1 parent 10c1937 commit 84db20b

4 files changed

Lines changed: 240 additions & 2 deletions

File tree

SPECS-SIGNED/systemd-boot-signed/systemd-boot-signed.spec

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Version: 255
2020
# determine the build information from local checkout
2121
Version: %(tools/meson-vcs-tag.sh . error | sed -r 's/-([0-9])/.^\1/; s/-g/_g/')
2222
%endif
23-
Release: 27%{?dist}
23+
Release: 28%{?dist}
2424
License: LGPL-2.1-or-later AND MIT AND GPL-2.0-or-later
2525
Vendor: Microsoft Corporation
2626
Distribution: Azure Linux
@@ -98,6 +98,9 @@ popd
9898
/boot/efi/EFI/BOOT/%{grubefiname}
9999

100100
%changelog
101+
* Tue Apr 21 2026 Akhila Guruju <v-guakhila@microsoft.com> - 255-28
102+
- Bump release to match systemd spec
103+
101104
* Thu Mar 26 2026 Lanze Liu <lanzeliu@microsoft.com> - 255-27
102105
- Bump release to match systemd spec
103106

SPECS/systemd/CVE-2026-40225.patch

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
From 03bb697b8df0339c37f4b845025320b261aeb7cc Mon Sep 17 00:00:00 2001
2+
From: Luca Boccassi <luca.boccassi@gmail.com>
3+
Date: Fri, 6 Mar 2026 19:32:35 +0000
4+
Subject: [PATCH] udev: check for invalid chars in various fields received from
5+
the kernel
6+
7+
(cherry picked from commit 16325b35fa6ecb25f66534a562583ce3b96d52f3)
8+
(cherry picked from commit 3513862eabe9ec4a6a095d7266e98f998f289ed2)
9+
(cherry picked from commit c20d21e0da293e715db468f9f4a15a5c8fbf8273)
10+
11+
From 5887e72ff87d3a66a4c3fa91897fbec1545f4d3d Mon Sep 17 00:00:00 2001
12+
From: Luca Boccassi <luca.boccassi@gmail.com>
13+
Date: Fri, 13 Mar 2026 11:10:47 +0000
14+
Subject: [PATCH] udev: fix review mixup
15+
16+
The previous version in the PR changed variable and sanitized it
17+
in place. The second version switched to skip if CCs are in the
18+
string instead, but didn't move back to the original variable.
19+
Because it's an existing variable, no CI caught it.
20+
21+
Upstream Patch reference:
22+
1. https://github.com/systemd/systemd/commit/03bb697b8df0339c37f4b845025320b261aeb7cc.patch
23+
2. https://github.com/systemd/systemd/commit/5887e72ff87d3a66a4c3fa91897fbec1545f4d3d.patch
24+
---
25+
src/udev/dmi_memory_id/dmi_memory_id.c | 3 ++-
26+
src/udev/scsi_id/scsi_id.c | 3 ++-
27+
src/udev/udev-builtin-net_id.c | 9 +++++++++
28+
src/udev/v4l_id/v4l_id.c | 5 ++++-
29+
4 files changed, 17 insertions(+), 3 deletions(-)
30+
31+
diff --git a/src/udev/dmi_memory_id/dmi_memory_id.c b/src/udev/dmi_memory_id/dmi_memory_id.c
32+
index 37c098a..c965f4a 100644
33+
--- a/src/udev/dmi_memory_id/dmi_memory_id.c
34+
+++ b/src/udev/dmi_memory_id/dmi_memory_id.c
35+
@@ -51,6 +51,7 @@
36+
#include "string-util.h"
37+
#include "udev-util.h"
38+
#include "unaligned.h"
39+
+#include "utf8.h"
40+
41+
#define SUPPORTED_SMBIOS_VER 0x030300
42+
43+
@@ -185,7 +186,7 @@ static void dmi_memory_device_string(
44+
45+
str = strdupa_safe(dmi_string(h, s));
46+
str = strstrip(str);
47+
- if (!isempty(str))
48+
+ if (!isempty(str) && utf8_is_valid(str) && !string_has_cc(str, /* ok= */ NULL))
49+
printf("MEMORY_DEVICE_%u_%s=%s\n", slot_num, attr_suffix, str);
50+
}
51+
52+
diff --git a/src/udev/scsi_id/scsi_id.c b/src/udev/scsi_id/scsi_id.c
53+
index 6308c52..b2df8d9 100644
54+
--- a/src/udev/scsi_id/scsi_id.c
55+
+++ b/src/udev/scsi_id/scsi_id.c
56+
@@ -27,6 +27,7 @@
57+
#include "strv.h"
58+
#include "strxcpyx.h"
59+
#include "udev-util.h"
60+
+#include "utf8.h"
61+
62+
static const struct option options[] = {
63+
{ "device", required_argument, NULL, 'd' },
64+
@@ -443,7 +444,7 @@ static int scsi_id(char *maj_min_dev) {
65+
}
66+
if (dev_scsi.tgpt_group[0] != '\0')
67+
printf("ID_TARGET_PORT=%s\n", dev_scsi.tgpt_group);
68+
- if (dev_scsi.unit_serial_number[0] != '\0')
69+
+ if (dev_scsi.unit_serial_number[0] != '\0' && utf8_is_valid(dev_scsi.unit_serial_number) && !string_has_cc(dev_scsi.unit_serial_number, /* ok= */ NULL))
70+
printf("ID_SCSI_SERIAL=%s\n", dev_scsi.unit_serial_number);
71+
goto out;
72+
}
73+
diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c
74+
index 91b4008..715184e 100644
75+
--- a/src/udev/udev-builtin-net_id.c
76+
+++ b/src/udev/udev-builtin-net_id.c
77+
@@ -39,6 +39,7 @@
78+
#include "strv.h"
79+
#include "strxcpyx.h"
80+
#include "udev-builtin.h"
81+
+#include "utf8.h"
82+
83+
#define ONBOARD_14BIT_INDEX_MAX ((1U << 14) - 1)
84+
#define ONBOARD_16BIT_INDEX_MAX ((1U << 16) - 1)
85+
@@ -247,6 +248,9 @@ static int get_port_specifier(sd_device *dev, bool fallback_to_dev_id, char **re
86+
}
87+
}
88+
89+
+ if (!utf8_is_valid(phys_port_name) || string_has_cc(phys_port_name, /* ok= */ NULL))
90+
+ return log_device_debug_errno(dev, SYNTHETIC_ERRNO(EINVAL), "Invalid phys_port_name");
91+
+
92+
/* Otherwise, use phys_port_name as is. */
93+
buf = strjoin("n", phys_port_name);
94+
if (!buf)
95+
@@ -351,6 +355,9 @@ static int names_pci_onboard_label(sd_device *dev, sd_device *pci_dev, const cha
96+
if (r < 0)
97+
return log_device_debug_errno(pci_dev, r, "Failed to get PCI onboard label: %m");
98+
99+
+ if (!utf8_is_valid(label) || string_has_cc(label, /* ok= */ NULL))
100+
+ return log_device_debug_errno(dev, SYNTHETIC_ERRNO(EINVAL), "Invalid label");
101+
+
102+
char str[ALTIFNAMSIZ];
103+
if (snprintf_ok(str, sizeof str, "%s%s",
104+
naming_scheme_has(NAMING_LABEL_NOPREFIX) ? "" : prefix,
105+
@@ -1209,6 +1216,8 @@ static int names_netdevsim(sd_device *dev, const char *prefix, bool test) {
106+
if (isempty(phys_port_name))
107+
return log_device_debug_errno(dev, SYNTHETIC_ERRNO(EOPNOTSUPP),
108+
"The 'phys_port_name' attribute is empty.");
109+
+ if (!utf8_is_valid(phys_port_name) || string_has_cc(phys_port_name, /* ok= */ NULL))
110+
+ return log_device_debug_errno(dev, SYNTHETIC_ERRNO(EINVAL), "Invalid phys_port_name");
111+
112+
char str[ALTIFNAMSIZ];
113+
if (snprintf_ok(str, sizeof str, "%si%un%s", prefix, addr, phys_port_name))
114+
diff --git a/src/udev/v4l_id/v4l_id.c b/src/udev/v4l_id/v4l_id.c
115+
index 30527e9..2ec96d8 100644
116+
--- a/src/udev/v4l_id/v4l_id.c
117+
+++ b/src/udev/v4l_id/v4l_id.c
118+
@@ -29,6 +29,8 @@
119+
#include "build.h"
120+
#include "fd-util.h"
121+
#include "main-func.h"
122+
+#include "string-util.h"
123+
+#include "utf8.h"
124+
125+
static const char *arg_device = NULL;
126+
127+
@@ -82,7 +84,8 @@ static int run(int argc, char *argv[]) {
128+
int capabilities;
129+
130+
printf("ID_V4L_VERSION=2\n");
131+
- printf("ID_V4L_PRODUCT=%s\n", v2cap.card);
132+
+ if (utf8_is_valid((char *)v2cap.card) && !string_has_cc((char *)v2cap.card, /* ok= */ NULL))
133+
+ printf("ID_V4L_PRODUCT=%s\n", v2cap.card);
134+
printf("ID_V4L_CAPABILITIES=:");
135+
136+
if (v2cap.capabilities & V4L2_CAP_DEVICE_CAPS)
137+
--
138+
2.43.0
139+

SPECS/systemd/CVE-2026-40226.patch

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
From 773fd3b6e72e6c83cbb1cfc1cb20f3793db8649a Mon Sep 17 00:00:00 2001
2+
From: Luca Boccassi <luca.boccassi@gmail.com>
3+
Date: Wed, 11 Mar 2026 12:15:26 +0000
4+
Subject: [PATCH] nspawn: apply BindUser/Ephemeral from settings file only if
5+
trusted
6+
7+
Originally reported on yeswehack.com as:
8+
YWH-PGM9780-116
9+
10+
Follow-up for 2f8930449079403b26c9164b8eeac78d5af2c8df
11+
Follow-up for a2f577fca0be79b23f61f033229b64884e7d840a
12+
13+
(cherry picked from commit 61bceb1bff4b1f9c126b18dc971ca3e6d8c71c40)
14+
(cherry picked from commit 718711ed876c870a72149eea279b819cdab14e91)
15+
(cherry picked from commit e4db9c12957d315c0ed22c6ca87a816d0927d6dc)
16+
17+
From bfa0a842822c4f79da9d47f8a773fd128d8f8a0a Mon Sep 17 00:00:00 2001
18+
From: Luca Boccassi <luca.boccassi@gmail.com>
19+
Date: Wed, 11 Mar 2026 13:27:14 +0000
20+
Subject: [PATCH] nspawn: normalize pivot_root paths
21+
22+
Originally reported on yeswehack.com as:
23+
YWH-PGM9780-116
24+
25+
Follow-up for b53ede699cdc5233041a22591f18863fb3fe2672
26+
27+
(cherry picked from commit 7b85f5498a958e5bb660c703b8f4a71cceed3373)
28+
(cherry picked from commit 6566dc1451089e07090f5a114ae2eb43ed39188d)
29+
(cherry picked from commit 1c55a0a5e26a07df828f72092ad1203e221b60db)
30+
31+
Upstream Patch references:
32+
1. https://github.com/systemd/systemd/commit/773fd3b6e72e6c83cbb1cfc1cb20f3793db8649a.patch
33+
2. https://github.com/systemd/systemd/commit/bfa0a842822c4f79da9d47f8a773fd128d8f8a0a.patch
34+
---
35+
src/nspawn/nspawn-mount.c | 4 +++-
36+
src/nspawn/nspawn.c | 18 ++++++++++++++----
37+
2 files changed, 17 insertions(+), 5 deletions(-)
38+
39+
diff --git a/src/nspawn/nspawn-mount.c b/src/nspawn/nspawn-mount.c
40+
index 470f477..09c442a 100644
41+
--- a/src/nspawn/nspawn-mount.c
42+
+++ b/src/nspawn/nspawn-mount.c
43+
@@ -1255,7 +1255,9 @@ int pivot_root_parse(char **pivot_root_new, char **pivot_root_old, const char *s
44+
45+
if (!path_is_absolute(root_new))
46+
return -EINVAL;
47+
- if (root_old && !path_is_absolute(root_old))
48+
+ if (!path_is_normalized(root_new))
49+
+ return -EINVAL;
50+
+ if (root_old && (!path_is_absolute(root_old) || !path_is_normalized(root_old)))
51+
return -EINVAL;
52+
53+
free_and_replace(*pivot_root_new, root_new);
54+
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
55+
index 8ac86ee..dee343b 100644
56+
--- a/src/nspawn/nspawn.c
57+
+++ b/src/nspawn/nspawn.c
58+
@@ -4263,8 +4263,13 @@ static int merge_settings(Settings *settings, const char *path) {
59+
}
60+
61+
if ((arg_settings_mask & SETTING_EPHEMERAL) == 0 &&
62+
- settings->ephemeral >= 0)
63+
- arg_ephemeral = settings->ephemeral;
64+
+ settings->ephemeral >= 0) {
65+
+
66+
+ if (!arg_settings_trusted)
67+
+ log_warning("Ignoring ephemeral setting, file %s is not trusted.", path);
68+
+ else
69+
+ arg_ephemeral = settings->ephemeral;
70+
+ }
71+
72+
if ((arg_settings_mask & SETTING_DIRECTORY) == 0 &&
73+
settings->root) {
74+
@@ -4432,8 +4437,13 @@ static int merge_settings(Settings *settings, const char *path) {
75+
}
76+
77+
if ((arg_settings_mask & SETTING_BIND_USER) == 0 &&
78+
- !strv_isempty(settings->bind_user))
79+
- strv_free_and_replace(arg_bind_user, settings->bind_user);
80+
+ !strv_isempty(settings->bind_user)) {
81+
+
82+
+ if (!arg_settings_trusted)
83+
+ log_warning("Ignoring bind user setting, file %s is not trusted.", path);
84+
+ else
85+
+ strv_free_and_replace(arg_bind_user, settings->bind_user);
86+
+ }
87+
88+
if ((arg_settings_mask & SETTING_NOTIFY_READY) == 0 &&
89+
settings->notify_ready >= 0)
90+
--
91+
2.43.0

SPECS/systemd/systemd.spec

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ Version: 255
5050
# determine the build information from local checkout
5151
Version: %(tools/meson-vcs-tag.sh . error | sed -r 's/-([0-9])/.^\1/; s/-g/_g/')
5252
%endif
53-
Release: 27%{?dist}
53+
Release: 28%{?dist}
5454

5555
# FIXME - hardcode to 'stable' for now as that's what we have in our blobstore
5656
%global stable 1
@@ -150,6 +150,8 @@ Patch0906: ipc-call-0003-core-cgroup-avoid-one-unnecessary-strjoina.patch
150150
Patch0907: ipc-call-0002-path-util-invert-PATH_STARTSWITH_ACCEPT_DOT_DOT-flag.patch
151151
Patch0908: ipc-call-0004-core-validate-input-cgroup-path-more-prudently.patch
152152
Patch0909: fix-pcrlock-hyperv-hash-algorithm-ordering.patch
153+
Patch0910: CVE-2026-40226.patch
154+
Patch0911: CVE-2026-40225.patch
153155

154156
%ifarch %{ix86} x86_64 aarch64
155157
%global want_bootloader 1
@@ -1235,6 +1237,9 @@ rm -f %{name}.lang
12351237
# %autochangelog. So we need to continue manually maintaining the
12361238
# changelog here.
12371239
%changelog
1240+
* Tue Apr 21 2026 Akhila Guruju <v-guakhila@microsoft.com> - 255-28
1241+
- Patch CVE-2026-40226, CVE-2026-40225
1242+
12381243
* Thu Mar 26 2026 Lanze Liu <lanzeliu@microsoft.com> - 255-27
12391244
- Fix pcrlock failure on Hyper-V/Azure VMs with vTPM by backporting upstream
12401245
commit e90a255 from systemd v256 (PR #31429).

0 commit comments

Comments
 (0)