commit: 1fb826f0cd2139453847606d170b5dbaf5886ef1 Author: Mike Gilbert <floppym <AT> gentoo <DOT> org> AuthorDate: Tue Jan 20 18:51:31 2026 +0000 Commit: Mike Gilbert <floppym <AT> gentoo <DOT> org> CommitDate: Tue Jan 20 18:51:31 2026 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1fb826f0
sys-apps/systemd: backport fix for s390 Closes: https://bugs.gentoo.org/968936 Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org> .../systemd-259-vmspawn-use-indexed-loop.patch | 71 ++++++++++++++++++++++ sys-apps/systemd/systemd-259.ebuild | 1 + 2 files changed, 72 insertions(+) diff --git a/sys-apps/systemd/files/systemd-259-vmspawn-use-indexed-loop.patch b/sys-apps/systemd/files/systemd-259-vmspawn-use-indexed-loop.patch new file mode 100644 index 000000000000..72f2cff07851 --- /dev/null +++ b/sys-apps/systemd/files/systemd-259-vmspawn-use-indexed-loop.patch @@ -0,0 +1,71 @@ +https://bugs.gentoo.org/968936 +https://github.com/systemd/systemd/issues/40380 + +From 8a5fb3627a1518d2d2ef70919c81448158d64ac0 Mon Sep 17 00:00:00 2001 +From: Yu Watanabe <[email protected]> +Date: Mon, 19 Jan 2026 23:14:26 +0900 +Subject: [PATCH] vmspawn: use indexed loop + +Previously, the index is obtained from the pointer offset. The +pointer offset is expressed by ptrdiff_t and may be different from +ssize_t. + +Let's avoid to use FOREACH_ARRAY() but use an indexed loop. +This also renames `mount` to `m` to avoid conflict with `mount()`. + +Fixes #40380. +--- + src/vmspawn/vmspawn.c | 15 ++++++++------- + 1 file changed, 8 insertions(+), 7 deletions(-) + +diff --git a/src/vmspawn/vmspawn.c b/src/vmspawn/vmspawn.c +index 43817954a3d22..b12e260fa4d1f 100644 +--- a/src/vmspawn/vmspawn.c ++++ b/src/vmspawn/vmspawn.c +@@ -2408,7 +2408,8 @@ static int run_virtual_machine(int kvm_device_fd, int vhost_device_fd) { + if (r < 0) + return log_oom(); + +- FOREACH_ARRAY(mount, arg_runtime_mounts.mounts, arg_runtime_mounts.n_mounts) { ++ for (size_t j = 0; j < arg_runtime_mounts.n_mounts; j++) { ++ RuntimeMount *m = arg_runtime_mounts.mounts + j; + _cleanup_free_ char *listen_address = NULL; + _cleanup_(fork_notify_terminate) PidRef child = PIDREF_NULL; + +@@ -2417,9 +2418,9 @@ static int run_virtual_machine(int kvm_device_fd, int vhost_device_fd) { + + r = start_virtiofsd( + unit, +- mount->source, +- /* source_uid= */ mount->source_uid, +- /* target_uid= */ mount->target_uid, ++ m->source, ++ /* source_uid= */ m->source_uid, ++ /* target_uid= */ m->target_uid, + /* uid_range= */ 1U, + runtime_dir, + sd_socket_activate, +@@ -2444,7 +2445,7 @@ static int run_virtual_machine(int kvm_device_fd, int vhost_device_fd) { + return log_oom(); + + _cleanup_free_ char *id = NULL; +- if (asprintf(&id, "mnt%zi", mount - arg_runtime_mounts.mounts) < 0) ++ if (asprintf(&id, "mnt%zu", j) < 0) + return log_oom(); + + if (strv_extendf(&cmdline, "socket,id=%s,path=%s", id, escaped_listen_address) < 0) +@@ -2456,12 +2457,12 @@ static int run_virtual_machine(int kvm_device_fd, int vhost_device_fd) { + if (strv_extendf(&cmdline, "vhost-user-fs-pci,queue-size=1024,chardev=%1$s,tag=%1$s", id) < 0) + return log_oom(); + +- _cleanup_free_ char *clean_target = xescape(mount->target, "\":"); ++ _cleanup_free_ char *clean_target = xescape(m->target, "\":"); + if (!clean_target) + return log_oom(); + + if (strv_extendf(&arg_kernel_cmdline_extra, "systemd.mount-extra=\"%s:%s:virtiofs:%s\"", +- id, clean_target, mount->read_only ? "ro" : "rw") < 0) ++ id, clean_target, m->read_only ? "ro" : "rw") < 0) + return log_oom(); + } + diff --git a/sys-apps/systemd/systemd-259.ebuild b/sys-apps/systemd/systemd-259.ebuild index f17ee9848ec5..3a92b0b88a0d 100644 --- a/sys-apps/systemd/systemd-259.ebuild +++ b/sys-apps/systemd/systemd-259.ebuild @@ -278,6 +278,7 @@ src_unpack() { src_prepare() { local PATCHES=( + "${FILESDIR}/systemd-259-vmspawn-use-indexed-loop.patch" ) if ! use vanilla; then
