From a84752c1af77add1d3442ea3cea076bf396b9e31e0df403749a0bb8725c22b45 Mon Sep 17 00:00:00 2001 From: Franck Bui Date: Thu, 16 Mar 2023 07:35:14 +0000 Subject: [PATCH] - Add 5002-systemctl-explicitly-cast-the-constants-to-uint64_t.patch (bsc#1209305) Added temporarily until it's merged in either the stable v253 branch or in the SUSE git repo. OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=1359 --- ...citly-cast-the-constants-to-uint64_t.patch | 46 +++++++++++++++++++ systemd.changes | 8 ++++ systemd.spec | 1 + 3 files changed, 55 insertions(+) create mode 100644 5002-systemctl-explicitly-cast-the-constants-to-uint64_t.patch diff --git a/5002-systemctl-explicitly-cast-the-constants-to-uint64_t.patch b/5002-systemctl-explicitly-cast-the-constants-to-uint64_t.patch new file mode 100644 index 00000000..b36b3f96 --- /dev/null +++ b/5002-systemctl-explicitly-cast-the-constants-to-uint64_t.patch @@ -0,0 +1,46 @@ +From 1d88ce4c9ca16b95d6c29d107f26265ffc7d4379 Mon Sep 17 00:00:00 2001 +From: Frantisek Sumsal +Date: Fri, 3 Mar 2023 12:17:27 +0100 +Subject: [PATCH 5002/5002] 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 + +(cherry picked from commit c63bfd0884cf20e48befbee49d41f667660a8802) + +[fbui: fixes bsc#1209305] +--- + 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 86d9f602fa..f94a286122 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) +-- +2.35.3 + diff --git a/systemd.changes b/systemd.changes index 34625468..10d34daa 100644 --- a/systemd.changes +++ b/systemd.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Thu Mar 16 07:33:21 UTC 2023 - Franck Bui + +- Add 5002-systemctl-explicitly-cast-the-constants-to-uint64_t.patch (bsc#1209305) + + Added temporarily until it's merged in either the stable v253 branch or in the + SUSE git repo. + ------------------------------------------------------------------- Thu Mar 16 07:29:24 UTC 2023 - Franck Bui diff --git a/systemd.spec b/systemd.spec index ed2af57e..a234cc12 100644 --- a/systemd.spec +++ b/systemd.spec @@ -214,6 +214,7 @@ Patch12: 0009-pid1-handle-console-specificities-weirdness-for-s390.patch # will be removed as soon as a proper fix will be merged by upstream. Patch5000: 5000-core-manager-run-generators-directly-when-we-are-in-.patch Patch5001: 5001-Revert-core-propagate-stop-too-if-restart-is-issued.patch +Patch5002: 5002-systemctl-explicitly-cast-the-constants-to-uint64_t.patch %description Systemd is a system and service manager, compatible with SysV and LSB