diff mbox series

[05/26] systemd: update 252.5 -> 253.1

Message ID 20230309151958.3619193-5-alex@linutronix.de
State Accepted, archived
Commit d92f0f3597acba6cfc55a8cf2e7249efc6573c6a
Headers show
Series [01/26] devtool/upgrade: do not delete the workspace/recipes directory | expand

Commit Message

Alexander Kanavin March 9, 2023, 3:19 p.m. UTC
Add a musl compatibility patch to systemd-boot.

Backport a patch to address systemctl fails on 32 bit targets.

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
---
 ...md-boot_252.5.bb => systemd-boot_253.1.bb} |  0
 meta/recipes-core/systemd/systemd.inc         |  8 ++--
 ...-string.c-define-wchar_t-from-__WCHA.patch | 40 ++++++++++++++++++
 .../systemd/systemd/fix-32bit.patch           | 41 +++++++++++++++++++
 .../{systemd_252.5.bb => systemd_253.1.bb}    |  2 +
 5 files changed, 88 insertions(+), 3 deletions(-)
 rename meta/recipes-core/systemd/{systemd-boot_252.5.bb => systemd-boot_253.1.bb} (100%)
 create mode 100644 meta/recipes-core/systemd/systemd/0004-src-boot-efi-efi-string.c-define-wchar_t-from-__WCHA.patch
 create mode 100644 meta/recipes-core/systemd/systemd/fix-32bit.patch
 rename meta/recipes-core/systemd/{systemd_252.5.bb => systemd_253.1.bb} (99%)
diff mbox series

Patch

diff --git a/meta/recipes-core/systemd/systemd-boot_252.5.bb b/meta/recipes-core/systemd/systemd-boot_253.1.bb
similarity index 100%
rename from meta/recipes-core/systemd/systemd-boot_252.5.bb
rename to meta/recipes-core/systemd/systemd-boot_253.1.bb
diff --git a/meta/recipes-core/systemd/systemd.inc b/meta/recipes-core/systemd/systemd.inc
index df27e01b1c..354cc46e90 100644
--- a/meta/recipes-core/systemd/systemd.inc
+++ b/meta/recipes-core/systemd/systemd.inc
@@ -14,9 +14,11 @@  LICENSE = "GPL-2.0-only & LGPL-2.1-only"
 LIC_FILES_CHKSUM = "file://LICENSE.GPL2;md5=751419260aa954499f7abaabaa882bbe \
                     file://LICENSE.LGPL2.1;md5=4fbd65380cdd255951079008b364516c"
 
-SRCREV = "61f5710d0bfd8f522af6f8eef399a851509946e2"
-SRCBRANCH = "v252-stable"
+SRCREV = "6c327d74aa0d350482e82a247d7018559699798d"
+SRCBRANCH = "v253-stable"
 SRC_URI = "git://github.com/systemd/systemd-stable.git;protocol=https;branch=${SRCBRANCH} \
-"
+           file://0004-src-boot-efi-efi-string.c-define-wchar_t-from-__WCHA.patch \
+           file://fix-32bit.patch \
+           "
 
 S = "${WORKDIR}/git"
diff --git a/meta/recipes-core/systemd/systemd/0004-src-boot-efi-efi-string.c-define-wchar_t-from-__WCHA.patch b/meta/recipes-core/systemd/systemd/0004-src-boot-efi-efi-string.c-define-wchar_t-from-__WCHA.patch
new file mode 100644
index 0000000000..927f914848
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0004-src-boot-efi-efi-string.c-define-wchar_t-from-__WCHA.patch
@@ -0,0 +1,40 @@ 
+From a4ff7772acf1d983921833aa20ccd7c4d5e59a1c Mon Sep 17 00:00:00 2001
+From: Alexander Kanavin <alex@linutronix.de>
+Date: Mon, 6 Mar 2023 15:24:49 +0100
+Subject: [PATCH] src/boot/efi/efi-string.c: define wchar_t from __WCHAR_TYPE__
+
+systemd-boot relies on wchar_t being 16 bit, and breaks at build time otherwise.
+
+To set wchar_t to 16 bit it is passing -fshort-wchar to gcc; this has the
+desired effect on glibc (which sets wchar_t from __WCHAR_TYPE__) but not on
+musl (which hardcodes it to 32 bit).
+
+This patch ensures wchar_t is set from the compiler flags on all systems; note
+that systemd-boot is not actually using functions from musl or other libc, just their headers.
+
+Meanwhile upstream has refactored the code to not rely on libc headers at all;
+however this will not be backported to v253 and we need a different fix.
+
+Upstream-Status: Inappropriate [fixed differently in trunk according to https://github.com/systemd/systemd/pull/26689]
+Signed-off-by: Alexander Kanavin <alex@linutronix.de>
+---
+ src/boot/efi/efi-string.c | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/src/boot/efi/efi-string.c b/src/boot/efi/efi-string.c
+index 22923d60f6..22a8d1ef71 100644
+--- a/src/boot/efi/efi-string.c
++++ b/src/boot/efi/efi-string.c
+@@ -2,7 +2,12 @@
+ 
+ #include <stdbool.h>
+ #include <stdint.h>
++
++#if SD_BOOT
++typedef __WCHAR_TYPE__ wchar_t;
++#else
+ #include <wchar.h>
++#endif
+ 
+ #include "efi-string.h"
+ 
diff --git a/meta/recipes-core/systemd/systemd/fix-32bit.patch b/meta/recipes-core/systemd/systemd/fix-32bit.patch
new file mode 100644
index 0000000000..6b614625c8
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/fix-32bit.patch
@@ -0,0 +1,41 @@ 
+From c63bfd0884cf20e48befbee49d41f667660a8802 Mon Sep 17 00:00:00 2001
+From: Frantisek Sumsal <frantisek@sumsal.cz>
+Date: Fri, 3 Mar 2023 12:17:27 +0100
+Subject: [PATCH] systemctl: explicitly cast the constants to uint64_t
+
+Otherwise under certain conditions `va_arg()` might get garbage instead
+of the expected value, i.e.:
+
+$ sudo build-o0/systemctl disable asdfasfaf
+sd_bus_message_appendv: Got uint64_t: 0
+Failed to disable unit: Unit file asdfasfaf.service does not exist.
+
+$ sudo build-o1/systemctl disable asdfasfaf
+sd_bus_message_appendv: Got uint64_t: 7954875719681572864
+Failed to disable unit: Invalid argument
+
+(reproduced on an armv7hl machine)
+
+Resolves: #26568
+Follow-up to: bf1bea43f15
+Related issue: https://github.com/systemd/systemd/pull/14470#discussion_r362893735
+
+Upstream-Status: Backport [https://github.com/systemd/systemd/commit/c63bfd0884cf20e48befbee49d41f667660a8802]
+Signed-off-by: Alexander Kanavin <alex@linutronix.de>
+---
+ src/systemctl/systemctl-enable.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/systemctl/systemctl-enable.c b/src/systemctl/systemctl-enable.c
+index 4ebe5888ac69..a9c6f3a742c9 100644
+--- a/src/systemctl/systemctl-enable.c
++++ b/src/systemctl/systemctl-enable.c
+@@ -211,7 +211,7 @@ int verb_enable(int argc, char *argv[], void *userdata) {
+ 
+                 if (send_runtime) {
+                         if (streq(method, "DisableUnitFilesWithFlagsAndInstallInfo"))
+-                                r = sd_bus_message_append(m, "t", arg_runtime ? UNIT_FILE_RUNTIME : 0);
++                                r = sd_bus_message_append(m, "t", arg_runtime ? (uint64_t) UNIT_FILE_RUNTIME : UINT64_C(0));
+                         else
+                                 r = sd_bus_message_append(m, "b", arg_runtime);
+                         if (r < 0)
diff --git a/meta/recipes-core/systemd/systemd_252.5.bb b/meta/recipes-core/systemd/systemd_253.1.bb
similarity index 99%
rename from meta/recipes-core/systemd/systemd_252.5.bb
rename to meta/recipes-core/systemd/systemd_253.1.bb
index 8b92b2cf42..40a8226b2b 100644
--- a/meta/recipes-core/systemd/systemd_252.5.bb
+++ b/meta/recipes-core/systemd/systemd_253.1.bb
@@ -57,6 +57,7 @@  PAM_PLUGINS = " \
     pam-plugin-unix \
     pam-plugin-loginuid \
     pam-plugin-keyinit \
+    pam-plugin-namespace \
 "
 
 PACKAGECONFIG ??= " \
@@ -715,6 +716,7 @@  FILES:udev += "${base_sbindir}/udevd \
                ${rootlibexecdir}/udev/rules.d/60-drm.rules \
                ${rootlibexecdir}/udev/rules.d/60-evdev.rules \
                ${rootlibexecdir}/udev/rules.d/60-fido-id.rules \
+               ${rootlibexecdir}/udev/rules.d/60-infiniband.rules \
                ${rootlibexecdir}/udev/rules.d/60-input-id.rules \
                ${rootlibexecdir}/udev/rules.d/60-persistent-alsa.rules \
                ${rootlibexecdir}/udev/rules.d/60-persistent-input.rules \