Compare commits

...

9 Commits

Author SHA1 Message Date
Andrea Bolognani
399b1b7b95 Increase test timeout on riscv64
Builds fail otherwise because the hardware that's currently
available is not quite fast enough to keep up.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
(cherry picked from commit fe93b3eb93c8a71aec610a8655062ec4d9b1e162)
Signed-off-by: David Abdurachmanov <davidlt@rivosinc.com>
2024-11-23 21:05:14 +02:00
c23fb767de
Fix riscv files
[..]
RPM build errors:
error: File not found: /builddir/build/BUILDROOT/qemu-8.1.0-2.fc38.riscv64/usr/lib/binfmt.d/qemu-riscv32-static.conf

Signed-off-by: David Abdurachmanov <davidlt@rivosinc.com>
2024-11-23 21:02:05 +02:00
Cole Robinson
6f445dfae2 Update to qemu 9.1.2 stable
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2024-11-21 19:59:50 -05:00
Cole Robinson
9892915446 Fix spice audio regression with qemu 9.1.1
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2024-11-05 11:05:04 -05:00
Cole Robinson
1cf373a4c7 Rebase to qemu 9.1.1 stable
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2024-10-24 13:46:25 -04:00
Daniel P. Berrangé
d107e5d770 Bump release & add changelog for last two fixes
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2024-10-24 14:56:21 +01:00
Michael Vogt
7dd24cb759 spec: cherry pick openat2 qemu-user support from usptream 9651cea
This commit adds support for the openat2 syscall to qemu-user. It
is done via cherry picking upstream 9651cea and adding a extra
commit with a bunch of `#ifdef TARGET_NR_openat2` so that this
commit compiles on the `cris-linux-user` target which does not
have this syscall. Cris is removed in upstream qemu after v9.1.0
so the ifdefs were not needed there but are needed here until
cris is also removed from the RPM.
2024-10-24 08:16:28 +01:00
Daniel P. Berrangé
1695d38631 Fix compat with new glibc
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2024-10-23 11:47:03 +01:00
Richard W.M. Jones
8546176074 Replace qemu --blacklist option with -b (related: RHBZ#2258100) 2024-09-16 13:05:38 +01:00
8 changed files with 599 additions and 8 deletions

View File

@ -0,0 +1,50 @@
From c867f21d7f49830e9243ef5bff35e45face18a49 Mon Sep 17 00:00:00 2001
Message-ID: <c867f21d7f49830e9243ef5bff35e45face18a49.1730821961.git.crobinso@redhat.com>
From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= <marcandre.lureau@redhat.com>
Date: Tue, 5 Nov 2024 12:32:03 +0400
Subject: [PATCH] hw/audio/hda: avoid unnecessary re-open stream on
reconfiguration
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Content-type: text/plain
Closing and opening a stream too quickly during reconfiguration create
issues with Spice.
Note: the issue with Spice has been there before and still is. When the
audio stream is recreated, for example when using
`out.mixing-engine=false`.
Fixes: https://gitlab.com/qemu-project/qemu/-/issues/2639
Fixes: 6d6e23361f ("hw/audio/hda: fix memory leak on audio setup")
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
---
hw/audio/hda-codec.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/hw/audio/hda-codec.c b/hw/audio/hda-codec.c
index 4373565371..b3075b5d44 100644
--- a/hw/audio/hda-codec.c
+++ b/hw/audio/hda-codec.c
@@ -502,7 +502,15 @@ static void hda_audio_setup(HDAAudioStream *st)
trace_hda_audio_format(st->node->name, st->as.nchannels,
fmt2name[st->as.fmt], st->as.freq);
- hda_close_stream(st->state, st);
+ /*
+ * Do not hda_close_stream(st->state, st), AUD_open_() handles the logic for
+ * fixed_settings, and same format. This helps prevent race issues in Spice
+ * server & client code too. (see #2639)
+ */
+ if (use_timer) {
+ timer_free(st->buft);
+ st->buft = NULL;
+ }
if (st->output) {
if (use_timer) {
cb = hda_audio_output_cb;
--
2.46.2

View File

@ -0,0 +1,228 @@
From 9651cead2f1bb34b9b72f9c2c5dc81baea2b082e Mon Sep 17 00:00:00 2001
From: Michael Vogt <mvogt@redhat.com>
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 <mvogt@redhat.com>
Buglink: https://github.com/osbuild/bootc-image-builder/issues/619
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-ID: <1c2c8c9db3731ed4c6fd9b10c63637c3e4caf8f5.1727795334.git.mvogt@redhat.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
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

View File

@ -0,0 +1,85 @@
From b5aa46fc7bb03877bbea711903e19ad4e27e8259 Mon Sep 17 00:00:00 2001
From: Michael Vogt <michael.vogt@gmail.com>
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

View File

@ -3,7 +3,7 @@
# Comma-separated blacklist of RPCs to disable, or empty list to enable all.
#
# You can get the list of RPC commands using "qemu-ga --blacklist='?'".
# 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

View File

@ -10,7 +10,7 @@ EnvironmentFile=/etc/sysconfig/qemu-ga
ExecStart=/usr/bin/qemu-ga \
--method=virtio-serial \
--path=/dev/virtio-ports/org.qemu.guest_agent.0 \
--blacklist=${BLACKLIST_RPC} \
-b ${BLACKLIST_RPC} \
-F${FSFREEZE_HOOK_PATHNAME}
Restart=always
RestartSec=0

View File

@ -371,8 +371,8 @@ Obsoletes: sgabios-bin <= 1:0.20180715git-10.fc38
Summary: QEMU is a FAST! processor emulator
Name: qemu
Version: 9.1.0
Release: %{baserelease}%{?rcrel}%{?dist}
Version: 9.1.2
Release: %{baserelease}%{?rcrel}.0.riscv64%{?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
URL: http://www.qemu.org/
@ -404,6 +404,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}
@ -2126,6 +2134,14 @@ rm -rf %{static_buildroot}
# tests have been flakey in the past
export MTESTARGS="--no-suite block"
# Most architectures can use the default timeouts, but in some cases
# the hardware that's currently available is too slow and we need to
# allow tests to run for a little bit longer
%define timeout_multiplier 1
%ifarch riscv64
%define timeout_multiplier 2
%endif
%if %{with check}
%if !%{tools_only}
@ -2135,7 +2151,7 @@ echo "Testing %{name}-build"
# Last check: 2023-10
# Added: 2022-06
%ifnarch %{power64}
%make_build check
%make_build check TIMEOUT_MULTIPLIER=%{timeout_multiplier}
%endif
popd
@ -2808,8 +2824,8 @@ useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin \
%{_datadir}/systemtap/tapset/qemu-riscv64-log-static.stp
%{_datadir}/systemtap/tapset/qemu-riscv64-simpletrace-static.stp
%{_datadir}/systemtap/tapset/qemu-riscv64-static.stp
%{_exec_prefix}/lib/binfmt.d/qemu-riscv32-static.conf
%ifnarch riscv64
%{_exec_prefix}/lib/binfmt.d/qemu-riscv32-static.conf
%{_exec_prefix}/lib/binfmt.d/qemu-riscv64-static.conf
%endif
@ -3150,6 +3166,26 @@ useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin \
%changelog
* Sat Nov 23 2024 David Abdurachmanov <davidlt@rivosinc.com> - 9.1.2-1.0.riscv64
- Fix riscv files
- Increase test timeout on riscv64
* Thu Nov 21 2024 Cole Robinson <crobinso@redhat.com> - 9.1.2-1
- Update to qemu 9.1.2 stable
* Tue Nov 05 2024 Cole Robinson <crobinso@redhat.com> - 9.1.1-2
- Fix spice audio regression with qemu 9.1.1
* Thu Oct 24 2024 Cole Robinson <crobinso@redhat.com> - 9.1.1-1
- Rebase to qemu 9.1.1 stable
* Thu Oct 24 2024 Daniel P. Berrangé <berrange@redhat.com> - 9.1.0-3
- Add openat2 support to linux-user
- Fix compat with new glibc for 'struct sched_attr'
* Mon Sep 16 2024 Richard W.M. Jones <rjones@redhat.com> - 2:9.1.0-2
- Replace qemu --blacklist option with -b (related: RHBZ#2258100)
* Thu Sep 05 2024 Cole Robinson <crobinso@redhat.com> - 9.1.0-1
- New release qemu 9.1.0 GA

192
schedattr.patch Normal file
View File

@ -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: <qemu-devel-bounces+berrange=redhat.com@nongnu.org>
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 <berrange@gapps.redhat.com>
(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 <berrange@gapps.redhat.com>; 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 <berrange@redhat.com>; 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 <berrange@redhat.com>; 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 <qemu-devel-bounces@nongnu.org>)
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 <raj.khem@gmail.com>)
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 <raj.khem@gmail.com>)
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 <qemu-devel@nongnu.org>; 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 <raj.khem@gmail.com>
To: qemu-devel@nongnu.org
Cc: Khem Raj <raj.khem@gmail.com>, Laurent Vivier <laurent@vivier.eu>,
Paolo Bonzini <pbonzini@redhat.com>
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: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
<mailto:qemu-devel-request@nongnu.org?subject=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 <raj.khem@gmail.com>
Cc: Laurent Vivier <laurent@vivier.eu>
Cc: Paolo Bonzini <pbonzini@redhat.com>
---
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);

View File

@ -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.2.tar.xz) = ff6ed9bc784f1aa7cf06604d0e38e26ebb2685885893a2cb7d044297f26d7efd0fa6cbb034dc1c422b58504ca1081b46ffe00dd8f9fab928cafa8cfc0d7d1747
SHA512 (qemu-9.1.2.tar.xz.sig) = c4c88b9c4260b6614160eb8846d8a0374d5ac3553296a6e181c604926bb5f216b38c0fb313243643aa903cb05851b406314a25989af85022b499d5d02880eec3