diff --git a/0001-linux-user-add-openat2-support-in-linux-user.patch b/0001-linux-user-add-openat2-support-in-linux-user.patch new file mode 100644 index 0000000..ea4760a --- /dev/null +++ b/0001-linux-user-add-openat2-support-in-linux-user.patch @@ -0,0 +1,228 @@ +From 9651cead2f1bb34b9b72f9c2c5dc81baea2b082e Mon Sep 17 00:00:00 2001 +From: Michael Vogt +Date: Tue, 1 Oct 2024 17:14:53 +0200 +Subject: [PATCH] linux-user: add openat2 support in linux-user + +This commit adds support for the `openat2()` syscall in the +`linux-user` userspace emulator. + +It is implemented by extracting a new helper `maybe_do_fake_open()` +out of the exiting `do_guest_openat()` and share that with the +new `do_guest_openat2()`. Unfortunately we cannot just make +do_guest_openat2() a superset of do_guest_openat() because the +openat2() syscall is stricter with the argument checking and +will return an error for invalid flags or mode combinations (which +open()/openat() will ignore). + +The implementation is similar to SYSCALL_DEFINE(openat2), i.e. +a new `copy_struct_from_user()` is used that works the same +as the kernels version to support backwards-compatibility +for struct syscall argument. + +Instead of including openat2.h we create a copy of `open_how` +as `open_how_ver0` to ensure that if the structure grows we +can log a LOG_UNIMP warning. + +Note that in this commit using openat2() for a "faked" file in +/proc will honor the "resolve" flags for +RESOLVE_NO_{MAGIC,SYM}LINKS for path based access to /proc/self/exe +(which is the only magic link we support for faked files). +Note it will not catch special access via e.g. dirfd. This is not +great but it seems similar to the exiting behavior when openat() +is called with a dirfd to "/proc". Here too the fake file lookup +may not catch the special file because no dirfd is used to +determine if the path is in /proc. + +Signed-off-by: Michael Vogt +Buglink: https://github.com/osbuild/bootc-image-builder/issues/619 +Reviewed-by: Laurent Vivier +Message-ID: <1c2c8c9db3731ed4c6fd9b10c63637c3e4caf8f5.1727795334.git.mvogt@redhat.com> +Signed-off-by: Richard Henderson +--- + linux-user/syscall.c | 105 +++++++++++++++++++++++++++++++++++++- + linux-user/syscall_defs.h | 13 +++++ + 2 files changed, 116 insertions(+), 2 deletions(-) + +diff --git a/linux-user/syscall.c b/linux-user/syscall.c +index a666986189..2febc3bc3f 100644 +--- a/linux-user/syscall.c ++++ b/linux-user/syscall.c +@@ -602,6 +602,34 @@ static int check_zeroed_user(abi_long addr, size_t ksize, size_t usize) + return 1; + } + ++/* ++ * Copies a target struct to a host struct, in a way that guarantees ++ * backwards-compatibility for struct syscall arguments. ++ * ++ * Similar to kernels uaccess.h:copy_struct_from_user() ++ */ ++static int ++copy_struct_from_user(void *dst, size_t ksize, abi_ptr src, size_t usize) ++{ ++ size_t size = MIN(ksize, usize); ++ size_t rest = MAX(ksize, usize) - size; ++ ++ /* Deal with trailing bytes. */ ++ if (usize < ksize) { ++ memset(dst + size, 0, rest); ++ } else if (usize > ksize) { ++ int ret = check_zeroed_user(src, ksize, usize); ++ if (ret <= 0) { ++ return ret ?: -TARGET_E2BIG; ++ } ++ } ++ /* Copy the interoperable parts of the struct. */ ++ if (copy_from_user(dst, src, size)) { ++ return -TARGET_EFAULT; ++ } ++ return 0; ++} ++ + #define safe_syscall0(type, name) \ + static type safe_##name(void) \ + { \ +@@ -653,6 +681,15 @@ safe_syscall3(ssize_t, read, int, fd, void *, buff, size_t, count) + safe_syscall3(ssize_t, write, int, fd, const void *, buff, size_t, count) + safe_syscall4(int, openat, int, dirfd, const char *, pathname, \ + int, flags, mode_t, mode) ++ ++struct open_how_ver0 { ++ __u64 flags; ++ __u64 mode; ++ __u64 resolve; ++}; ++safe_syscall4(int, openat2, int, dirfd, const char *, pathname, \ ++ const struct open_how_ver0 *, how, size_t, size) ++ + #if defined(TARGET_NR_wait4) || defined(TARGET_NR_waitpid) + safe_syscall4(pid_t, wait4, pid_t, pid, int *, status, int, options, \ + struct rusage *, rusage) +@@ -8332,8 +8369,9 @@ static int open_net_route(CPUArchState *cpu_env, int fd) + } + #endif + +-int do_guest_openat(CPUArchState *cpu_env, int dirfd, const char *fname, +- int flags, mode_t mode, bool safe) ++static int maybe_do_fake_open(CPUArchState *cpu_env, int dirfd, ++ const char *fname, int flags, mode_t mode, ++ int openat2_resolve, bool safe) + { + g_autofree char *proc_name = NULL; + const char *pathname; +@@ -8370,6 +8408,12 @@ int do_guest_openat(CPUArchState *cpu_env, int dirfd, const char *fname, + } + + if (is_proc_myself(pathname, "exe")) { ++ /* Honor openat2 resolve flags */ ++ if ((openat2_resolve & RESOLVE_NO_MAGICLINKS) || ++ (openat2_resolve & RESOLVE_NO_SYMLINKS)) { ++ errno = ELOOP; ++ return -1; ++ } + if (safe) { + return safe_openat(dirfd, exec_path, flags, mode); + } else { +@@ -8416,6 +8460,17 @@ int do_guest_openat(CPUArchState *cpu_env, int dirfd, const char *fname, + return fd; + } + ++ return -2; ++} ++ ++int do_guest_openat(CPUArchState *cpu_env, int dirfd, const char *pathname, ++ int flags, mode_t mode, bool safe) ++{ ++ int fd = maybe_do_fake_open(cpu_env, dirfd, pathname, flags, mode, 0, safe); ++ if (fd > -2) { ++ return fd; ++ } ++ + if (safe) { + return safe_openat(dirfd, path(pathname), flags, mode); + } else { +@@ -8423,6 +8478,49 @@ int do_guest_openat(CPUArchState *cpu_env, int dirfd, const char *fname, + } + } + ++ ++static int do_openat2(CPUArchState *cpu_env, abi_long dirfd, ++ abi_ptr guest_pathname, abi_ptr guest_open_how, ++ abi_ulong guest_size) ++{ ++ struct open_how_ver0 how = {0}; ++ char *pathname; ++ int ret; ++ ++ if (guest_size < sizeof(struct target_open_how_ver0)) { ++ return -TARGET_EINVAL; ++ } ++ ret = copy_struct_from_user(&how, sizeof(how), guest_open_how, guest_size); ++ if (ret) { ++ if (ret == -TARGET_E2BIG) { ++ qemu_log_mask(LOG_UNIMP, ++ "Unimplemented openat2 open_how size: " ++ TARGET_ABI_FMT_lu "\n", guest_size); ++ } ++ return ret; ++ } ++ pathname = lock_user_string(guest_pathname); ++ if (!pathname) { ++ return -TARGET_EFAULT; ++ } ++ ++ how.flags = target_to_host_bitmask(tswap64(how.flags), fcntl_flags_tbl); ++ how.mode = tswap64(how.mode); ++ how.resolve = tswap64(how.resolve); ++ int fd = maybe_do_fake_open(cpu_env, dirfd, pathname, how.flags, how.mode, ++ how.resolve, true); ++ if (fd > -2) { ++ ret = get_errno(fd); ++ } else { ++ ret = get_errno(safe_openat2(dirfd, pathname, &how, ++ sizeof(struct open_how_ver0))); ++ } ++ ++ fd_trans_unregister(ret); ++ unlock_user(pathname, guest_pathname, 0); ++ return ret; ++} ++ + ssize_t do_guest_readlink(const char *pathname, char *buf, size_t bufsiz) + { + ssize_t ret; +@@ -9195,6 +9293,9 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1, + fd_trans_unregister(ret); + unlock_user(p, arg2, 0); + return ret; ++ case TARGET_NR_openat2: ++ ret = do_openat2(cpu_env, arg1, arg2, arg3, arg4); ++ return ret; + #if defined(TARGET_NR_name_to_handle_at) && defined(CONFIG_OPEN_BY_HANDLE) + case TARGET_NR_name_to_handle_at: + ret = do_name_to_handle_at(arg1, arg2, arg3, arg4, arg5); +diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h +index e08d088740..de5091c977 100644 +--- a/linux-user/syscall_defs.h ++++ b/linux-user/syscall_defs.h +@@ -2748,4 +2748,17 @@ struct target_sched_param { + abi_int sched_priority; + }; + ++/* from kernel's include/uapi/linux/openat2.h */ ++struct target_open_how_ver0 { ++ abi_ullong flags; ++ abi_ullong mode; ++ abi_ullong resolve; ++}; ++#ifndef RESOLVE_NO_MAGICLINKS ++#define RESOLVE_NO_MAGICLINKS 0x02 ++#endif ++#ifndef RESOLVE_NO_SYMLINKS ++#define RESOLVE_NO_SYMLINKS 0x04 ++#endif ++ + #endif +-- +2.47.0 + diff --git a/0001-linux-user-guard-openat2-with-if-defined-TARGET_NR_o.patch b/0001-linux-user-guard-openat2-with-if-defined-TARGET_NR_o.patch new file mode 100644 index 0000000..83d159e --- /dev/null +++ b/0001-linux-user-guard-openat2-with-if-defined-TARGET_NR_o.patch @@ -0,0 +1,85 @@ +From b5aa46fc7bb03877bbea711903e19ad4e27e8259 Mon Sep 17 00:00:00 2001 +From: Michael Vogt +Date: Wed, 23 Oct 2024 09:50:56 +0200 +Subject: [PATCH] linux-user: guard openat2 with `#if + defined(TARGET_NR_openat2)` + +This commit adds a bunch of `#ifdef` around the openat2 support. +We need this to build the `cris-linux-user` target which is still +present in this version but got dropped from upstream in commit +44e4075bf4 but is still present in v9.1.0. + +This patch can be dropped once cris is also removed from the +package. +--- + linux-user/syscall.c | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) + +diff --git a/linux-user/syscall.c b/linux-user/syscall.c +index 85d61db546..22e5ad3c5f 100644 +--- a/linux-user/syscall.c ++++ b/linux-user/syscall.c +@@ -608,6 +608,7 @@ static int check_zeroed_user(abi_long addr, size_t ksize, size_t usize) + * + * Similar to kernels uaccess.h:copy_struct_from_user() + */ ++#if defined(TARGET_NR_openat2) + static int + copy_struct_from_user(void *dst, size_t ksize, abi_ptr src, size_t usize) + { +@@ -629,6 +630,7 @@ copy_struct_from_user(void *dst, size_t ksize, abi_ptr src, size_t usize) + } + return 0; + } ++#endif + + #define safe_syscall0(type, name) \ + static type safe_##name(void) \ +@@ -682,6 +684,7 @@ safe_syscall3(ssize_t, write, int, fd, const void *, buff, size_t, count) + safe_syscall4(int, openat, int, dirfd, const char *, pathname, \ + int, flags, mode_t, mode) + ++#if defined(TARGET_NR_openat2) + struct open_how_ver0 { + __u64 flags; + __u64 mode; +@@ -689,6 +692,7 @@ struct open_how_ver0 { + }; + safe_syscall4(int, openat2, int, dirfd, const char *, pathname, \ + const struct open_how_ver0 *, how, size_t, size) ++#endif + + #if defined(TARGET_NR_wait4) || defined(TARGET_NR_waitpid) + safe_syscall4(pid_t, wait4, pid_t, pid, int *, status, int, options, \ +@@ -8480,7 +8484,7 @@ int do_guest_openat(CPUArchState *cpu_env, int dirfd, const char *pathname, + } + } + +- ++#if defined(TARGET_NR_openat2) + static int do_openat2(CPUArchState *cpu_env, abi_long dirfd, + abi_ptr guest_pathname, abi_ptr guest_open_how, + abi_ulong guest_size) +@@ -8522,6 +8526,7 @@ static int do_openat2(CPUArchState *cpu_env, abi_long dirfd, + unlock_user(pathname, guest_pathname, 0); + return ret; + } ++#endif + + ssize_t do_guest_readlink(const char *pathname, char *buf, size_t bufsiz) + { +@@ -9295,9 +9300,11 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1, + fd_trans_unregister(ret); + unlock_user(p, arg2, 0); + return ret; ++#if defined(TARGET_NR_openat2) + case TARGET_NR_openat2: + ret = do_openat2(cpu_env, arg1, arg2, arg3, arg4); + return ret; ++#endif + #if defined(TARGET_NR_name_to_handle_at) && defined(CONFIG_OPEN_BY_HANDLE) + case TARGET_NR_name_to_handle_at: + ret = do_name_to_handle_at(arg1, arg2, arg3, arg4, arg5); +-- +2.47.0 + diff --git a/0006-change_kvm_readonly_mem_allowed_check_for_AMD_SEV_SNP.patch b/0006-change_kvm_readonly_mem_allowed_check_for_AMD_SEV_SNP.patch new file mode 100644 index 0000000..e2637d8 --- /dev/null +++ b/0006-change_kvm_readonly_mem_allowed_check_for_AMD_SEV_SNP.patch @@ -0,0 +1,40 @@ +From: Roberto Campesato +diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c +index bcd2094944..8f6318aa3d 100644 +--- a/accel/kvm/kvm-all.c ++++ b/accel/kvm/kvm-all.c +@@ -2461,12 +2461,6 @@ static int kvm_init(MachineState *ms) + s->nr_slots = 32; + } + +- s->nr_as = kvm_check_extension(s, KVM_CAP_MULTI_ADDRESS_SPACE); +- if (s->nr_as <= 1) { +- s->nr_as = 1; +- } +- s->as = g_new0(struct KVMAs, s->nr_as); +- + if (object_property_find(OBJECT(current_machine), "kvm-type")) { + g_autofree char *kvm_type = object_property_get_str(OBJECT(current_machine), + "kvm-type", +@@ -2515,6 +2509,12 @@ static int kvm_init(MachineState *ms) + + s->vmfd = ret; + ++ s->nr_as = kvm_vm_check_extension(s, KVM_CAP_MULTI_ADDRESS_SPACE); ++ if (s->nr_as <= 1) { ++ s->nr_as = 1; ++ } ++ s->as = g_new0(struct KVMAs, s->nr_as); ++ + /* check the vcpu limits */ + soft_vcpus_limit = kvm_recommended_vcpus(s); + hard_vcpus_limit = kvm_max_vcpus(s); +@@ -2603,7 +2603,7 @@ static int kvm_init(MachineState *ms) + } + + kvm_readonly_mem_allowed = +- (kvm_check_extension(s, KVM_CAP_READONLY_MEM) > 0); ++ (kvm_vm_check_extension(s, KVM_CAP_READONLY_MEM) > 0); + + kvm_resamplefds_allowed = + (kvm_check_extension(s, KVM_CAP_IRQFD_RESAMPLE) > 0); diff --git a/qemu-ga.sysconfig b/qemu-ga.sysconfig index aea1ccb..5b2b3b4 100644 --- a/qemu-ga.sysconfig +++ b/qemu-ga.sysconfig @@ -1,11 +1,12 @@ # This is a systemd environment file, not a shell script. # It provides settings for "/lib/systemd/system/qemu-guest-agent.service". -# Comma-separated blacklist of RPCs to disable, or empty list to enable all. +# Extra arguments to pass to the guest QEMU, for example, to filter our +# RPC commands. See 'qemu-ga(8)' man page for permissible arguments. # -# You can get the list of RPC commands using "qemu-ga -b '?'". -# There should be no spaces between commas and commands in the blacklist. -#BLACKLIST_RPC=guest-file-open,guest-file-close,guest-file-read,guest-file-write,guest-file-seek,guest-file-flush,guest-exec,guest-exec-status +# For example, to filter out a set of commands the --block-rpcs commands: +# +#QEMU_GA_ARGS=--block-rpcs=guest-file-open,guest-file-close,guest-file-read,guest-file-write,guest-file-seek,guest-file-flush,guest-exec,guest-exec-status # Fsfreeze hook script specification. # diff --git a/qemu-guest-agent.service b/qemu-guest-agent.service index 0d89bb2..6734f7e 100644 --- a/qemu-guest-agent.service +++ b/qemu-guest-agent.service @@ -7,11 +7,13 @@ IgnoreOnIsolate=True [Service] UMask=0077 EnvironmentFile=/etc/sysconfig/qemu-ga +# Support upgrades from QEMU < 9.1 +ExecStartPre=/bin/sh -c "if grep '^BLACKLIST_RPC' /etc/sysconfig/qemu-ga >/dev/null ; then sed -i 's/^BLACKLIST_RPC=/QEMU_GA_ARGS=--block-rpcs=/' /etc/sysconfig/qemu-ga ; fi" ExecStart=/usr/bin/qemu-ga \ --method=virtio-serial \ --path=/dev/virtio-ports/org.qemu.guest_agent.0 \ - -b ${BLACKLIST_RPC} \ - -F${FSFREEZE_HOOK_PATHNAME} + -F${FSFREEZE_HOOK_PATHNAME} \ + $QEMU_GA_ARGS Restart=always RestartSec=0 diff --git a/qemu.spec b/qemu.spec index c9a0c69..67bc81d 100644 --- a/qemu.spec +++ b/qemu.spec @@ -365,17 +365,33 @@ Obsoletes: sgabios-bin <= 1:0.20180715git-10.fc38 %endif # To prevent rpmdev-bumpspec breakage -%global baserelease 2 +%global baserelease 1 # Hyperscale release %global hsrel .1 Summary: QEMU is a FAST! processor emulator Name: qemu -Version: 9.1.0 +Version: 9.1.1 Release: %{baserelease}%{?rcrel}%{?hsrel}%{?dist} Epoch: 2 -License: Apache-2.0 AND BSD-2-Clause AND BSD-3-Clause AND FSFAP AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-2.0-or-later WITH GCC-exception-2.0 AND LGPL-2.0-only AND LGPL-2.0-or-later AND LGPL-2.1-only AND LGPL-2.1-or-later AND MIT AND LicenseRef-Fedora-Public-Domain AND CC-BY-3.0 +License: %{shrink: + Apache-2.0 AND + BSD-2-Clause AND + BSD-3-Clause AND + FSFAP AND + GPL-1.0-or-later AND + GPL-2.0-only AND + GPL-2.0-or-later AND + GPL-2.0-or-later WITH GCC-exception-2.0 AND + LGPL-2.0-only AND + LGPL-2.0-or-later AND + LGPL-2.1-only AND + LGPL-2.1-or-later AND + MIT AND + LicenseRef-Fedora-Public-Domain AND + CC-BY-3.0 +} URL: http://www.qemu.org/ %global dlurl https://download.qemu.org @@ -406,9 +422,10 @@ Patch: 0003-linux-user-default-cpu-model.patch # will be reworked for potential upstreaming. Patch: 0004-BTRFS_V2_IOCTLS.patch -# Include experimental change based AMD patches for SEV/SNP to make PCI passthrough +# Include experimental changes based AMD patches for SEV/SNP to make PCI passthrough # work with SNP Patch: 0005-disable_ram_block_discard_for_pci_passthrough_on_AMD_SEV_SNP.patch +Patch: 0006-change_kvm_readonly_mem_allowed_check_for_AMD_SEV_SNP.patch %endif @@ -426,6 +443,14 @@ Source36: README.tests # Skip failing test in copr # https://gitlab.com/qemu-project/qemu/-/issues/2541 Patch: 0001-Disable-9p-local-tests-that-fail-on-copr-aarch64.patch +# Fix compat with new glibc (not upstream yet) +Patch: schedattr.patch + +# Openat2 support (upstream commit 9651cea) +Patch: 0001-linux-user-add-openat2-support-in-linux-user.patch +# linux-user-cris support for openat2, can be removed once "cris" is +# removed (after v9.1.0) +Patch: 0001-linux-user-guard-openat2-with-if-defined-TARGET_NR_o.patch BuildRequires: gnupg2 BuildRequires: meson >= %{meson_version} @@ -3172,6 +3197,22 @@ useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin \ %changelog +* Fri Oct 25 2024 Roberto Campesato - 9.1.1-1.1 +- Merge latest changes from Fedora +- Added fb-only patch based on experimental AMD changes for SEV/SNP + to make PCI passthrough work with SNP + +* Thu Oct 24 2024 Cole Robinson - 9.1.1-1 +- Rebase to qemu 9.1.1 stable + +* Thu Oct 24 2024 Daniel P. Berrangé - 9.1.0-4 +- Add openat2 support to linux-user +- Fix compat with new glibc for 'struct sched_attr' + +* Wed Oct 16 2024 Daniel P. Berrangé - 9.1.0-3 +- Replace BLACKLIST_RPC with QEMU_GA_ARGS in sysconfig file +- Related rhbz #2258100 + * Mon Oct 14 2024 Roberto Campesato - 2:9.1.0-2.1 - Merge latest changes from Fedora diff --git a/schedattr.patch b/schedattr.patch new file mode 100644 index 0000000..15adf3c --- /dev/null +++ b/schedattr.patch @@ -0,0 +1,192 @@ +From qemu-devel-bounces+berrange=redhat.com@nongnu.org Fri Oct 11 20:32:42 2024 +Delivered-To: berrange@gapps.redhat.com +Received: by 2002:a05:612c:fcb:b0:49e:3967:5c with SMTP id kg11csp620284vqb; + Fri, 11 Oct 2024 12:32:43 -0700 (PDT) +X-Forwarded-Encrypted: i=2; AJvYcCXPcgyQ0/+OIS7vrT6LX5S6B3Hgz9IoezpGzlHzuQ86lhsSq6u4TrVfGwET6WFesjl4msgGP886/Q==@gapps.redhat.com +X-Google-Smtp-Source: AGHT+IGI1MzgaHjMk041SIq3SzZGJRAF05keA8usOtLVfsqz+UnG8gS/7JH2MnqELZrotA/GJ+FI +X-Received: by 2002:a05:6870:530c:b0:277:e35a:d2d5 with SMTP id 586e51a60fabf-2886e0d7223mr2593115fac.47.1728675162879; + Fri, 11 Oct 2024 12:32:42 -0700 (PDT) +ARC-Seal: i=1; a=rsa-sha256; t=1728675162; cv=none; + d=google.com; s=arc-20240605; + b=alETPlokQysotchMz04b4QkeW4n7IaCvDHuYMZh698k8mF5RJMclj7AfzOWMyGXURw + kFfdMDxoHBlzWY9bTAGsH6EBkFDcJ9RyMs2Oy/exl09b3Zbt/LaW/PgqJZWi7DqZe7FD + Zo3bqW5OSwWxU/vpy6n8B4EV22uFeRNhdTlzj0nbU4h+YpUcUzXR++ssowqa367TMQ5s + THtVdddGT62AlbkeybdC/gTVxTt0RktEBMKTh+MzuZJ1rcgMb+pbG6h/XF5Iub2C+szk + EkyaW96aO1YTzalK4HCCL7cuCauVGvVShSjUfPFMqXRxvzVfFqn02zZh6C4AXb/a/gIT + YiXA== +ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; + h=content-transfer-encoding:sender:errors-to:list-subscribe:list-help + :list-post:list-archive:list-unsubscribe:list-id:precedence + :mime-version:message-id:date:subject:cc:to:from:delivered-to; + bh=PO9IbOEY2YqKRkyInUx1mFCEKdNyF6F1Ade1P8ET5cM=; + fh=xgCffyEVvm6hjKwQ8pT/suARWWrEEvCTAvMVKpBgaZg=; + b=Q4fnfvzilypAHQRG6QbhiDXJWTDiP8dnRA4CB3fnXjC3sGRa+4+abHQkdOy6pMW4T9 + HhCdtLquJqRIBSQNVEVZMN5bFDX+gIaEA6pmEbd8Sdi47dl2+VS7vP9dQWf/FOtrkGqg + D6K6DlbOdtzmdoTtWcI9Zm1eg6/98cVH2/hqzO/Ig1eI47UvIJpZtm3CMa3y5BgoJhmX + v1pxjLmbVwmOdo8YkXgT3bH5iAPwXjn8FU7q4Z+CX3XChIQksWGvkB+zR/d7xqsEEdTv + x85zJC/K4M9DAnuyJA2rIcrt/QUDHpdAPfcV2gDWr4IBhF27Ul9j6vjXzKNHaGjJxXbF + hFsw==; + dara=google.com +ARC-Authentication-Results: i=1; mx.google.com; + spf=pass (google.com: domain of qemu-devel-bounces+berrange=redhat.com@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+berrange=redhat.com@nongnu.org" +Return-Path: +Received: from us-smtp-inbound-delivery-1.mimecast.com (us-smtp-inbound-delivery-1.mimecast.com. [205.139.110.120]) + by mx.google.com with ESMTPS id af79cd13be357-7b114998ee3si449329885a.281.2024.10.11.12.32.42 + for + (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); + Fri, 11 Oct 2024 12:32:42 -0700 (PDT) +Received-SPF: pass (google.com: domain of qemu-devel-bounces+berrange=redhat.com@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; +Authentication-Results: mx.google.com; + spf=pass (google.com: domain of qemu-devel-bounces+berrange=redhat.com@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+berrange=redhat.com@nongnu.org" +Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com + (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by + relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, + cipher=TLS_AES_256_GCM_SHA384) id us-mta-14-mwcDIPw2Ma-2fc8EyJ2Anw-1; Fri, + 11 Oct 2024 15:32:41 -0400 +X-MC-Unique: mwcDIPw2Ma-2fc8EyJ2Anw-1 +Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) + (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) + key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) + (No client certificate requested) + by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id A96C819560AE + for ; Fri, 11 Oct 2024 19:32:40 +0000 (UTC) +Received: by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) + id A3F151956089; Fri, 11 Oct 2024 19:32:40 +0000 (UTC) +Delivered-To: berrange@redhat.com +Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.23]) + by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 9EAE41955F42 + for ; Fri, 11 Oct 2024 19:32:40 +0000 (UTC) +Received: from us-smtp-inbound-delivery-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) + (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) + key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) + (No client certificate requested) + by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 4A35819560B5 + for ; Fri, 11 Oct 2024 19:32:40 +0000 (UTC) +Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by + relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, + cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id + us-mta-656-VIioc_tgPx6dfe3wuTFP4A-1; Fri, 11 Oct 2024 15:32:38 -0400 +X-MC-Unique: VIioc_tgPx6dfe3wuTFP4A-1 +Received: from localhost ([::1] helo=lists1p.gnu.org) + by lists.gnu.org with esmtp (Exim 4.90_1) + (envelope-from ) + id 1szLMh-00020r-5j; Fri, 11 Oct 2024 15:31:55 -0400 +Received: from eggs.gnu.org ([2001:470:142:3::10]) + by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) + (Exim 4.90_1) (envelope-from ) + id 1szLMb-00020P-1q + for qemu-devel@nongnu.org; Fri, 11 Oct 2024 15:31:51 -0400 +Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]) + by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) + (Exim 4.90_1) (envelope-from ) + id 1szLMW-0003EY-RE + for qemu-devel@nongnu.org; Fri, 11 Oct 2024 15:31:46 -0400 +Received: by mail-pl1-x635.google.com with SMTP id + d9443c01a7336-20bb610be6aso25161715ad.1 + for ; Fri, 11 Oct 2024 12:31:44 -0700 (PDT) +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20230601; t=1728675103; x=1729279903; + h=content-transfer-encoding:mime-version:message-id:date:subject:cc + :to:from:x-gm-message-state:from:to:cc:subject:date:message-id + :reply-to; + bh=PO9IbOEY2YqKRkyInUx1mFCEKdNyF6F1Ade1P8ET5cM=; + b=K3X31NNuvHdknW5P8UcnhDjhiG8YvVt80acZ9o0cp4OYATGyivVrgqlV16YtlE7nbP + c2GxVasHb4XHOFgQ/OS9twOzcL7BvXjTYuSlqOjY9QQ9Ng38MAMFgLpleBdUdi0JHrfh + vH2pyWqiWlGfPiDmnJWawogp9bgGCHsqyjPUtcw1LCUqNNx0sfyV98mwYq27/2m4POny + BQ0yFM/O7SF2EkZuaQwCJWPmH3fQatSgwEAq5u1SGy/Tn9a9GB4Iyolqgm4mMJBiful/ + xoI0a2JEsYatNItIvqoWJ5uBgwrOZHldhxPZGCUP9cL5ecB1flcnPXHxLR4p0/kiQzuI + LzCw== +X-Gm-Message-State: AOJu0YxWyAwGwQqYK1sZdfMljusz9BkH4fhylN1UvHETC7GDQDWtfFQS + zz40Z5A7yrfIoS4SkMLM2xTSe57qyfKfFPHRVJe68kPHnsvbdEUpZAecLqJ/ +X-Received: by 2002:a17:902:d2c5:b0:20c:a644:817f with SMTP id + d9443c01a7336-20ca6448261mr49539675ad.7.1728675103070; + Fri, 11 Oct 2024 12:31:43 -0700 (PDT) +Received: from apollo.hsd1.ca.comcast.net ([2601:646:9d80:4380::f083]) + by smtp.gmail.com with ESMTPSA id + d9443c01a7336-20c8bc13551sm26871055ad.88.2024.10.11.12.31.42 + (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); + Fri, 11 Oct 2024 12:31:42 -0700 (PDT) +From: Khem Raj +To: qemu-devel@nongnu.org +Cc: Khem Raj , Laurent Vivier , + Paolo Bonzini +Subject: [PATCH v2] sched_attr: Do not define for glibc >= 2.41 +Date: Fri, 11 Oct 2024 12:31:40 -0700 +Message-ID: <20241011193140.1047648-1-raj.khem@gmail.com> +MIME-Version: 1.0 +X-Spam_score_int: -20 +X-Spam_score: -2.1 +X-Spam_bar: -- +X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, + DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, + RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, + SPF_PASS=-0.001 autolearn=ham autolearn_force=no +X-Spam_action: no action +X-BeenThere: qemu-devel@nongnu.org +X-Mailman-Version: 2.1.29 +Precedence: list +List-Id: +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +Errors-To: qemu-devel-bounces+berrange=redhat.com@nongnu.org +Sender: qemu-devel-bounces+berrange=redhat.com@nongnu.org +X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition;Similar Internal Domain=false;Similar Monitored External Domain=false;Custom External Domain=false;Mimecast External Domain=false;Newly Observed Domain=false;Internal User Name=false;Custom Display Name List=false;Reply-to Address Mismatch=false;Targeted Threat Dictionary=false;Mimecast Threat Dictionary=false;Custom Threat Dictionary=false +X-Mimecast-Bulk-Signature: yes +X-Mimecast-Spam-Signature: bulk +X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 +X-Mimecast-Spam-Score: 0 +X-Mimecast-Originator: gmail.com +Content-Transfer-Encoding: 8bit +Content-Type: text/plain; charset="US-ASCII"; x-default=true +Status: RO +Content-Length: 1578 +Lines: 42 + +glibc 2.41+ has added [1] definitions for sched_setattr and sched_getattr functions +and struct sched_attr. Therefore, it needs to be checked for here as well before +defining sched_attr + +Define sched_attr conditionally on SCHED_ATTR_SIZE_VER0 + +Fixes builds with glibc/trunk + +[1] https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=21571ca0d70302909cf72707b2a7736cf12190a0;hp=298bc488fdc047da37482f4003023cb9adef78f8 + +Signed-off-by: Khem Raj +Cc: Laurent Vivier +Cc: Paolo Bonzini +--- +v2: Use SCHED_ATTR_SIZE_VER0 instead of glibc version check + + linux-user/syscall.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/linux-user/syscall.c b/linux-user/syscall.c +index 1354e75694..caecbb765d 100644 +--- a/linux-user/syscall.c ++++ b/linux-user/syscall.c +@@ -359,7 +359,8 @@ _syscall3(int, sys_sched_getaffinity, pid_t, pid, unsigned int, len, + #define __NR_sys_sched_setaffinity __NR_sched_setaffinity + _syscall3(int, sys_sched_setaffinity, pid_t, pid, unsigned int, len, + unsigned long *, user_mask_ptr); +-/* sched_attr is not defined in glibc */ ++/* sched_attr is not defined in glibc < 2.41 */ ++#ifndef SCHED_ATTR_SIZE_VER0 + struct sched_attr { + uint32_t size; + uint32_t sched_policy; +@@ -372,6 +373,7 @@ struct sched_attr { + uint32_t sched_util_min; + uint32_t sched_util_max; + }; ++#endif + #define __NR_sys_sched_getattr __NR_sched_getattr + _syscall4(int, sys_sched_getattr, pid_t, pid, struct sched_attr *, attr, + unsigned int, size, unsigned int, flags); + + diff --git a/sources b/sources index 862f989..3d9bf5b 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ -SHA512 (qemu-9.1.0.tar.xz) = bf61d65e37945fa8ee8640712c719ace05164d86e6df700b98bdc5f79e0a8d5e8f85bd48e726edb62b2419db20673f63ec8b63a60393a914b09cb365621b35e2 -SHA512 (qemu-9.1.0.tar.xz.sig) = d63144ef6d666f9e107cefadebcf89ede67027303d8cc43217e8454133adb6e9740fcc5f8a29cc7e24f052d9e685c7fe361b6e094dd0d607a1ce9161f6ed3b59 +SHA512 (qemu-9.1.1.tar.xz) = cbf2e43d54eafe776dd8245a91ff3c28bbe6206b62205addb25b49ffaac79cefc49c9df082c28aedc17ffc4a67db6352fc7a97895887ccbbb1ce198981e242b4 +SHA512 (qemu-9.1.1.tar.xz.sig) = 54ae84bc7c3703c4d1cc163c8f5e6d7cf355e1a709552585b383394a89492693c745ef0c465cf193e7da35978d89cd7d2bfe7ed4032e5013ee93295f786ed1ed