#6 Update to v9.1.1 for hyperscale release
Closed 19 days ago by render. Opened a month ago by render.

@@ -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

+ 

@@ -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

+ 

@@ -0,0 +1,31 @@ 

+ From: Roberto Campesato <render@metalabs.org>

+ diff --git a/crypto/tlscredsx509.c b/crypto/tlscredsx509.c

+ --- a/crypto/tlscredsx509.c

+ +++ b/crypto/tlscredsx509.c

+ @@ -502,14 +502,6 @@ qcrypto_tls_creds_x509_sanity_check(QCryptoTLSCredsX509 *creds,

+          goto cleanup;

+      }

+ 

+ -    for (i = 0; i < ncacerts; i++) {

+ -        if (qcrypto_tls_creds_check_cert(creds,

+ -                                         cacerts[i], cacertFile,

+ -                                         isServer, true, errp) < 0) {

+ -            goto cleanup;

+ -        }

+ -    }

+ -

+      if (cert && ncacerts &&

+          qcrypto_tls_creds_check_cert_pair(cert, certFile, cacerts,

+                                            ncacerts, cacertFile,

+ diff --git a/tests/unit/test-crypto-tlscredsx509.c b/tests/unit/test-crypto-tlscredsx509.c

+ --- a/tests/unit/test-crypto-tlscredsx509.c

+ +++ b/tests/unit/test-crypto-tlscredsx509.c

+ @@ -285,7 +285,7 @@ int main(int argc, char **argv)

+      TLS_TEST_REG(badca1, true, cacert4req.filename, servercert4req.filename,

+                   true);

+      TLS_TEST_REG(badca2, true,

+ -                 cacert5req.filename, servercert5req.filename, true);

+ +                 cacert5req.filename, servercert5req.filename, false);

+      TLS_TEST_REG(badca3, true,

+                   cacert6req.filename, servercert6req.filename, true);

+ 

@@ -0,0 +1,33 @@ 

+ From: Roberto Campesato <render@metalabs.org>

+ diff --git a/linux-user/main.c b/linux-user/main.c

+ index 0cdaf30d34..553faf1309 100644

+ --- a/linux-user/main.c

+ +++ b/linux-user/main.c

+ @@ -357,6 +357,10 @@ static void handle_arg_uname(const char *arg)

+ 

+  static void handle_arg_cpu(const char *arg)

+  {

+ +    if (cpu_model != NULL) {

+ +        free(cpu_model);

+ +        cpu_model = NULL;

+ +    }

+      cpu_model = strdup(arg);

+      if (cpu_model == NULL || is_help_option(cpu_model)) {

+          list_cpus();

+ @@ -717,7 +721,16 @@ int main(int argc, char **argv, char **envp)

+          }

+      }

+ 

+ +    /* This is a pretty disgusting hack, in place to get a default

+ +       CPU that has x86_64-v2 support, required for emulating a

+ +       CPU that CentOS 9 is happy to run on (via binfmt_misc).  */

+ +#if defined(TARGET_X86_64) && !defined(__x86_64__)

+ +    cpu_model = strdup("Nehalem-v1");

+ +#elif defined(TARGET_AARCH64) && !defined(__aarch64__)

+ +    cpu_model = strdup("cortex-a72");

+ +#else

+      cpu_model = NULL;

+ +#endif

+ 

+      qemu_add_opts(&qemu_trace_opts);

+      qemu_plugin_add_opts();

@@ -0,0 +1,123 @@ 

+ From: Roberto Campesato <render@metalabs.org>

+ diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h

+ --- a/linux-user/ioctls.h

+ +++ b/linux-user/ioctls.h

+ @@ -154,6 +154,10 @@

+       IOCTL(BTRFS_IOC_SNAP_CREATE, IOC_W,

+             MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_vol_args)))

+  #endif

+ +#ifdef BTRFS_IOC_SNAP_CREATE_V2

+ +     IOCTL(BTRFS_IOC_SNAP_CREATE_V2, IOC_W,

+ +           MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_vol_args_v2)))

+ +#endif

+  #ifdef BTRFS_IOC_SCAN_DEV

+       IOCTL(BTRFS_IOC_SCAN_DEV, IOC_W,

+             MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_vol_args)))

+ @@ -170,14 +174,26 @@

+       IOCTL(BTRFS_IOC_RM_DEV, IOC_W,

+             MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_vol_args)))

+  #endif

+ +#ifdef BTRFS_IOC_RM_DEV_V2

+ +     IOCTL(BTRFS_IOC_RM_DEV_V2, IOC_W,

+ +           MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_vol_args_v2)))

+ +#endif

+  #ifdef BTRFS_IOC_SUBVOL_CREATE

+       IOCTL(BTRFS_IOC_SUBVOL_CREATE, IOC_W,

+             MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_vol_args)))

+  #endif

+ +#ifdef BTRFS_IOC_SUBVOL_CREATE_V2

+ +     IOCTL(BTRFS_IOC_SUBVOL_CREATE_V2, IOC_W,

+ +           MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_vol_args_v2)))

+ +#endif

+  #ifdef BTRFS_IOC_SNAP_DESTROY

+       IOCTL(BTRFS_IOC_SNAP_DESTROY, IOC_W,

+             MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_vol_args)))

+  #endif

+ +#ifdef BTRFS_IOC_SNAP_DESTROY_V2

+ +     IOCTL(BTRFS_IOC_SNAP_DESTROY_V2, IOC_W,

+ +           MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_vol_args_v2)))

+ +#endif

+  #ifdef BTRFS_IOC_INO_LOOKUP

+       IOCTL(BTRFS_IOC_INO_LOOKUP, IOC_RW,

+             MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_ino_lookup_args)))

+ @@ -273,6 +289,10 @@

+       IOCTL(BTRFS_IOC_INO_LOOKUP_USER, IOC_RW,

+             MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_ino_lookup_user_args)))

+  #endif

+ +#ifdef BTRFS_IOC_TREE_SEARCH

+ +     IOCTL(BTRFS_IOC_TREE_SEARCH, IOC_RW,

+ +           MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_search_args)))

+ +#endif

+ 

+  #ifdef CONFIG_USBFS

+    /* USB ioctls */

+ diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h

+ --- a/linux-user/syscall_defs.h

+ +++ b/linux-user/syscall_defs.h

+ @@ -966,9 +966,12 @@

+  #define TARGET_BTRFS_IOC_RM_DEV                 TARGET_IOWU(BTRFS_IOCTL_MAGIC, 11)

+  #define TARGET_BTRFS_IOC_SUBVOL_CREATE          TARGET_IOWU(BTRFS_IOCTL_MAGIC, 14)

+  #define TARGET_BTRFS_IOC_SNAP_DESTROY           TARGET_IOWU(BTRFS_IOCTL_MAGIC, 15)

+ +#define TARGET_BTRFS_IOC_TREE_SEARCH            TARGET_IOWRU(BTRFS_IOCTL_MAGIC, 17)

+  #define TARGET_BTRFS_IOC_INO_LOOKUP             TARGET_IOWRU(BTRFS_IOCTL_MAGIC, 18)

+  #define TARGET_BTRFS_IOC_DEFAULT_SUBVOL         TARGET_IOW(BTRFS_IOCTL_MAGIC, 19, \

+                                                             abi_ullong)

+ +#define TARGET_BTRFS_IOC_SNAP_CREATE_V2         TARGET_IOWU(BTRFS_IOCTL_MAGIC, 23)

+ +#define TARGET_BTRFS_IOC_SUBVOL_CREATE_V2       TARGET_IOWU(BTRFS_IOCTL_MAGIC, 24)

+  #define TARGET_BTRFS_IOC_SUBVOL_GETFLAGS        TARGET_IOR(BTRFS_IOCTL_MAGIC, 25, \

+                                                             abi_ullong)

+  #define TARGET_BTRFS_IOC_SUBVOL_SETFLAGS        TARGET_IOW(BTRFS_IOCTL_MAGIC, 26, \

+ @@ -990,10 +993,12 @@

+  #define TARGET_BTRFS_IOC_GET_FEATURES           TARGET_IORU(BTRFS_IOCTL_MAGIC, 57)

+  #define TARGET_BTRFS_IOC_SET_FEATURES           TARGET_IOWU(BTRFS_IOCTL_MAGIC, 57)

+  #define TARGET_BTRFS_IOC_GET_SUPPORTED_FEATURES TARGET_IORU(BTRFS_IOCTL_MAGIC, 57)

+ +#define TARGET_BTRFS_IOC_RM_DEV_V2              TARGET_IOWU(BTRFS_IOCTL_MAGIC, 58)

+  #define TARGET_BTRFS_IOC_LOGICAL_INO_V2         TARGET_IOWRU(BTRFS_IOCTL_MAGIC, 59)

+  #define TARGET_BTRFS_IOC_GET_SUBVOL_INFO        TARGET_IORU(BTRFS_IOCTL_MAGIC, 60)

+  #define TARGET_BTRFS_IOC_GET_SUBVOL_ROOTREF     TARGET_IOWRU(BTRFS_IOCTL_MAGIC, 61)

+  #define TARGET_BTRFS_IOC_INO_LOOKUP_USER        TARGET_IOWRU(BTRFS_IOCTL_MAGIC, 62)

+ +#define TARGET_BTRFS_IOC_SNAP_DESTROY_V2        TARGET_IOWU(BTRFS_IOCTL_MAGIC, 63)

+  #endif

+ 

+  /* usb ioctls */

+ diff --git a/linux-user/syscall_types.h b/linux-user/syscall_types.h

+ --- a/linux-user/syscall_types.h

+ +++ b/linux-user/syscall_types.h

+ @@ -373,6 +373,37 @@

+         MK_ARRAY(TYPE_CHAR, BTRFS_PATH_NAME_MAX + 1)) /* name */

+  #endif

+ 

+ +#if defined(BTRFS_IOC_SNAP_CREATE_V2) || \

+ +    defined(BTRFS_IOC_SUBVOL_CREATE_V2) || \

+ +    defined(BTRFS_IOC_RM_DEV_V2) || defined(BTRFS_IOC_SNAP_DESTROY_V2)

+ +STRUCT(btrfs_ioctl_vol_args_v2,

+ +       TYPE_LONGLONG, /* fd */

+ +       TYPE_ULONGLONG, /* transid */

+ +       TYPE_ULONGLONG, /* flags */

+ +       MK_ARRAY(TYPE_ULONGLONG, 4), /* unused */

+ +       MK_ARRAY(TYPE_CHAR, BTRFS_SUBVOL_NAME_MAX + 1)) /* name */

+ +#endif

+ +

+ +#ifdef BTRFS_IOC_TREE_SEARCH

+ +STRUCT(btrfs_ioctl_search_args,

+ +       TYPE_ULONGLONG, /* tree_id */

+ +       TYPE_ULONGLONG, /* min_objectid */

+ +       TYPE_ULONGLONG, /* max_objectid */

+ +       TYPE_ULONGLONG, /* min_offset */

+ +       TYPE_ULONGLONG, /* max_offset */

+ +       TYPE_ULONGLONG, /* min_transid */

+ +       TYPE_ULONGLONG, /* max_transid */

+ +       TYPE_INT,       /* min_type */

+ +       TYPE_INT,       /* max_type */

+ +       TYPE_INT,       /* nr_items */

+ +       TYPE_INT,       /* unused */

+ +       TYPE_ULONGLONG, /* unused1 */

+ +       TYPE_ULONGLONG, /* unused2 */

+ +       TYPE_ULONGLONG, /* unused3 */

+ +       TYPE_ULONGLONG, /* unused4 */

+ +       MK_ARRAY(TYPE_CHAR, BTRFS_SEARCH_ARGS_BUFSIZE)) /* buf */

+ +#endif

+ +

+  #ifdef BTRFS_IOC_GET_SUBVOL_INFO

+  STRUCT(btrfs_ioctl_timespec,

+         TYPE_ULONGLONG, /* sec */

@@ -0,0 +1,53 @@ 

+ From: Roberto Campesato <render@metalabs.org>

+ diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c

+ index 75d11a07b2..4da3b75af9 100644

+ --- a/accel/kvm/kvm-all.c

+ +++ b/accel/kvm/kvm-all.c

+ @@ -2966,9 +2966,13 @@ int kvm_convert_memory(hwaddr start, hwaddr size, bool to_private)

+               */

+              goto out_unref;

+          }

+ -        ret = ram_block_discard_range(rb, offset, size);

+ +        ret = ram_block_discard_is_disabled()

+ +              ? ram_block_discard_range(rb, offset, size)

+ +              : 0;

+      } else {

+ -        ret = ram_block_discard_guest_memfd_range(rb, offset, size);

+ +        ret = ram_block_discard_is_disabled()

+ +              ? ram_block_discard_guest_memfd_range(rb, offset, size)

+ +              : 0;

+      }

+ 

+  out_unref:

+ diff --git a/system/physmem.c b/system/physmem.c

+ index 94600a33ec..16e1dd4f22 100644

+ --- a/system/physmem.c

+ +++ b/system/physmem.c

+ @@ -1880,19 +1880,10 @@ static void ram_block_add(RAMBlock *new_block, Error **errp)

+      }

+ 

+      if (new_block->flags & RAM_GUEST_MEMFD) {

+ -        int ret;

+ 

+          assert(kvm_enabled());

+          assert(new_block->guest_memfd < 0);

+ 

+ -        ret = ram_block_discard_require(true);

+ -        if (ret < 0) {

+ -            error_setg_errno(errp, -ret,

+ -                             "cannot set up private guest memory: discard currently blocked");

+ -            error_append_hint(errp, "Are you using assigned devices?\n");

+ -            goto out_free;

+ -        }

+ -

+          new_block->guest_memfd = kvm_create_guest_memfd(new_block->max_length,

+                                                          0, errp);

+          if (new_block->guest_memfd < 0) {

+ @@ -2156,7 +2147,6 @@ static void reclaim_ramblock(RAMBlock *block)

+ 

+      if (block->guest_memfd >= 0) {

+          close(block->guest_memfd);

+ -        ram_block_discard_require(false);

+      }

+ 

+      g_free(block);

@@ -0,0 +1,40 @@ 

+ From: Roberto Campesato <render@metalabs.org>

+ 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);

file modified
+105 -12
@@ -79,6 +79,7 @@ 

  %global have_spice 0

  %endif

  %if 0%{?rhel} >= 9

+ # TODO(Hyperscale): enable when RHBZ#2233161 is resolved

  %global have_spice 0

  %endif

  
@@ -91,7 +92,7 @@ 

  %endif

  

  %global have_liburing 0

- %if 0%{?fedora}

+ %if 0%{?fedora} || 0%{?centos_hs}

  %ifnarch %{arm}

  %global have_liburing 1

  %endif
@@ -112,7 +113,7 @@ 

  

  %global have_jack 1

  %if 0%{?rhel}

- %global have_jack 0

+ %global have_jack %{defined centos_hs}

  %endif

  

  %global have_dbus_display 1
@@ -121,10 +122,7 @@ 

  %global have_dbus_display 0

  %endif

  

- %global have_libblkio 0

- %if 0%{?fedora} >= 37

  %global have_libblkio 1

- %endif

  

  %global have_gvnc_devel %{defined fedora}

  %global have_sdl_image %{defined fedora}
@@ -153,7 +151,7 @@ 

  %endif

  

  %define have_block_nfs 0

- %if 0%{?fedora}

+ %if 0%{?fedora} || 0%{?centos_hs}

  %define have_block_nfs 1

  %endif

  
@@ -163,7 +161,7 @@ 

  %endif

  

  %define have_libcacard 1

- %if 0%{?rhel} >= 9

+ %if 0%{?rhel} >= 9 && ! 0%{?centos_hs}

  %define have_libcacard 0

  %endif

  
@@ -367,14 +365,33 @@ 

  %endif

  

  # To prevent rpmdev-bumpspec breakage

- %global baserelease 3

+ %global baserelease 1

+ 

+ # Hyperscale release

+ %global hsrel .1

  

  Summary: QEMU is a FAST! processor emulator

  Name: qemu

- Version: 9.1.0

- Release: %{baserelease}%{?rcrel}%{?dist}

+ 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
@@ -390,6 +407,28 @@ 

  #     Generating build-id links failed

  %global  _missing_build_ids_terminate_build    0

  

+ # fb-only patches.

+ %if 0%{?facebook}

+ # internal hack #1: skip validation of all CA certs in the provided bundle including

+ # those not in the chain of trust. evaluating rework for potential upstreaming.

+ Patch: 0001-relax-CA-certs-checks.patch

+ 

+ # internal hack #2: when using qemu-user from binfmt_misc we cannot pass parameters to select

+ # which cpu to use. changing the default to use the oldest cpu supported by CentOS 9.

+ # evaluating if an environment variable could be used for this

+ Patch: 0003-linux-user-default-cpu-model.patch

+ 

+ # Add new btrfs *_v2 ioctls for user-level emulation.

+ # will be reworked for potential upstreaming.

+ Patch: 0004-BTRFS_V2_IOCTLS.patch

+ 

+ # 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

+ 

  Source10: qemu-guest-agent.service

  Source11: 99-qemu-guest-agent.rules

  Source12: bridge.conf
@@ -404,6 +443,14 @@ 

  # 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}
@@ -3150,13 +3197,33 @@ 

  

  

  %changelog

- * Mon Sep 16 2024 Daniel P. Berrangé <berrange@redhat.com> - 9.1.0-3

+ * Fri Oct 25 2024 Roberto Campesato <render@metalabs.org> - 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 <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-4

+ - Add openat2 support to linux-user

+ - Fix compat with new glibc for 'struct sched_attr'

+ 

+ * Wed Oct 16 2024 Daniel P. Berrangé <berrange@redhat.com> - 9.1.0-3

  - Replace BLACKLIST_RPC with QEMU_GA_ARGS in sysconfig file

  - Related rhbz #2258100

  

+ * Mon Oct 14 2024 Roberto Campesato <render@metalabs.org> - 2:9.1.0-2.1

+ - Merge latest changes from Fedora

+ 

  * 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)

  

+ * Wed Sep 11 2024 Roberto Campesato <render@metalabs.org> - 9.1.0-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 Sep 05 2024 Cole Robinson <crobinso@redhat.com> - 9.1.0-1

  - New release qemu 9.1.0 GA

  
@@ -3191,6 +3258,17 @@ 

  * Sat Apr 06 2024 Cole Robinson <crobinso@redhat.com> - 8.2.2-2

  - Rebuild for new libiscsi

  

+ * Tue Mar 26 2024 Roberto Campesato <render@metalabs.org> - 8.2.2-1.1

+ - include unit test change in patch relaxing CA cert bundle validation

+ 

+ * Tue Mar 19 2024 Roberto Campesato <render@metalabs.org> - 8.2.2-1.1

+ - Merge latest changes from Fedora

+ - Re-enabled libblkio (RHBZ#2232766 closed)

+ - Added fb-only patches

+   . relaxing CA cert bundle validatation

+   . setting default cpu_model for linux-user x86_64 and aarch64

+   . btrfs v2 ioctls

+ 

  * Wed Mar 06 2024 Cole Robinson <crobinso@redhat.com> - 8.2.2-1

  - New release qemu 8.2.2

  
@@ -3242,6 +3320,10 @@ 

  * Tue Sep 26 2023 Cole Robinson <crobinso@redhat.com> - 8.1.1-1

  - Rebase to qemu 8.1.1

  

+ * Tue Sep 19 2023 Davide Cavalca <dcavalca@centosproject.org> - 2:8.1.0-2.1

+ - Merge latest changes from Fedora

+ - Enable libcacard support for Hyperscale builds

+ 

  * Thu Aug 24 2023 Cole Robinson <crobinso@redhat.com> - 8.1.0-2

  - Make qemu-docs noarch

  
@@ -3254,6 +3336,13 @@ 

  * Sun Aug 20 2023 Cole Robinson <crobinso@redhat.com> - 8.1.0-0.1-rc4

  - Rebase to qemu 8.1.0-rc4

  

+ * Thu Aug 17 2023 Davide Cavalca <dcavalca@centosproject.org> - 2:8.0.3-1.1

+ - Merge latest changes from Fedora

+ - Temporarily disable virgl for Hyperscale due to missing dependencies

+ - Adjust Requires for virtiofsd for RHEL 9 and earlier

+   Upstream PR: https://src.fedoraproject.org/rpms/qemu/pull-request/47

+ - Enable jack support for Hyperscale builds

+ 

  * Thu Jul 20 2023 Camilla Conte <cconte@redhat.com> - 2:8.0.3-1

  - New upstream release 8.0.3

  
@@ -3303,6 +3392,10 @@ 

  * Fri Nov 11 2022 Eduardo Lima (Etrunko) <etrunko@redhat.com> - 7.1.0-4

  - Update libbpf dependency

  

+ * Thu Sep 08 2022 Davide Cavalca <dcavalca@centosproject.org> - 7.1.0-3.1

+ - Enable some additional features for Hyperscale

+ - Number patches for compatibility with el8

+ 

  * Thu Sep 08 2022 Davide Cavalca <dcavalca@fedoraproject.org> - 7.1.0-3

  - Unconditionally enable capstone-devel

  

file added
+192
@@ -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);

+ 

+ 

file modified
+2 -2
@@ -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

  • Pulling latest changes from rawhide, moving to qemu 9.1.1
  • Including one additional experimental patch to fix PCI passthrough issues on AMD SEV/SNP VMs

tested local build for x86_64/aarch64, main and facebook

Merged this manually because pagure was failing with "Your task failed: failed to write reference 'refs/heads/c9s-sig-hyperscale': a reference with that name already exists"

git fetch https://git.centos.org/rpms/qemu refs/pull/6/head && git merge FETCH_HEAD

Pull-Request has been closed by render

19 days ago