Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] qemu: update to 8.0.2.
@ 2023-07-03 17:50 motorto
  2023-07-03 17:55 ` [PR PATCH] [Updated] " motorto
                   ` (38 more replies)
  0 siblings, 39 replies; 40+ messages in thread
From: motorto @ 2023-07-03 17:50 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1392 bytes --]

There is a new pull request by motorto against master on the void-packages repository

https://github.com/motorto/void-packages qemu-8.0.2
https://github.com/void-linux/void-packages/pull/44822

qemu: update to 8.0.2.
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **NO**, still haven't had the time to. Opening to have feedback on it and possible some testers as well.


Removed a bunch of patches that in my research are no longer needed:

- Removed all ppc related patches since that arch isn't no longer supported.
- gcc12.patch: because it builds fine now in this version
- fix-softfloat-fesetround.patch: don't have a system to try it, but alpine doesn't have any patch related to this)
- mmap-mremap-efaul: not sure about if we should keep this one

Kept this patches:

- musl-initialize-msghdr.patch: just update in order to apply.

Added this ones:

- CVE-2023-2861.patch:
- keymap.patch: xkeyboard-config 2.39 removed the legacy alias of ar -> ara

#### Local build testing
- I built this PR locally for my native architecture, x86-64-glibc
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl (cross)
  - x86_64-musl



A patch file from https://github.com/void-linux/void-packages/pull/44822.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-qemu-8.0.2-44822.patch --]
[-- Type: text/x-diff, Size: 33412 bytes --]

From a4c87097b88198b2910bf328402dc61de03d6814 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Cerqueira?= <acerqueira021@gmail.com>
Date: Mon, 3 Jul 2023 18:41:12 +0100
Subject: [PATCH 1/2] qemu: update to 8.0.2.

---
 srcpkgs/qemu/patches/CVE-2023-2861.patch      | 177 ++++++++++++++++++
 .../qemu/patches/fix-linux-user-ppc32.patch   | 117 ------------
 .../patches/fix-softfloat-fesetround.patch    |  39 ----
 srcpkgs/qemu/patches/gcc12.patch              |  72 -------
 srcpkgs/qemu/patches/keymap.patch             |  47 +++++
 srcpkgs/qemu/patches/mmap-mremap-efault.patch |  42 -----
 .../qemu/patches/musl-initialize-msghdr.patch |   6 +-
 srcpkgs/qemu/patches/musl-ppc.patch           |  25 ---
 srcpkgs/qemu/patches/musl-rlimit-rttime.patch |  13 --
 srcpkgs/qemu/patches/xxx-ppcle.patch          | 113 -----------
 srcpkgs/qemu/template                         |  41 +---
 11 files changed, 235 insertions(+), 457 deletions(-)
 create mode 100644 srcpkgs/qemu/patches/CVE-2023-2861.patch
 delete mode 100644 srcpkgs/qemu/patches/fix-linux-user-ppc32.patch
 delete mode 100644 srcpkgs/qemu/patches/fix-softfloat-fesetround.patch
 delete mode 100644 srcpkgs/qemu/patches/gcc12.patch
 create mode 100644 srcpkgs/qemu/patches/keymap.patch
 delete mode 100644 srcpkgs/qemu/patches/mmap-mremap-efault.patch
 delete mode 100644 srcpkgs/qemu/patches/musl-ppc.patch
 delete mode 100644 srcpkgs/qemu/patches/musl-rlimit-rttime.patch
 delete mode 100644 srcpkgs/qemu/patches/xxx-ppcle.patch

diff --git a/srcpkgs/qemu/patches/CVE-2023-2861.patch b/srcpkgs/qemu/patches/CVE-2023-2861.patch
new file mode 100644
index 000000000000..dca869f1d77f
--- /dev/null
+++ b/srcpkgs/qemu/patches/CVE-2023-2861.patch
@@ -0,0 +1,177 @@
+Patch-Source: https://gitlab.com/qemu-project/qemu/-/commit/b9d2887be4e616cdaeedd0b7456bfaa71ee798af
+--
+From b9d2887be4e616cdaeedd0b7456bfaa71ee798af Mon Sep 17 00:00:00 2001
+From: Christian Schoenebeck <qemu_oss@crudebyte.com>
+Date: Wed, 7 Jun 2023 18:29:33 +0200
+Subject: [PATCH] 9pfs: prevent opening special files (CVE-2023-2861)
+
+The 9p protocol does not specifically define how server shall behave when
+client tries to open a special file, however from security POV it does
+make sense for 9p server to prohibit opening any special file on host side
+in general. A sane Linux 9p client for instance would never attempt to
+open a special file on host side, it would always handle those exclusively
+on its guest side. A malicious client however could potentially escape
+from the exported 9p tree by creating and opening a device file on host
+side.
+
+With QEMU this could only be exploited in the following unsafe setups:
+
+  - Running QEMU binary as root AND 9p 'local' fs driver AND 'passthrough'
+    security model.
+
+or
+
+  - Using 9p 'proxy' fs driver (which is running its helper daemon as
+    root).
+
+These setups were already discouraged for safety reasons before,
+however for obvious reasons we are now tightening behaviour on this.
+
+Fixes: CVE-2023-2861
+Reported-by: Yanwu Shen <ywsPlz@gmail.com>
+Reported-by: Jietao Xiao <shawtao1125@gmail.com>
+Reported-by: Jinku Li <jkli@xidian.edu.cn>
+Reported-by: Wenbo Shen <shenwenbo@zju.edu.cn>
+Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
+Reviewed-by: Greg Kurz <groug@kaod.org>
+Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
+Message-Id: <E1q6w7r-0000Q0-NM@lizzy.crudebyte.com>
+(cherry picked from commit f6b0de53fb87ddefed348a39284c8e2f28dc4eda)
+Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
+---
+ fsdev/virtfs-proxy-helper.c | 27 +++++++++++++++++++++++--
+ hw/9pfs/9p-util.h           | 39 +++++++++++++++++++++++++++++++++++++
+ 2 files changed, 64 insertions(+), 2 deletions(-)
+
+diff --git a/fsdev/virtfs-proxy-helper.c b/fsdev/virtfs-proxy-helper.c
+index 5cafcd77031..d9511f429c9 100644
+--- a/fsdev/virtfs-proxy-helper.c
++++ b/fsdev/virtfs-proxy-helper.c
+@@ -26,6 +26,7 @@
+ #include "qemu/xattr.h"
+ #include "9p-iov-marshal.h"
+ #include "hw/9pfs/9p-proxy.h"
++#include "hw/9pfs/9p-util.h"
+ #include "fsdev/9p-iov-marshal.h"
+ 
+ #define PROGNAME "virtfs-proxy-helper"
+@@ -338,6 +339,28 @@ static void resetugid(int suid, int sgid)
+     }
+ }
+ 
++/*
++ * Open regular file or directory. Attempts to open any special file are
++ * rejected.
++ *
++ * returns file descriptor or -1 on error
++ */
++static int open_regular(const char *pathname, int flags, mode_t mode)
++{
++    int fd;
++
++    fd = open(pathname, flags, mode);
++    if (fd < 0) {
++        return fd;
++    }
++
++    if (close_if_special_file(fd) < 0) {
++        return -1;
++    }
++
++    return fd;
++}
++
+ /*
+  * send response in two parts
+  * 1) ProxyHeader
+@@ -682,7 +705,7 @@ static int do_create(struct iovec *iovec)
+     if (ret < 0) {
+         goto unmarshal_err_out;
+     }
+-    ret = open(path.data, flags, mode);
++    ret = open_regular(path.data, flags, mode);
+     if (ret < 0) {
+         ret = -errno;
+     }
+@@ -707,7 +730,7 @@ static int do_open(struct iovec *iovec)
+     if (ret < 0) {
+         goto err_out;
+     }
+-    ret = open(path.data, flags);
++    ret = open_regular(path.data, flags, 0);
+     if (ret < 0) {
+         ret = -errno;
+     }
+diff --git a/hw/9pfs/9p-util.h b/hw/9pfs/9p-util.h
+index c314cf381d4..df1b583a5e4 100644
+--- a/hw/9pfs/9p-util.h
++++ b/hw/9pfs/9p-util.h
+@@ -13,6 +13,8 @@
+ #ifndef QEMU_9P_UTIL_H
+ #define QEMU_9P_UTIL_H
+ 
++#include "qemu/error-report.h"
++
+ #ifdef O_PATH
+ #define O_PATH_9P_UTIL O_PATH
+ #else
+@@ -95,6 +97,7 @@ static inline int errno_to_dotl(int err) {
+ #endif
+ 
+ #define qemu_openat     openat
++#define qemu_fstat      fstat
+ #define qemu_fstatat    fstatat
+ #define qemu_mkdirat    mkdirat
+ #define qemu_renameat   renameat
+@@ -108,6 +111,38 @@ static inline void close_preserve_errno(int fd)
+     errno = serrno;
+ }
+ 
++/**
++ * close_if_special_file() - Close @fd if neither regular file nor directory.
++ *
++ * @fd: file descriptor of open file
++ * Return: 0 on regular file or directory, -1 otherwise
++ *
++ * CVE-2023-2861: Prohibit opening any special file directly on host
++ * (especially device files), as a compromised client could potentially gain
++ * access outside exported tree under certain, unsafe setups. We expect
++ * client to handle I/O on special files exclusively on guest side.
++ */
++static inline int close_if_special_file(int fd)
++{
++    struct stat stbuf;
++
++    if (qemu_fstat(fd, &stbuf) < 0) {
++        close_preserve_errno(fd);
++        return -1;
++    }
++    if (!S_ISREG(stbuf.st_mode) && !S_ISDIR(stbuf.st_mode)) {
++        error_report_once(
++            "9p: broken or compromised client detected; attempt to open "
++            "special file (i.e. neither regular file, nor directory)"
++        );
++        close(fd);
++        errno = ENXIO;
++        return -1;
++    }
++
++    return 0;
++}
++
+ static inline int openat_dir(int dirfd, const char *name)
+ {
+     return qemu_openat(dirfd, name,
+@@ -142,6 +177,10 @@ again:
+         return -1;
+     }
+ 
++    if (close_if_special_file(fd) < 0) {
++        return -1;
++    }
++
+     serrno = errno;
+     /* O_NONBLOCK was only needed to open the file. Let's drop it. We don't
+      * do that with O_PATH since fcntl(F_SETFL) isn't supported, and openat()
+-- 
+GitLab
diff --git a/srcpkgs/qemu/patches/fix-linux-user-ppc32.patch b/srcpkgs/qemu/patches/fix-linux-user-ppc32.patch
deleted file mode 100644
index cd47435d5aa9..000000000000
--- a/srcpkgs/qemu/patches/fix-linux-user-ppc32.patch
+++ /dev/null
@@ -1,117 +0,0 @@
-commit 37814f62c2cc7aba2eea073014d6c53dcd5bf42c
-Author: q66 <daniel@octaforge.org>
-Date:   Fri Jul 1 16:53:55 2022 +0200
-
-    fix linux-user build on 32-bit ppc
-    
-    Partial revert https://gitlab.com/qemu-project/qemu/-/commit/9d1401b79463e74adbfac69d836789d4e103fb61
-    and https://gitlab.com/qemu-project/qemu/-/commit/0a7e01904d407baa73c1baddbdfc9ccf2ace8356
-
-diff --git a/common-user/host/ppc/safe-syscall.inc.S b/common-user/host/ppc/safe-syscall.inc.S
-new file mode 100644
-index 0000000..e69de29
-diff --git a/common-user/safe-syscall-error.c b/common-user/safe-syscall-error.c
-index cf74b50..a36132c 100644
---- a/common-user/safe-syscall-error.c
-+++ b/common-user/safe-syscall-error.c
-@@ -12,6 +12,7 @@
- #include "qemu/osdep.h"
- #include "user/safe-syscall.h"
- 
-+#if !defined(__powerpc__) || defined(__powerpc64__)
- /*
-  * This is intended to be invoked via tail-call on the error path
-  * from the assembly in host/arch/safe-syscall.inc.S.  This takes
-@@ -23,3 +24,4 @@ long safe_syscall_set_errno_tail(int value)
-     errno = value;
-     return -1;
- }
-+#endif
-diff --git a/include/user/safe-syscall.h b/include/user/safe-syscall.h
-index 61a04e2..793fe84 100644
---- a/include/user/safe-syscall.h
-+++ b/include/user/safe-syscall.h
-@@ -125,6 +125,8 @@
-  * kinds of restartability.
-  */
- 
-+#if !defined(__powerpc__) || defined(__powerpc64__)
-+
- /* The core part of this function is implemented in assembly */
- extern long safe_syscall_base(int *pending, long number, ...);
- extern long safe_syscall_set_errno_tail(int value);
-@@ -137,4 +139,10 @@ extern char safe_syscall_end[];
-     safe_syscall_base(&((TaskState *)thread_cpu->opaque)->signal_pending, \
-                       __VA_ARGS__)
- 
-+#else
-+
-+#define safe_syscall syscall
-+
-+#endif
-+
- #endif
-diff --git a/linux-user/include/host/ppc/host-signal.h b/linux-user/include/host/ppc/host-signal.h
-new file mode 100644
-index 0000000..b80384d
---- /dev/null
-+++ b/linux-user/include/host/ppc/host-signal.h
-@@ -0,0 +1,38 @@
-+/*
-+ * host-signal.h: signal info dependent on the host architecture
-+ *
-+ * Copyright (c) 2003-2005 Fabrice Bellard
-+ * Copyright (c) 2021 Linaro Limited
-+ *
-+ * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
-+ * See the COPYING file in the top-level directory.
-+ */
-+
-+#ifndef PPC_HOST_SIGNAL_H
-+#define PPC_HOST_SIGNAL_H
-+
-+/* The third argument to a SA_SIGINFO handler is ucontext_t. */
-+typedef ucontext_t host_sigcontext;
-+
-+static inline uintptr_t host_signal_pc(host_sigcontext *uc)
-+{
-+    return uc->uc_mcontext.regs->nip;
-+}
-+
-+static inline void host_signal_set_pc(host_sigcontext *uc, uintptr_t pc)
-+{
-+    uc->uc_mcontext.regs->nip = pc;
-+}
-+
-+static inline void *host_signal_mask(host_sigcontext *uc)
-+{
-+    return &uc->uc_sigmask;
-+}
-+
-+static inline bool host_signal_write(siginfo_t *info, host_sigcontext *uc)
-+{
-+    return uc->uc_mcontext.regs->trap != 0x400
-+        && (uc->uc_mcontext.regs->dsisr & 0x02000000);
-+}
-+
-+#endif
-diff --git a/linux-user/signal.c b/linux-user/signal.c
-index 092e70b..b8dfa8a 100644
---- a/linux-user/signal.c
-+++ b/linux-user/signal.c
-@@ -800,6 +800,7 @@ void queue_signal(CPUArchState *env, int sig, int si_type,
- /* Adjust the signal context to rewind out of safe-syscall if we're in it */
- static inline void rewind_if_in_safe_syscall(void *puc)
- {
-+#if !defined(__powerpc__) || defined(__powerpc64__)
-     host_sigcontext *uc = (host_sigcontext *)puc;
-     uintptr_t pcreg = host_signal_pc(uc);
- 
-@@ -807,6 +808,7 @@ static inline void rewind_if_in_safe_syscall(void *puc)
-         && pcreg < (uintptr_t)safe_syscall_end) {
-         host_signal_set_pc(uc, (uintptr_t)safe_syscall_start);
-     }
-+#endif
- }
- 
- static void host_signal_handler(int host_sig, siginfo_t *info, void *puc)
diff --git a/srcpkgs/qemu/patches/fix-softfloat-fesetround.patch b/srcpkgs/qemu/patches/fix-softfloat-fesetround.patch
deleted file mode 100644
index ecdd049f7921..000000000000
--- a/srcpkgs/qemu/patches/fix-softfloat-fesetround.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-Source: @pullmoll
-Upstream: no
-Reason: Target architectures with soft float do not define these constants.
-
---- a/tests/fp/fp-bench.c	2020-12-08 17:59:44.000000000 +0100
-+++ b/tests/fp/fp-bench.c	2020-12-12 20:38:40.702235420 +0100
-@@ -485,16 +485,32 @@
- 
-     switch (rounding) {
-     case ROUND_EVEN:
-+#if defined(FE_TONEAREST)
-         rhost = FE_TONEAREST;
-+#else
-+	return;
-+#endif
-         break;
-     case ROUND_ZERO:
-+#if defined(FE_TOWARDZERO)
-         rhost = FE_TOWARDZERO;
-+#else
-+	return;
-+#endif
-         break;
-     case ROUND_DOWN:
-+#if defined(FE_DOWNWARD)
-         rhost = FE_DOWNWARD;
-+#else
-+	return;
-+#endif
-         break;
-     case ROUND_UP:
-+#if defined(FE_UPWARD)
-         rhost = FE_UPWARD;
-+#else
-+	return;
-+#endif
-         break;
-     case ROUND_TIEAWAY:
-         die_host_rounding(rounding);
diff --git a/srcpkgs/qemu/patches/gcc12.patch b/srcpkgs/qemu/patches/gcc12.patch
deleted file mode 100644
index 2a4b2bd03609..000000000000
--- a/srcpkgs/qemu/patches/gcc12.patch
+++ /dev/null
@@ -1,72 +0,0 @@
-From 5cb993ff131fca2abef3ce074a20258fd6fce557 Mon Sep 17 00:00:00 2001
-From: Bernhard Beschow <shentey@gmail.com>
-Date: Sat, 18 Mar 2023 19:59:31 +0100
-Subject: [PATCH] qemu/osdep: Switch position of "extern" and "G_NORETURN"
-
-Fixes the Windows build under msys2 using GCC 12 which fails with the following
-error:
-
-  [184/579] Compiling C++ object qga/vss-win32/qga-vss.dll.p/install.cpp.obj
-  FAILED: qga/vss-win32/qga-vss.dll.p/install.cpp.obj
-  "c++" "-m64" "-mcx16" "-Iqga/vss-win32/qga-vss.dll.p" "-Iqga/vss-win32" "-I../src/qga/vss-win32" "-I." "-Iqapi" "-Itrace" "-Iui" "-Iui/shader" "-IC:/msys64/mingw64/include/glib-2.0" "-IC:/msys64/mingw64/lib/glib-2.0/include" "-fdiagnostics-color=auto" "-Wall" "-Winvalid-pch" "-Wnon-virtual-dtor" "-Werror" "-std=gnu++11" "-g" "-iquote" "." "-iquote" "C:/msys64/home/shentey/Projects/qemu/src" "-iquote" "C:/msys64/home/shentey/Projects/qemu/src/include" "-iquote" "C:/msys64/home/shentey/Projects/qemu/src/tcg/i386" "-D__STDC_LIMIT_MACROS" "-D__STDC_CONSTANT_MACROS" "-D__STDC_FORMAT_MACROS" "-fno-pie" "-no-pie" "-D_GNU_SOURCE" "-D_FILE_OFFSET_BITS=64" "-D_LARGEFILE_SOURCE" "-fno-strict-aliasing" "-fno-common" "-fwrapv" "-Wundef" "-Wwrite-strings" "-Wtype-limits" "-Wformat-security" "-Wformat-y2k" "-Winit-self" "-Wignored-qualifiers" "-Wempty-body" "-Wendif-labels" "-Wexpansion-to-defined" "-Wimplicit-fallthrough=2" "-Wmissing-format-attribute" "-Wno-missing-include-dirs" "-Wno-shift-negative-value" "-Wno-psabi" "-fstack-protector-strong" "-Wno-unknown-pragmas" "-Wno-delete-non-virtual-dtor" "-Wno-non-virtual-dtor" -MD -MQ qga/vss-win32/qga-vss.dll.p/install.cpp.obj -MF "qga/vss-win32/qga-vss.dll.p/install.cpp.obj.d" -o qga/vss-win32/qga-vss.dll.p/install.cpp.obj "-c" ../src/qga/vss-win32/install.cpp
-  In file included from C:/msys64/mingw64/lib/glib-2.0/include/glibconfig.h:9,
-              from C:/msys64/mingw64/include/glib-2.0/glib/gtypes.h:34,
-              from C:/msys64/mingw64/include/glib-2.0/glib/galloca.h:34,
-              from C:/msys64/mingw64/include/glib-2.0/glib.h:32,
-              from C:/msys64/home/shentey/Projects/qemu/src/include/glib-compat.h:32,
-              from C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:144,
-              from ../src/qga/vss-win32/install.cpp:13:
-  C:/msys64/mingw64/include/glib-2.0/glib/gmacros.h:1075:21: error: standard attributes in middle of decl-specifiers
-  1075 | # define G_NORETURN [[noreturn]]
-        |                     ^
-  C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:240:8: note: in expansion of macro 'G_NORETURN'
-  240 | extern G_NORETURN
-        |        ^~~~~~~~~~
-  C:/msys64/mingw64/include/glib-2.0/glib/gmacros.h:1075:21: note: standard attributes must precede the decl-specifiers to apply to the declaration, or follow them to apply to the type
-  1075 | # define G_NORETURN [[noreturn]]
-        |                     ^
-  C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:240:8: note: in expansion of macro 'G_NORETURN'
-  240 | extern G_NORETURN
-        |        ^~~~~~~~~~
-  C:/msys64/mingw64/include/glib-2.0/glib/gmacros.h:1075:21: error: attribute ignored [-Werror=attributes]
-  1075 | # define G_NORETURN [[noreturn]]
-        |                     ^
-  C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:240:8: note: in expansion of macro 'G_NORETURN'
-  240 | extern G_NORETURN
-        |        ^~~~~~~~~~
-  C:/msys64/mingw64/include/glib-2.0/glib/gmacros.h:1075:21: note: an attribute that appertains to a type-specifier is ignored
-  1075 | # define G_NORETURN [[noreturn]]
-        |                     ^
-  C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:240:8: note: in expansion of macro 'G_NORETURN'
-  240 | extern G_NORETURN
-        |        ^~~~~~~~~~
-  cc1plus.exe: all warnings being treated as errors
-
-Apparently it also fixes the compilation with Clang 15 (see
-https://gitlab.com/qemu-project/qemu/-/issues/1541 ).
-
-Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1541
-Signed-off-by: Bernhard Beschow <shentey@gmail.com>
-Message-Id: <20230318185931.181659-1-shentey@gmail.com>
-Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
-Signed-off-by: Thomas Huth <thuth@redhat.com>
----
- include/qemu/osdep.h | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
-index f68b5d8708c..9eff0be95bd 100644
---- a/include/qemu/osdep.h
-+++ b/include/qemu/osdep.h
-@@ -237,7 +237,7 @@ extern "C" {
-  * supports QEMU_ERROR, this will be reported at compile time; otherwise
-  * this will be reported at link time due to the missing symbol.
-  */
--extern G_NORETURN
-+G_NORETURN extern
- void QEMU_ERROR("code path is reachable")
-     qemu_build_not_reached_always(void);
- #if defined(__OPTIMIZE__) && !defined(__NO_INLINE__)
--- 
-GitLab
-
diff --git a/srcpkgs/qemu/patches/keymap.patch b/srcpkgs/qemu/patches/keymap.patch
new file mode 100644
index 000000000000..c4d9963cd636
--- /dev/null
+++ b/srcpkgs/qemu/patches/keymap.patch
@@ -0,0 +1,47 @@
+The xkb official name for the Arabic keyboard layout is 'ara'.
+However xkb has for at least the past 15 years also permitted it to
+be named via the legacy synonym 'ar'.  In xkeyboard-config 2.39 this
+synoynm was removed, which breaks compilation of QEMU:
+
+FAILED: pc-bios/keymaps/ar
+/home/fred/qemu-git/src/qemu/build-full/qemu-keymap -f pc-bios/keymaps/ar -l ar
+xkbcommon: ERROR: Couldn't find file "symbols/ar" in include paths
+xkbcommon: ERROR: 1 include paths searched:
+xkbcommon: ERROR: 	/usr/share/X11/xkb
+xkbcommon: ERROR: 3 include paths could not be added:
+xkbcommon: ERROR: 	/home/fred/.config/xkb
+xkbcommon: ERROR: 	/home/fred/.xkb
+xkbcommon: ERROR: 	/etc/xkb
+xkbcommon: ERROR: Abandoning symbols file "(unnamed)"
+xkbcommon: ERROR: Failed to compile xkb_symbols
+xkbcommon: ERROR: Failed to compile keymap
+
+The upstream xkeyboard-config change removing the compat
+mapping is:
+https://gitlab.freedesktop.org/xkeyboard-config/xkeyboard-config/-/commit/470ad2cd8fea84d7210377161d86b31999bb5ea6
+
+Make QEMU always ask for the 'ara' xkb layout, which should work on
+both older and newer xkeyboard-config.  We leave the QEMU name for
+this keyboard layout as 'ar'; it is not the only one where our name
+for it deviates from the xkb standard name.
+
+Cc: qemu-stable@nongnu.org
+Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
+Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1709
+---
+ pc-bios/keymaps/meson.build | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/pc-bios/keymaps/meson.build b/pc-bios/keymaps/meson.build
+index bff30833137..0bd8ce00775 100644
+--- a/pc-bios/keymaps/meson.build
++++ b/pc-bios/keymaps/meson.build
+@@ -1,5 +1,5 @@
+ keymaps = {
+-  'ar': '-l ar',
++  'ar': '-l ara',
+   'bepo': '-l fr -v dvorak',
+   'cz': '-l cz',
+   'da': '-l dk',
+-- 
+2.34.1
diff --git a/srcpkgs/qemu/patches/mmap-mremap-efault.patch b/srcpkgs/qemu/patches/mmap-mremap-efault.patch
deleted file mode 100644
index 5a70e9658b30..000000000000
--- a/srcpkgs/qemu/patches/mmap-mremap-efault.patch
+++ /dev/null
@@ -1,42 +0,0 @@
-Source: @pullmoll
-Upstream: no
-Reason: errno=EFAULT when the address passed to mremap(2) is not valid
-
-See Rich Felker's comment at https://www.openwall.com/lists/musl/2017/06/21/2 for
-why we need to return errno as described in man mremap(2) from qemu-user-static.
-Also speed up the loop when checking for increasing the mappings size to go
-in steps of TARGET_PAGE_SIZE and OR-in a check for the very last byte of the range.
-diff --git linux-user/mmap.c linux-user/mmap.c
-index 7e3b245..1e8d0f1 100644
---- a/linux-user/mmap.c
-+++ b/linux-user/mmap.c
-@@ -738,7 +738,7 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size,
-          !guest_range_valid_untagged(new_addr, new_size)) ||
-         ((flags & MREMAP_MAYMOVE) == 0 &&
-          !guest_range_valid_untagged(old_addr, new_size))) {
--        errno = ENOMEM;
-+        errno = EFAULT;
-         return -1;
-     }
- 
-@@ -775,9 +775,10 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size,
-             abi_ulong addr;
-             for (addr = old_addr + old_size;
-                  addr < old_addr + new_size;
--                 addr++) {
-+                 addr += TARGET_PAGE_SIZE) {
-                 prot |= page_get_flags(addr);
-             }
-+				prot |= page_get_flags(old_addr + new_size - 1);
-         }
-         if (prot == 0) {
-             host_addr = mremap(g2h_untagged(old_addr),
-@@ -796,7 +797,7 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size,
-                 }
-             }
-         } else {
--            errno = ENOMEM;
-+            errno = EFAULT;
-             host_addr = MAP_FAILED;
-         }
-     }
diff --git a/srcpkgs/qemu/patches/musl-initialize-msghdr.patch b/srcpkgs/qemu/patches/musl-initialize-msghdr.patch
index 6d96b3511daf..a88547354c1e 100644
--- a/srcpkgs/qemu/patches/musl-initialize-msghdr.patch
+++ b/srcpkgs/qemu/patches/musl-initialize-msghdr.patch
@@ -1,10 +1,10 @@
 Source: https://github.com/void-linux/void-packages/issues/23557
 
-diff --git linux-user/syscall.c linux-user/syscall.c
-index 945fc25..8d8b68a 100644
+diff --git a/linux-user/syscall.c b/linux-user/syscall.c
+index 14fdebd..de280af 100644
 --- a/linux-user/syscall.c
 +++ b/linux-user/syscall.c
-@@ -3071,7 +3071,7 @@ static abi_long do_sendrecvmsg_locked(int fd, struct target_msghdr *msgp,
+@@ -3229,7 +3229,7 @@ static abi_long do_sendrecvmsg_locked(int fd, struct target_msghdr *msgp,
                                        int flags, int send)
  {
      abi_long ret, len;
diff --git a/srcpkgs/qemu/patches/musl-ppc.patch b/srcpkgs/qemu/patches/musl-ppc.patch
deleted file mode 100644
index 0b77aa8fc63d..000000000000
--- a/srcpkgs/qemu/patches/musl-ppc.patch
+++ /dev/null
@@ -1,25 +0,0 @@
---- a/linux-user/signal.c
-+++ b/linux-user/signal.c
-@@ -21,5 +21,9 @@
- #include "exec/gdbstub.h"
- #include "hw/core/tcg-cpu-ops.h"
- 
-+#if defined(_ARCH_PPC64) && !defined(__GLIBC__) /* musl */
-+#include <asm/ptrace.h>
-+#endif
-+
- #include <sys/ucontext.h>
- #include <sys/resource.h>
---- a/util/mmap-alloc.c
-+++ b/util/mmap-alloc.c
-@@ -25,6 +25,10 @@
- 
- #ifdef CONFIG_LINUX
- #include <sys/vfs.h>
-+/* musl undefs this on ppc and mips */
-+#ifndef MAP_SYNC
-+#define MAP_SYNC 0x80000
-+#endif
- #endif
- 
- size_t qemu_fd_getpagesize(int fd)
diff --git a/srcpkgs/qemu/patches/musl-rlimit-rttime.patch b/srcpkgs/qemu/patches/musl-rlimit-rttime.patch
deleted file mode 100644
index 0cbf9be36a8f..000000000000
--- a/srcpkgs/qemu/patches/musl-rlimit-rttime.patch
+++ /dev/null
@@ -1,13 +0,0 @@
---- a/linux-user/syscall.c
-+++ b/linux-user/syscall.c
-@@ -141,6 +141,10 @@
- #include "fd-trans.h"
- #include "tcg/tcg.h"
- 
-+#ifndef RLIMIT_RTTIME
-+#define RLIMIT_RTTIME 15
-+#endif
-+
- #ifndef CLONE_IO
- #define CLONE_IO                0x80000000      /* Clone io context */
- #endif
diff --git a/srcpkgs/qemu/patches/xxx-ppcle.patch b/srcpkgs/qemu/patches/xxx-ppcle.patch
deleted file mode 100644
index 90b32b5e07cd..000000000000
--- a/srcpkgs/qemu/patches/xxx-ppcle.patch
+++ /dev/null
@@ -1,113 +0,0 @@
-From 7ece08d7902d5a8c007deeb0b75cb533a41dd882 Mon Sep 17 00:00:00 2001
-From: Daniel Kolesa <daniel@octaforge.org>
-Date: Sun, 7 Mar 2021 01:47:42 +0100
-Subject: [PATCH] support ppcle architecture
-
----
- configure                            | 14 ++++++++++++--
- configs/targets/ppcle-linux-user.mak |  4 ++++
- linux-user/ppc/target_syscall.h      |  4 ++++
- scripts/qemu-binfmt-conf.sh          |  6 +++++-
- tests/tcg/configure.sh               |  2 ++
- 5 files changed, 27 insertions(+), 3 deletions(-)
- create mode 100644 configs/targets/ppcle-linux-user.mak
-
-diff --git a/configure b/configure
-index 18c26e0..03d3e18 100755
---- a/configure
-+++ b/configure
-@@ -653,7 +653,11 @@ elif check_define _ARCH_PPC ; then
-       cpu="ppc64"
-     fi
-   else
--    cpu="ppc"
-+    if check_define _LITTLE_ENDIAN ; then
-+      cpu="ppcle"
-+    else
-+      cpu="ppc"
-+    fi
-   fi
- elif check_define __mips__ ; then
-   cpu="mips"
-@@ -638,6 +642,9 @@
- 
-   ppc)
-     CPU_CFLAGS="-m32" ;;
-+  ppcle)
-+    cpu="ppc"
-+    CPU_CFLAGS="-m32 -mlittle-endian" ;;
-   ppc64)
-     CPU_CFLAGS="-m64 -mbig-endian" ;;
-   ppc64le)
-diff --git a/configs/targets/ppcle-linux-user.mak b/configs/targets/ppcle-linux-user.mak
-new file mode 100644
-index 0000000..2259243
---- /dev/null
-+++ b/configs/targets/ppcle-linux-user.mak
-@@ -0,0 +1,4 @@
-+TARGET_ARCH=ppc
-+TARGET_SYSTBL_ABI=common,nospu,32
-+TARGET_SYSTBL=syscall.tbl
-+TARGET_XML_FILES= gdb-xml/power-core.xml gdb-xml/power-fpu.xml gdb-xml/power-altivec.xml gdb-xml/power-spe.xml
-diff --git a/linux-user/ppc/target_syscall.h b/linux-user/ppc/target_syscall.h
-index b9c4b81..cf26497 100644
---- a/linux-user/ppc/target_syscall.h
-+++ b/linux-user/ppc/target_syscall.h
-@@ -65,7 +65,11 @@ struct target_revectored_struct {
- #define UNAME_MACHINE "ppc64le"
- #endif
- #else
-+#if TARGET_BIG_ENDIAN
- #define UNAME_MACHINE "ppc"
-+#else
-+#define UNAME_MACHINE "ppcle"
-+#endif
- #endif
- #define UNAME_MINIMUM_RELEASE "2.6.32"
- 
-diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh
-index 9f1580a..393943f 100755
---- a/scripts/qemu-binfmt-conf.sh
-+++ b/scripts/qemu-binfmt-conf.sh
-@@ -46,6 +46,10 @@ ppc_magic='\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x
- ppc_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
- ppc_family=ppc
- 
-+ppcle_magic='\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x14\x00'
-+ppcle_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\x00'
-+ppc_family=ppcle
-+
- ppc64_magic='\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x15'
- ppc64_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
- ppc64_family=ppc
-@@ -148,7 +152,7 @@ qemu_get_family() {
-     "Power Macintosh"|ppc64|powerpc|ppc)
-         echo "ppc"
-         ;;
--    ppc64el|ppc64le)
-+    ppc64el|ppc64le|ppcel|ppcle)
-         echo "ppcle"
-         ;;
-     arm|armel|armhf|arm64|armv[4-9]*l|aarch64)
-diff --git a/configure b/configure
-index 72ab03f11a..0691929d76 100755
---- a/configure
-+++ b/configure
-@@ -1866,6 +1866,7 @@ fi
- : ${cross_prefix_mips="mips-linux-gnu-"}
- : ${cross_prefix_nios2="nios2-linux-gnu-"}
- : ${cross_prefix_ppc="powerpc-linux-gnu-"}
-+: ${cross_prefix_ppcle="powerpcle-linux-gnu-"}
- : ${cross_prefix_ppc64="powerpc64-linux-gnu-"}
- : ${cross_prefix_ppc64le="$cross_prefix_ppc64"}
- : ${cross_prefix_riscv64="riscv64-linux-gnu-"}
-@@ -1883,6 +1884,7 @@ fi
- : ${cross_cc_cflags_hexagon="-mv67 -O2 -static"}
- : ${cross_cc_cflags_i386="-m32"}
- : ${cross_cc_cflags_ppc="-m32 -mbig-endian"}
-+: ${cross_cc_cflags_ppcle="-m32"}
- : ${cross_cc_cflags_ppc64="-m64 -mbig-endian"}
- : ${cross_cc_ppc64le="$cross_cc_ppc64"}
- : ${cross_cc_cflags_ppc64le="-m64 -mlittle-endian"}
-2.30.1
-
diff --git a/srcpkgs/qemu/template b/srcpkgs/qemu/template
index 48ab199e5686..1ab53eeef726 100644
--- a/srcpkgs/qemu/template
+++ b/srcpkgs/qemu/template
@@ -1,8 +1,8 @@
 # Template file for 'qemu'
 # This package should be updated together with qemu-user-static
 pkgname=qemu
-version=7.1.0
-revision=2
+version=8.0.2
+revision=1
 build_style=configure
 configure_args="--prefix=/usr --sysconfdir=/etc --libexecdir=/usr/libexec --localstatedir=/var
  --disable-glusterfs --disable-xen --enable-docs --enable-kvm --enable-libusb --enable-pie
@@ -10,10 +10,10 @@ configure_args="--prefix=/usr --sysconfdir=/etc --libexecdir=/usr/libexec --loca
  --audio-drv-list=alsa$(vopt_if sdl2 ,sdl)$(vopt_if jack ,jack)$(vopt_if pulseaudio ,pa)
  $(vopt_enable opengl) $(vopt_enable pulseaudio pa) $(vopt_enable sdl2 sdl) $(vopt_enable smartcard)
  $(vopt_enable spice) $(vopt_enable virgl virglrenderer) $(vopt_if gtk3 '--enable-gtk')"
-hostmakedepends="gettext pkg-config perl python3 python3-Sphinx python3-sphinx_rtd_theme ninja"
+hostmakedepends="flex gettext glib-devel pkg-config perl python3 python3-Sphinx python3-sphinx_rtd_theme ninja"
 makedepends="capstone-devel dtc-devel libpng-devel libjpeg-turbo-devel pixman-devel
- snappy-devel libuuid-devel libX11-devel alsa-lib-devel libaio-devel gnutls-devel
- libsasl-devel libglib-devel ncurses-devel libseccomp-devel nss-devel
+ snappy-devel libuuid-devel libX11-devel alsa-lib-devel libaio-devel
+ gnutls-devel libsasl-devel ncurses-devel libseccomp-devel nss-devel
  libcurl-devel xfsprogs-devel libcap-ng-devel vde2-devel usbredir-devel
  libbluetooth-devel libssh2-devel libusb-devel libnfs-devel libslirp-devel
  libxkbcommon-devel libzstd-devel $(vopt_if sdl2 'SDL2-devel SDL2_image-devel')
@@ -25,10 +25,10 @@ makedepends="capstone-devel dtc-devel libpng-devel libjpeg-turbo-devel pixman-de
  $(vopt_if jack 'jack-devel') $(vopt_if pulseaudio 'pulseaudio-devel')"
 short_desc="Open Source Processor Emulator"
 maintainer="Orphaned <orphan@voidlinux.org>"
-license="GPL-2.0-or-later, LGPL-2.1-or-later"
+license="GPL-2.0-only, LGPL-2.1-only"
 homepage="https://www.qemu.org"
 distfiles="https://wiki.qemu.org/download/qemu-${version}.tar.bz2"
-checksum=f7ac2b85b3f1831e6810b140306e30af91556e15784864b209f3942858947fd0
+checksum=b59281923d60d358a7d7d3bde46ba43c0810d34d26608fcdaf6bf4c42492b694
 ignore_elf_dirs="/usr/share/qemu"
 nostrip_files="hppa-firmware.img openbios-ppc openbios-sparc32 openbios-sparc64
  palcode-clipper s390-ccw.img s390-netboot.img u-boot.e500 opensbi-riscv32-generic-fw_dynamic.elf
@@ -43,37 +43,12 @@ desc_option_smartcard="Enable smartcard support"
 desc_option_numa="Enable support for host NUMA"
 desc_option_iscsi="Enable support for iSCSI"
 
-case "$XBPS_TARGET_MACHINE" in
-	aarch64-musl) CFLAGS="-D_LINUX_SYSINFO_H";;
-esac
-
-if [ "$XBPS_TARGET_ENDIAN" = "le" ]; then
-	build_options_default+=" spice"
-fi
-
 if [ "$CROSS_BUILD" ]; then
-	configure_args+=" --cross-prefix=${XBPS_CROSS_TRIPLET}-"
+	configure_args+=" --cross-prefix=${XBPS_CROSS_TRIPLET}"
 else
 	build_options_default+=" smartcard"
 fi
 
-if [ "$XBPS_CHECK_PKGS" != full ]; then
-	make_check_target=check-unit
-fi
-
-post_extract() {
-	if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
-		grep -rl 'Input/output error' tests/qemu-iotests |
-			xargs -n1 sed -i -e 's;Input/output error;I/O error;g'
-		grep -rl 'Operation not supported' tests/qemu-iotests |
-			xargs -n1 sed -i -e 's;Operation not supported;Not supported;g'
-	fi
-}
-
-pre_configure() {
-	unset CPP
-}
-
 post_install() {
 	vdoc "${FILESDIR}/README.voidlinux"
 

From 472fe2598d424e26df3ab233ee19abae18afb4a9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Cerqueira?= <acerqueira021@gmail.com>
Date: Mon, 3 Jul 2023 18:41:30 +0100
Subject: [PATCH 2/2] qemu-user-static: update to 8.0.2.

---
 srcpkgs/qemu-user-static/template | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/srcpkgs/qemu-user-static/template b/srcpkgs/qemu-user-static/template
index 2a8da9b53f2d..113ada9f7556 100644
--- a/srcpkgs/qemu-user-static/template
+++ b/srcpkgs/qemu-user-static/template
@@ -1,20 +1,20 @@
 # Template file for 'qemu-user-static'
 # This package should be updated together with qemu
 pkgname=qemu-user-static
-version=7.1.0
-revision=3
+version=8.0.2
+revision=1
 build_style=configure
 configure_args="--prefix=/usr --sysconfdir=/etc --libexecdir=/usr/libexec
  --disable-kvm --disable-png --disable-virtfs --disable-fdt --disable-seccomp
  --enable-linux-user --disable-system --static --disable-pie"
-hostmakedepends="pkg-config perl python3 ninja"
+hostmakedepends="flex pkg-config perl python3 ninja"
 makedepends="dtc-devel libglib-devel pixman-devel libuuid-devel"
 short_desc="QEMU User-mode emulators (statically compiled)"
 maintainer="Orphaned <orphan@voidlinux.org>"
-license="GPL-2.0-or-later, LGPL-2.1-or-later"
+license="GPL-2.0-only, LGPL-2.1-only"
 homepage="https://www.qemu.org"
 distfiles="https://wiki.qemu.org/download/qemu-${version}.tar.bz2"
-checksum=f7ac2b85b3f1831e6810b140306e30af91556e15784864b209f3942858947fd0
+checksum=b59281923d60d358a7d7d3bde46ba43c0810d34d26608fcdaf6bf4c42492b694
 
 _fmts="aarch64 aarch64_be alpha arm armeb cris hppa i386 m68k microblaze
  microblazeel mips mipsel mips64 mips64el mipsn32 mipsn32el or1k
@@ -111,10 +111,6 @@ done
 
 binfmts="${binfmts%?}"
 
-pre_configure() {
-	unset CPP
-}
-
 post_install() {
 	# Remove unneeded stuff.
 	rm -rf ${DESTDIR}/etc ${DESTDIR}/usr/share ${DESTDIR}/usr/libexec

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [PR PATCH] [Updated] qemu: update to 8.0.2.
  2023-07-03 17:50 [PR PATCH] qemu: update to 8.0.2 motorto
@ 2023-07-03 17:55 ` motorto
  2023-07-03 17:59 ` motorto
                   ` (37 subsequent siblings)
  38 siblings, 0 replies; 40+ messages in thread
From: motorto @ 2023-07-03 17:55 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1407 bytes --]

There is an updated pull request by motorto against master on the void-packages repository

https://github.com/motorto/void-packages qemu-8.0.2
https://github.com/void-linux/void-packages/pull/44822

qemu: update to 8.0.2.
<!-- Uncomment relevant sections and delete options which are not applicable -->
[ci-skip] 
#### Testing the changes
- I tested the changes in this PR: **NO**, still haven't had the time to. Opening to have feedback on it and possible some testers as well.


Removed a bunch of patches that in my research are no longer needed:

- Removed all ppc related patches since that arch isn't no longer supported.
- gcc12.patch: because it builds fine now in this version
- fix-softfloat-fesetround.patch: don't have a system to try it, but alpine doesn't have any patch related to this)
- mmap-mremap-efaul: not sure about if we should keep this one

Kept this patches:

- musl-initialize-msghdr.patch: just update in order to apply.

Added this ones:

- CVE-2023-2861.patch:
- keymap.patch: xkeyboard-config 2.39 removed the legacy alias of ar -> ara

#### Local build testing
- I built this PR locally for my native architecture, x86-64-glibc
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl (cross)
  - x86_64-musl



A patch file from https://github.com/void-linux/void-packages/pull/44822.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-qemu-8.0.2-44822.patch --]
[-- Type: text/x-diff, Size: 33478 bytes --]

From 82918d8df95dae11907161123726522efd6b9c64 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Cerqueira?= <acerqueira021@gmail.com>
Date: Mon, 3 Jul 2023 18:41:12 +0100
Subject: [PATCH 1/2] qemu: update to 8.0.2.

---
 srcpkgs/qemu/patches/CVE-2023-2861.patch      | 177 ++++++++++++++++++
 .../qemu/patches/fix-linux-user-ppc32.patch   | 117 ------------
 .../patches/fix-softfloat-fesetround.patch    |  39 ----
 srcpkgs/qemu/patches/gcc12.patch              |  72 -------
 srcpkgs/qemu/patches/keymap.patch             |  47 +++++
 srcpkgs/qemu/patches/mmap-mremap-efault.patch |  42 -----
 .../qemu/patches/musl-initialize-msghdr.patch |   6 +-
 srcpkgs/qemu/patches/musl-ppc.patch           |  25 ---
 srcpkgs/qemu/patches/musl-rlimit-rttime.patch |  13 --
 srcpkgs/qemu/patches/xxx-ppcle.patch          | 113 -----------
 srcpkgs/qemu/template                         |  41 +---
 11 files changed, 235 insertions(+), 457 deletions(-)
 create mode 100644 srcpkgs/qemu/patches/CVE-2023-2861.patch
 delete mode 100644 srcpkgs/qemu/patches/fix-linux-user-ppc32.patch
 delete mode 100644 srcpkgs/qemu/patches/fix-softfloat-fesetround.patch
 delete mode 100644 srcpkgs/qemu/patches/gcc12.patch
 create mode 100644 srcpkgs/qemu/patches/keymap.patch
 delete mode 100644 srcpkgs/qemu/patches/mmap-mremap-efault.patch
 delete mode 100644 srcpkgs/qemu/patches/musl-ppc.patch
 delete mode 100644 srcpkgs/qemu/patches/musl-rlimit-rttime.patch
 delete mode 100644 srcpkgs/qemu/patches/xxx-ppcle.patch

diff --git a/srcpkgs/qemu/patches/CVE-2023-2861.patch b/srcpkgs/qemu/patches/CVE-2023-2861.patch
new file mode 100644
index 000000000000..dca869f1d77f
--- /dev/null
+++ b/srcpkgs/qemu/patches/CVE-2023-2861.patch
@@ -0,0 +1,177 @@
+Patch-Source: https://gitlab.com/qemu-project/qemu/-/commit/b9d2887be4e616cdaeedd0b7456bfaa71ee798af
+--
+From b9d2887be4e616cdaeedd0b7456bfaa71ee798af Mon Sep 17 00:00:00 2001
+From: Christian Schoenebeck <qemu_oss@crudebyte.com>
+Date: Wed, 7 Jun 2023 18:29:33 +0200
+Subject: [PATCH] 9pfs: prevent opening special files (CVE-2023-2861)
+
+The 9p protocol does not specifically define how server shall behave when
+client tries to open a special file, however from security POV it does
+make sense for 9p server to prohibit opening any special file on host side
+in general. A sane Linux 9p client for instance would never attempt to
+open a special file on host side, it would always handle those exclusively
+on its guest side. A malicious client however could potentially escape
+from the exported 9p tree by creating and opening a device file on host
+side.
+
+With QEMU this could only be exploited in the following unsafe setups:
+
+  - Running QEMU binary as root AND 9p 'local' fs driver AND 'passthrough'
+    security model.
+
+or
+
+  - Using 9p 'proxy' fs driver (which is running its helper daemon as
+    root).
+
+These setups were already discouraged for safety reasons before,
+however for obvious reasons we are now tightening behaviour on this.
+
+Fixes: CVE-2023-2861
+Reported-by: Yanwu Shen <ywsPlz@gmail.com>
+Reported-by: Jietao Xiao <shawtao1125@gmail.com>
+Reported-by: Jinku Li <jkli@xidian.edu.cn>
+Reported-by: Wenbo Shen <shenwenbo@zju.edu.cn>
+Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
+Reviewed-by: Greg Kurz <groug@kaod.org>
+Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
+Message-Id: <E1q6w7r-0000Q0-NM@lizzy.crudebyte.com>
+(cherry picked from commit f6b0de53fb87ddefed348a39284c8e2f28dc4eda)
+Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
+---
+ fsdev/virtfs-proxy-helper.c | 27 +++++++++++++++++++++++--
+ hw/9pfs/9p-util.h           | 39 +++++++++++++++++++++++++++++++++++++
+ 2 files changed, 64 insertions(+), 2 deletions(-)
+
+diff --git a/fsdev/virtfs-proxy-helper.c b/fsdev/virtfs-proxy-helper.c
+index 5cafcd77031..d9511f429c9 100644
+--- a/fsdev/virtfs-proxy-helper.c
++++ b/fsdev/virtfs-proxy-helper.c
+@@ -26,6 +26,7 @@
+ #include "qemu/xattr.h"
+ #include "9p-iov-marshal.h"
+ #include "hw/9pfs/9p-proxy.h"
++#include "hw/9pfs/9p-util.h"
+ #include "fsdev/9p-iov-marshal.h"
+ 
+ #define PROGNAME "virtfs-proxy-helper"
+@@ -338,6 +339,28 @@ static void resetugid(int suid, int sgid)
+     }
+ }
+ 
++/*
++ * Open regular file or directory. Attempts to open any special file are
++ * rejected.
++ *
++ * returns file descriptor or -1 on error
++ */
++static int open_regular(const char *pathname, int flags, mode_t mode)
++{
++    int fd;
++
++    fd = open(pathname, flags, mode);
++    if (fd < 0) {
++        return fd;
++    }
++
++    if (close_if_special_file(fd) < 0) {
++        return -1;
++    }
++
++    return fd;
++}
++
+ /*
+  * send response in two parts
+  * 1) ProxyHeader
+@@ -682,7 +705,7 @@ static int do_create(struct iovec *iovec)
+     if (ret < 0) {
+         goto unmarshal_err_out;
+     }
+-    ret = open(path.data, flags, mode);
++    ret = open_regular(path.data, flags, mode);
+     if (ret < 0) {
+         ret = -errno;
+     }
+@@ -707,7 +730,7 @@ static int do_open(struct iovec *iovec)
+     if (ret < 0) {
+         goto err_out;
+     }
+-    ret = open(path.data, flags);
++    ret = open_regular(path.data, flags, 0);
+     if (ret < 0) {
+         ret = -errno;
+     }
+diff --git a/hw/9pfs/9p-util.h b/hw/9pfs/9p-util.h
+index c314cf381d4..df1b583a5e4 100644
+--- a/hw/9pfs/9p-util.h
++++ b/hw/9pfs/9p-util.h
+@@ -13,6 +13,8 @@
+ #ifndef QEMU_9P_UTIL_H
+ #define QEMU_9P_UTIL_H
+ 
++#include "qemu/error-report.h"
++
+ #ifdef O_PATH
+ #define O_PATH_9P_UTIL O_PATH
+ #else
+@@ -95,6 +97,7 @@ static inline int errno_to_dotl(int err) {
+ #endif
+ 
+ #define qemu_openat     openat
++#define qemu_fstat      fstat
+ #define qemu_fstatat    fstatat
+ #define qemu_mkdirat    mkdirat
+ #define qemu_renameat   renameat
+@@ -108,6 +111,38 @@ static inline void close_preserve_errno(int fd)
+     errno = serrno;
+ }
+ 
++/**
++ * close_if_special_file() - Close @fd if neither regular file nor directory.
++ *
++ * @fd: file descriptor of open file
++ * Return: 0 on regular file or directory, -1 otherwise
++ *
++ * CVE-2023-2861: Prohibit opening any special file directly on host
++ * (especially device files), as a compromised client could potentially gain
++ * access outside exported tree under certain, unsafe setups. We expect
++ * client to handle I/O on special files exclusively on guest side.
++ */
++static inline int close_if_special_file(int fd)
++{
++    struct stat stbuf;
++
++    if (qemu_fstat(fd, &stbuf) < 0) {
++        close_preserve_errno(fd);
++        return -1;
++    }
++    if (!S_ISREG(stbuf.st_mode) && !S_ISDIR(stbuf.st_mode)) {
++        error_report_once(
++            "9p: broken or compromised client detected; attempt to open "
++            "special file (i.e. neither regular file, nor directory)"
++        );
++        close(fd);
++        errno = ENXIO;
++        return -1;
++    }
++
++    return 0;
++}
++
+ static inline int openat_dir(int dirfd, const char *name)
+ {
+     return qemu_openat(dirfd, name,
+@@ -142,6 +177,10 @@ again:
+         return -1;
+     }
+ 
++    if (close_if_special_file(fd) < 0) {
++        return -1;
++    }
++
+     serrno = errno;
+     /* O_NONBLOCK was only needed to open the file. Let's drop it. We don't
+      * do that with O_PATH since fcntl(F_SETFL) isn't supported, and openat()
+-- 
+GitLab
diff --git a/srcpkgs/qemu/patches/fix-linux-user-ppc32.patch b/srcpkgs/qemu/patches/fix-linux-user-ppc32.patch
deleted file mode 100644
index cd47435d5aa9..000000000000
--- a/srcpkgs/qemu/patches/fix-linux-user-ppc32.patch
+++ /dev/null
@@ -1,117 +0,0 @@
-commit 37814f62c2cc7aba2eea073014d6c53dcd5bf42c
-Author: q66 <daniel@octaforge.org>
-Date:   Fri Jul 1 16:53:55 2022 +0200
-
-    fix linux-user build on 32-bit ppc
-    
-    Partial revert https://gitlab.com/qemu-project/qemu/-/commit/9d1401b79463e74adbfac69d836789d4e103fb61
-    and https://gitlab.com/qemu-project/qemu/-/commit/0a7e01904d407baa73c1baddbdfc9ccf2ace8356
-
-diff --git a/common-user/host/ppc/safe-syscall.inc.S b/common-user/host/ppc/safe-syscall.inc.S
-new file mode 100644
-index 0000000..e69de29
-diff --git a/common-user/safe-syscall-error.c b/common-user/safe-syscall-error.c
-index cf74b50..a36132c 100644
---- a/common-user/safe-syscall-error.c
-+++ b/common-user/safe-syscall-error.c
-@@ -12,6 +12,7 @@
- #include "qemu/osdep.h"
- #include "user/safe-syscall.h"
- 
-+#if !defined(__powerpc__) || defined(__powerpc64__)
- /*
-  * This is intended to be invoked via tail-call on the error path
-  * from the assembly in host/arch/safe-syscall.inc.S.  This takes
-@@ -23,3 +24,4 @@ long safe_syscall_set_errno_tail(int value)
-     errno = value;
-     return -1;
- }
-+#endif
-diff --git a/include/user/safe-syscall.h b/include/user/safe-syscall.h
-index 61a04e2..793fe84 100644
---- a/include/user/safe-syscall.h
-+++ b/include/user/safe-syscall.h
-@@ -125,6 +125,8 @@
-  * kinds of restartability.
-  */
- 
-+#if !defined(__powerpc__) || defined(__powerpc64__)
-+
- /* The core part of this function is implemented in assembly */
- extern long safe_syscall_base(int *pending, long number, ...);
- extern long safe_syscall_set_errno_tail(int value);
-@@ -137,4 +139,10 @@ extern char safe_syscall_end[];
-     safe_syscall_base(&((TaskState *)thread_cpu->opaque)->signal_pending, \
-                       __VA_ARGS__)
- 
-+#else
-+
-+#define safe_syscall syscall
-+
-+#endif
-+
- #endif
-diff --git a/linux-user/include/host/ppc/host-signal.h b/linux-user/include/host/ppc/host-signal.h
-new file mode 100644
-index 0000000..b80384d
---- /dev/null
-+++ b/linux-user/include/host/ppc/host-signal.h
-@@ -0,0 +1,38 @@
-+/*
-+ * host-signal.h: signal info dependent on the host architecture
-+ *
-+ * Copyright (c) 2003-2005 Fabrice Bellard
-+ * Copyright (c) 2021 Linaro Limited
-+ *
-+ * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
-+ * See the COPYING file in the top-level directory.
-+ */
-+
-+#ifndef PPC_HOST_SIGNAL_H
-+#define PPC_HOST_SIGNAL_H
-+
-+/* The third argument to a SA_SIGINFO handler is ucontext_t. */
-+typedef ucontext_t host_sigcontext;
-+
-+static inline uintptr_t host_signal_pc(host_sigcontext *uc)
-+{
-+    return uc->uc_mcontext.regs->nip;
-+}
-+
-+static inline void host_signal_set_pc(host_sigcontext *uc, uintptr_t pc)
-+{
-+    uc->uc_mcontext.regs->nip = pc;
-+}
-+
-+static inline void *host_signal_mask(host_sigcontext *uc)
-+{
-+    return &uc->uc_sigmask;
-+}
-+
-+static inline bool host_signal_write(siginfo_t *info, host_sigcontext *uc)
-+{
-+    return uc->uc_mcontext.regs->trap != 0x400
-+        && (uc->uc_mcontext.regs->dsisr & 0x02000000);
-+}
-+
-+#endif
-diff --git a/linux-user/signal.c b/linux-user/signal.c
-index 092e70b..b8dfa8a 100644
---- a/linux-user/signal.c
-+++ b/linux-user/signal.c
-@@ -800,6 +800,7 @@ void queue_signal(CPUArchState *env, int sig, int si_type,
- /* Adjust the signal context to rewind out of safe-syscall if we're in it */
- static inline void rewind_if_in_safe_syscall(void *puc)
- {
-+#if !defined(__powerpc__) || defined(__powerpc64__)
-     host_sigcontext *uc = (host_sigcontext *)puc;
-     uintptr_t pcreg = host_signal_pc(uc);
- 
-@@ -807,6 +808,7 @@ static inline void rewind_if_in_safe_syscall(void *puc)
-         && pcreg < (uintptr_t)safe_syscall_end) {
-         host_signal_set_pc(uc, (uintptr_t)safe_syscall_start);
-     }
-+#endif
- }
- 
- static void host_signal_handler(int host_sig, siginfo_t *info, void *puc)
diff --git a/srcpkgs/qemu/patches/fix-softfloat-fesetround.patch b/srcpkgs/qemu/patches/fix-softfloat-fesetround.patch
deleted file mode 100644
index ecdd049f7921..000000000000
--- a/srcpkgs/qemu/patches/fix-softfloat-fesetround.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-Source: @pullmoll
-Upstream: no
-Reason: Target architectures with soft float do not define these constants.
-
---- a/tests/fp/fp-bench.c	2020-12-08 17:59:44.000000000 +0100
-+++ b/tests/fp/fp-bench.c	2020-12-12 20:38:40.702235420 +0100
-@@ -485,16 +485,32 @@
- 
-     switch (rounding) {
-     case ROUND_EVEN:
-+#if defined(FE_TONEAREST)
-         rhost = FE_TONEAREST;
-+#else
-+	return;
-+#endif
-         break;
-     case ROUND_ZERO:
-+#if defined(FE_TOWARDZERO)
-         rhost = FE_TOWARDZERO;
-+#else
-+	return;
-+#endif
-         break;
-     case ROUND_DOWN:
-+#if defined(FE_DOWNWARD)
-         rhost = FE_DOWNWARD;
-+#else
-+	return;
-+#endif
-         break;
-     case ROUND_UP:
-+#if defined(FE_UPWARD)
-         rhost = FE_UPWARD;
-+#else
-+	return;
-+#endif
-         break;
-     case ROUND_TIEAWAY:
-         die_host_rounding(rounding);
diff --git a/srcpkgs/qemu/patches/gcc12.patch b/srcpkgs/qemu/patches/gcc12.patch
deleted file mode 100644
index 2a4b2bd03609..000000000000
--- a/srcpkgs/qemu/patches/gcc12.patch
+++ /dev/null
@@ -1,72 +0,0 @@
-From 5cb993ff131fca2abef3ce074a20258fd6fce557 Mon Sep 17 00:00:00 2001
-From: Bernhard Beschow <shentey@gmail.com>
-Date: Sat, 18 Mar 2023 19:59:31 +0100
-Subject: [PATCH] qemu/osdep: Switch position of "extern" and "G_NORETURN"
-
-Fixes the Windows build under msys2 using GCC 12 which fails with the following
-error:
-
-  [184/579] Compiling C++ object qga/vss-win32/qga-vss.dll.p/install.cpp.obj
-  FAILED: qga/vss-win32/qga-vss.dll.p/install.cpp.obj
-  "c++" "-m64" "-mcx16" "-Iqga/vss-win32/qga-vss.dll.p" "-Iqga/vss-win32" "-I../src/qga/vss-win32" "-I." "-Iqapi" "-Itrace" "-Iui" "-Iui/shader" "-IC:/msys64/mingw64/include/glib-2.0" "-IC:/msys64/mingw64/lib/glib-2.0/include" "-fdiagnostics-color=auto" "-Wall" "-Winvalid-pch" "-Wnon-virtual-dtor" "-Werror" "-std=gnu++11" "-g" "-iquote" "." "-iquote" "C:/msys64/home/shentey/Projects/qemu/src" "-iquote" "C:/msys64/home/shentey/Projects/qemu/src/include" "-iquote" "C:/msys64/home/shentey/Projects/qemu/src/tcg/i386" "-D__STDC_LIMIT_MACROS" "-D__STDC_CONSTANT_MACROS" "-D__STDC_FORMAT_MACROS" "-fno-pie" "-no-pie" "-D_GNU_SOURCE" "-D_FILE_OFFSET_BITS=64" "-D_LARGEFILE_SOURCE" "-fno-strict-aliasing" "-fno-common" "-fwrapv" "-Wundef" "-Wwrite-strings" "-Wtype-limits" "-Wformat-security" "-Wformat-y2k" "-Winit-self" "-Wignored-qualifiers" "-Wempty-body" "-Wendif-labels" "-Wexpansion-to-defined" "-Wimplicit-fallthrough=2" "-Wmissing-format-attribute" "-Wno-missing-include-dirs" "-Wno-shift-negative-value" "-Wno-psabi" "-fstack-protector-strong" "-Wno-unknown-pragmas" "-Wno-delete-non-virtual-dtor" "-Wno-non-virtual-dtor" -MD -MQ qga/vss-win32/qga-vss.dll.p/install.cpp.obj -MF "qga/vss-win32/qga-vss.dll.p/install.cpp.obj.d" -o qga/vss-win32/qga-vss.dll.p/install.cpp.obj "-c" ../src/qga/vss-win32/install.cpp
-  In file included from C:/msys64/mingw64/lib/glib-2.0/include/glibconfig.h:9,
-              from C:/msys64/mingw64/include/glib-2.0/glib/gtypes.h:34,
-              from C:/msys64/mingw64/include/glib-2.0/glib/galloca.h:34,
-              from C:/msys64/mingw64/include/glib-2.0/glib.h:32,
-              from C:/msys64/home/shentey/Projects/qemu/src/include/glib-compat.h:32,
-              from C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:144,
-              from ../src/qga/vss-win32/install.cpp:13:
-  C:/msys64/mingw64/include/glib-2.0/glib/gmacros.h:1075:21: error: standard attributes in middle of decl-specifiers
-  1075 | # define G_NORETURN [[noreturn]]
-        |                     ^
-  C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:240:8: note: in expansion of macro 'G_NORETURN'
-  240 | extern G_NORETURN
-        |        ^~~~~~~~~~
-  C:/msys64/mingw64/include/glib-2.0/glib/gmacros.h:1075:21: note: standard attributes must precede the decl-specifiers to apply to the declaration, or follow them to apply to the type
-  1075 | # define G_NORETURN [[noreturn]]
-        |                     ^
-  C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:240:8: note: in expansion of macro 'G_NORETURN'
-  240 | extern G_NORETURN
-        |        ^~~~~~~~~~
-  C:/msys64/mingw64/include/glib-2.0/glib/gmacros.h:1075:21: error: attribute ignored [-Werror=attributes]
-  1075 | # define G_NORETURN [[noreturn]]
-        |                     ^
-  C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:240:8: note: in expansion of macro 'G_NORETURN'
-  240 | extern G_NORETURN
-        |        ^~~~~~~~~~
-  C:/msys64/mingw64/include/glib-2.0/glib/gmacros.h:1075:21: note: an attribute that appertains to a type-specifier is ignored
-  1075 | # define G_NORETURN [[noreturn]]
-        |                     ^
-  C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:240:8: note: in expansion of macro 'G_NORETURN'
-  240 | extern G_NORETURN
-        |        ^~~~~~~~~~
-  cc1plus.exe: all warnings being treated as errors
-
-Apparently it also fixes the compilation with Clang 15 (see
-https://gitlab.com/qemu-project/qemu/-/issues/1541 ).
-
-Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1541
-Signed-off-by: Bernhard Beschow <shentey@gmail.com>
-Message-Id: <20230318185931.181659-1-shentey@gmail.com>
-Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
-Signed-off-by: Thomas Huth <thuth@redhat.com>
----
- include/qemu/osdep.h | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
-index f68b5d8708c..9eff0be95bd 100644
---- a/include/qemu/osdep.h
-+++ b/include/qemu/osdep.h
-@@ -237,7 +237,7 @@ extern "C" {
-  * supports QEMU_ERROR, this will be reported at compile time; otherwise
-  * this will be reported at link time due to the missing symbol.
-  */
--extern G_NORETURN
-+G_NORETURN extern
- void QEMU_ERROR("code path is reachable")
-     qemu_build_not_reached_always(void);
- #if defined(__OPTIMIZE__) && !defined(__NO_INLINE__)
--- 
-GitLab
-
diff --git a/srcpkgs/qemu/patches/keymap.patch b/srcpkgs/qemu/patches/keymap.patch
new file mode 100644
index 000000000000..c4d9963cd636
--- /dev/null
+++ b/srcpkgs/qemu/patches/keymap.patch
@@ -0,0 +1,47 @@
+The xkb official name for the Arabic keyboard layout is 'ara'.
+However xkb has for at least the past 15 years also permitted it to
+be named via the legacy synonym 'ar'.  In xkeyboard-config 2.39 this
+synoynm was removed, which breaks compilation of QEMU:
+
+FAILED: pc-bios/keymaps/ar
+/home/fred/qemu-git/src/qemu/build-full/qemu-keymap -f pc-bios/keymaps/ar -l ar
+xkbcommon: ERROR: Couldn't find file "symbols/ar" in include paths
+xkbcommon: ERROR: 1 include paths searched:
+xkbcommon: ERROR: 	/usr/share/X11/xkb
+xkbcommon: ERROR: 3 include paths could not be added:
+xkbcommon: ERROR: 	/home/fred/.config/xkb
+xkbcommon: ERROR: 	/home/fred/.xkb
+xkbcommon: ERROR: 	/etc/xkb
+xkbcommon: ERROR: Abandoning symbols file "(unnamed)"
+xkbcommon: ERROR: Failed to compile xkb_symbols
+xkbcommon: ERROR: Failed to compile keymap
+
+The upstream xkeyboard-config change removing the compat
+mapping is:
+https://gitlab.freedesktop.org/xkeyboard-config/xkeyboard-config/-/commit/470ad2cd8fea84d7210377161d86b31999bb5ea6
+
+Make QEMU always ask for the 'ara' xkb layout, which should work on
+both older and newer xkeyboard-config.  We leave the QEMU name for
+this keyboard layout as 'ar'; it is not the only one where our name
+for it deviates from the xkb standard name.
+
+Cc: qemu-stable@nongnu.org
+Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
+Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1709
+---
+ pc-bios/keymaps/meson.build | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/pc-bios/keymaps/meson.build b/pc-bios/keymaps/meson.build
+index bff30833137..0bd8ce00775 100644
+--- a/pc-bios/keymaps/meson.build
++++ b/pc-bios/keymaps/meson.build
+@@ -1,5 +1,5 @@
+ keymaps = {
+-  'ar': '-l ar',
++  'ar': '-l ara',
+   'bepo': '-l fr -v dvorak',
+   'cz': '-l cz',
+   'da': '-l dk',
+-- 
+2.34.1
diff --git a/srcpkgs/qemu/patches/mmap-mremap-efault.patch b/srcpkgs/qemu/patches/mmap-mremap-efault.patch
deleted file mode 100644
index 5a70e9658b30..000000000000
--- a/srcpkgs/qemu/patches/mmap-mremap-efault.patch
+++ /dev/null
@@ -1,42 +0,0 @@
-Source: @pullmoll
-Upstream: no
-Reason: errno=EFAULT when the address passed to mremap(2) is not valid
-
-See Rich Felker's comment at https://www.openwall.com/lists/musl/2017/06/21/2 for
-why we need to return errno as described in man mremap(2) from qemu-user-static.
-Also speed up the loop when checking for increasing the mappings size to go
-in steps of TARGET_PAGE_SIZE and OR-in a check for the very last byte of the range.
-diff --git linux-user/mmap.c linux-user/mmap.c
-index 7e3b245..1e8d0f1 100644
---- a/linux-user/mmap.c
-+++ b/linux-user/mmap.c
-@@ -738,7 +738,7 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size,
-          !guest_range_valid_untagged(new_addr, new_size)) ||
-         ((flags & MREMAP_MAYMOVE) == 0 &&
-          !guest_range_valid_untagged(old_addr, new_size))) {
--        errno = ENOMEM;
-+        errno = EFAULT;
-         return -1;
-     }
- 
-@@ -775,9 +775,10 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size,
-             abi_ulong addr;
-             for (addr = old_addr + old_size;
-                  addr < old_addr + new_size;
--                 addr++) {
-+                 addr += TARGET_PAGE_SIZE) {
-                 prot |= page_get_flags(addr);
-             }
-+				prot |= page_get_flags(old_addr + new_size - 1);
-         }
-         if (prot == 0) {
-             host_addr = mremap(g2h_untagged(old_addr),
-@@ -796,7 +797,7 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size,
-                 }
-             }
-         } else {
--            errno = ENOMEM;
-+            errno = EFAULT;
-             host_addr = MAP_FAILED;
-         }
-     }
diff --git a/srcpkgs/qemu/patches/musl-initialize-msghdr.patch b/srcpkgs/qemu/patches/musl-initialize-msghdr.patch
index 6d96b3511daf..a88547354c1e 100644
--- a/srcpkgs/qemu/patches/musl-initialize-msghdr.patch
+++ b/srcpkgs/qemu/patches/musl-initialize-msghdr.patch
@@ -1,10 +1,10 @@
 Source: https://github.com/void-linux/void-packages/issues/23557
 
-diff --git linux-user/syscall.c linux-user/syscall.c
-index 945fc25..8d8b68a 100644
+diff --git a/linux-user/syscall.c b/linux-user/syscall.c
+index 14fdebd..de280af 100644
 --- a/linux-user/syscall.c
 +++ b/linux-user/syscall.c
-@@ -3071,7 +3071,7 @@ static abi_long do_sendrecvmsg_locked(int fd, struct target_msghdr *msgp,
+@@ -3229,7 +3229,7 @@ static abi_long do_sendrecvmsg_locked(int fd, struct target_msghdr *msgp,
                                        int flags, int send)
  {
      abi_long ret, len;
diff --git a/srcpkgs/qemu/patches/musl-ppc.patch b/srcpkgs/qemu/patches/musl-ppc.patch
deleted file mode 100644
index 0b77aa8fc63d..000000000000
--- a/srcpkgs/qemu/patches/musl-ppc.patch
+++ /dev/null
@@ -1,25 +0,0 @@
---- a/linux-user/signal.c
-+++ b/linux-user/signal.c
-@@ -21,5 +21,9 @@
- #include "exec/gdbstub.h"
- #include "hw/core/tcg-cpu-ops.h"
- 
-+#if defined(_ARCH_PPC64) && !defined(__GLIBC__) /* musl */
-+#include <asm/ptrace.h>
-+#endif
-+
- #include <sys/ucontext.h>
- #include <sys/resource.h>
---- a/util/mmap-alloc.c
-+++ b/util/mmap-alloc.c
-@@ -25,6 +25,10 @@
- 
- #ifdef CONFIG_LINUX
- #include <sys/vfs.h>
-+/* musl undefs this on ppc and mips */
-+#ifndef MAP_SYNC
-+#define MAP_SYNC 0x80000
-+#endif
- #endif
- 
- size_t qemu_fd_getpagesize(int fd)
diff --git a/srcpkgs/qemu/patches/musl-rlimit-rttime.patch b/srcpkgs/qemu/patches/musl-rlimit-rttime.patch
deleted file mode 100644
index 0cbf9be36a8f..000000000000
--- a/srcpkgs/qemu/patches/musl-rlimit-rttime.patch
+++ /dev/null
@@ -1,13 +0,0 @@
---- a/linux-user/syscall.c
-+++ b/linux-user/syscall.c
-@@ -141,6 +141,10 @@
- #include "fd-trans.h"
- #include "tcg/tcg.h"
- 
-+#ifndef RLIMIT_RTTIME
-+#define RLIMIT_RTTIME 15
-+#endif
-+
- #ifndef CLONE_IO
- #define CLONE_IO                0x80000000      /* Clone io context */
- #endif
diff --git a/srcpkgs/qemu/patches/xxx-ppcle.patch b/srcpkgs/qemu/patches/xxx-ppcle.patch
deleted file mode 100644
index 90b32b5e07cd..000000000000
--- a/srcpkgs/qemu/patches/xxx-ppcle.patch
+++ /dev/null
@@ -1,113 +0,0 @@
-From 7ece08d7902d5a8c007deeb0b75cb533a41dd882 Mon Sep 17 00:00:00 2001
-From: Daniel Kolesa <daniel@octaforge.org>
-Date: Sun, 7 Mar 2021 01:47:42 +0100
-Subject: [PATCH] support ppcle architecture
-
----
- configure                            | 14 ++++++++++++--
- configs/targets/ppcle-linux-user.mak |  4 ++++
- linux-user/ppc/target_syscall.h      |  4 ++++
- scripts/qemu-binfmt-conf.sh          |  6 +++++-
- tests/tcg/configure.sh               |  2 ++
- 5 files changed, 27 insertions(+), 3 deletions(-)
- create mode 100644 configs/targets/ppcle-linux-user.mak
-
-diff --git a/configure b/configure
-index 18c26e0..03d3e18 100755
---- a/configure
-+++ b/configure
-@@ -653,7 +653,11 @@ elif check_define _ARCH_PPC ; then
-       cpu="ppc64"
-     fi
-   else
--    cpu="ppc"
-+    if check_define _LITTLE_ENDIAN ; then
-+      cpu="ppcle"
-+    else
-+      cpu="ppc"
-+    fi
-   fi
- elif check_define __mips__ ; then
-   cpu="mips"
-@@ -638,6 +642,9 @@
- 
-   ppc)
-     CPU_CFLAGS="-m32" ;;
-+  ppcle)
-+    cpu="ppc"
-+    CPU_CFLAGS="-m32 -mlittle-endian" ;;
-   ppc64)
-     CPU_CFLAGS="-m64 -mbig-endian" ;;
-   ppc64le)
-diff --git a/configs/targets/ppcle-linux-user.mak b/configs/targets/ppcle-linux-user.mak
-new file mode 100644
-index 0000000..2259243
---- /dev/null
-+++ b/configs/targets/ppcle-linux-user.mak
-@@ -0,0 +1,4 @@
-+TARGET_ARCH=ppc
-+TARGET_SYSTBL_ABI=common,nospu,32
-+TARGET_SYSTBL=syscall.tbl
-+TARGET_XML_FILES= gdb-xml/power-core.xml gdb-xml/power-fpu.xml gdb-xml/power-altivec.xml gdb-xml/power-spe.xml
-diff --git a/linux-user/ppc/target_syscall.h b/linux-user/ppc/target_syscall.h
-index b9c4b81..cf26497 100644
---- a/linux-user/ppc/target_syscall.h
-+++ b/linux-user/ppc/target_syscall.h
-@@ -65,7 +65,11 @@ struct target_revectored_struct {
- #define UNAME_MACHINE "ppc64le"
- #endif
- #else
-+#if TARGET_BIG_ENDIAN
- #define UNAME_MACHINE "ppc"
-+#else
-+#define UNAME_MACHINE "ppcle"
-+#endif
- #endif
- #define UNAME_MINIMUM_RELEASE "2.6.32"
- 
-diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh
-index 9f1580a..393943f 100755
---- a/scripts/qemu-binfmt-conf.sh
-+++ b/scripts/qemu-binfmt-conf.sh
-@@ -46,6 +46,10 @@ ppc_magic='\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x
- ppc_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
- ppc_family=ppc
- 
-+ppcle_magic='\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x14\x00'
-+ppcle_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\x00'
-+ppc_family=ppcle
-+
- ppc64_magic='\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x15'
- ppc64_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
- ppc64_family=ppc
-@@ -148,7 +152,7 @@ qemu_get_family() {
-     "Power Macintosh"|ppc64|powerpc|ppc)
-         echo "ppc"
-         ;;
--    ppc64el|ppc64le)
-+    ppc64el|ppc64le|ppcel|ppcle)
-         echo "ppcle"
-         ;;
-     arm|armel|armhf|arm64|armv[4-9]*l|aarch64)
-diff --git a/configure b/configure
-index 72ab03f11a..0691929d76 100755
---- a/configure
-+++ b/configure
-@@ -1866,6 +1866,7 @@ fi
- : ${cross_prefix_mips="mips-linux-gnu-"}
- : ${cross_prefix_nios2="nios2-linux-gnu-"}
- : ${cross_prefix_ppc="powerpc-linux-gnu-"}
-+: ${cross_prefix_ppcle="powerpcle-linux-gnu-"}
- : ${cross_prefix_ppc64="powerpc64-linux-gnu-"}
- : ${cross_prefix_ppc64le="$cross_prefix_ppc64"}
- : ${cross_prefix_riscv64="riscv64-linux-gnu-"}
-@@ -1883,6 +1884,7 @@ fi
- : ${cross_cc_cflags_hexagon="-mv67 -O2 -static"}
- : ${cross_cc_cflags_i386="-m32"}
- : ${cross_cc_cflags_ppc="-m32 -mbig-endian"}
-+: ${cross_cc_cflags_ppcle="-m32"}
- : ${cross_cc_cflags_ppc64="-m64 -mbig-endian"}
- : ${cross_cc_ppc64le="$cross_cc_ppc64"}
- : ${cross_cc_cflags_ppc64le="-m64 -mlittle-endian"}
-2.30.1
-
diff --git a/srcpkgs/qemu/template b/srcpkgs/qemu/template
index 48ab199e5686..1ab53eeef726 100644
--- a/srcpkgs/qemu/template
+++ b/srcpkgs/qemu/template
@@ -1,8 +1,8 @@
 # Template file for 'qemu'
 # This package should be updated together with qemu-user-static
 pkgname=qemu
-version=7.1.0
-revision=2
+version=8.0.2
+revision=1
 build_style=configure
 configure_args="--prefix=/usr --sysconfdir=/etc --libexecdir=/usr/libexec --localstatedir=/var
  --disable-glusterfs --disable-xen --enable-docs --enable-kvm --enable-libusb --enable-pie
@@ -10,10 +10,10 @@ configure_args="--prefix=/usr --sysconfdir=/etc --libexecdir=/usr/libexec --loca
  --audio-drv-list=alsa$(vopt_if sdl2 ,sdl)$(vopt_if jack ,jack)$(vopt_if pulseaudio ,pa)
  $(vopt_enable opengl) $(vopt_enable pulseaudio pa) $(vopt_enable sdl2 sdl) $(vopt_enable smartcard)
  $(vopt_enable spice) $(vopt_enable virgl virglrenderer) $(vopt_if gtk3 '--enable-gtk')"
-hostmakedepends="gettext pkg-config perl python3 python3-Sphinx python3-sphinx_rtd_theme ninja"
+hostmakedepends="flex gettext glib-devel pkg-config perl python3 python3-Sphinx python3-sphinx_rtd_theme ninja"
 makedepends="capstone-devel dtc-devel libpng-devel libjpeg-turbo-devel pixman-devel
- snappy-devel libuuid-devel libX11-devel alsa-lib-devel libaio-devel gnutls-devel
- libsasl-devel libglib-devel ncurses-devel libseccomp-devel nss-devel
+ snappy-devel libuuid-devel libX11-devel alsa-lib-devel libaio-devel
+ gnutls-devel libsasl-devel ncurses-devel libseccomp-devel nss-devel
  libcurl-devel xfsprogs-devel libcap-ng-devel vde2-devel usbredir-devel
  libbluetooth-devel libssh2-devel libusb-devel libnfs-devel libslirp-devel
  libxkbcommon-devel libzstd-devel $(vopt_if sdl2 'SDL2-devel SDL2_image-devel')
@@ -25,10 +25,10 @@ makedepends="capstone-devel dtc-devel libpng-devel libjpeg-turbo-devel pixman-de
  $(vopt_if jack 'jack-devel') $(vopt_if pulseaudio 'pulseaudio-devel')"
 short_desc="Open Source Processor Emulator"
 maintainer="Orphaned <orphan@voidlinux.org>"
-license="GPL-2.0-or-later, LGPL-2.1-or-later"
+license="GPL-2.0-only, LGPL-2.1-only"
 homepage="https://www.qemu.org"
 distfiles="https://wiki.qemu.org/download/qemu-${version}.tar.bz2"
-checksum=f7ac2b85b3f1831e6810b140306e30af91556e15784864b209f3942858947fd0
+checksum=b59281923d60d358a7d7d3bde46ba43c0810d34d26608fcdaf6bf4c42492b694
 ignore_elf_dirs="/usr/share/qemu"
 nostrip_files="hppa-firmware.img openbios-ppc openbios-sparc32 openbios-sparc64
  palcode-clipper s390-ccw.img s390-netboot.img u-boot.e500 opensbi-riscv32-generic-fw_dynamic.elf
@@ -43,37 +43,12 @@ desc_option_smartcard="Enable smartcard support"
 desc_option_numa="Enable support for host NUMA"
 desc_option_iscsi="Enable support for iSCSI"
 
-case "$XBPS_TARGET_MACHINE" in
-	aarch64-musl) CFLAGS="-D_LINUX_SYSINFO_H";;
-esac
-
-if [ "$XBPS_TARGET_ENDIAN" = "le" ]; then
-	build_options_default+=" spice"
-fi
-
 if [ "$CROSS_BUILD" ]; then
-	configure_args+=" --cross-prefix=${XBPS_CROSS_TRIPLET}-"
+	configure_args+=" --cross-prefix=${XBPS_CROSS_TRIPLET}"
 else
 	build_options_default+=" smartcard"
 fi
 
-if [ "$XBPS_CHECK_PKGS" != full ]; then
-	make_check_target=check-unit
-fi
-
-post_extract() {
-	if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
-		grep -rl 'Input/output error' tests/qemu-iotests |
-			xargs -n1 sed -i -e 's;Input/output error;I/O error;g'
-		grep -rl 'Operation not supported' tests/qemu-iotests |
-			xargs -n1 sed -i -e 's;Operation not supported;Not supported;g'
-	fi
-}
-
-pre_configure() {
-	unset CPP
-}
-
 post_install() {
 	vdoc "${FILESDIR}/README.voidlinux"
 

From 88c10f9a739b633b16d90438bbab7ffe09da709d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Cerqueira?= <acerqueira021@gmail.com>
Date: Mon, 3 Jul 2023 18:41:30 +0100
Subject: [PATCH 2/2] qemu-user-static: update to 8.0.2.

---
 srcpkgs/qemu-user-static/template | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/srcpkgs/qemu-user-static/template b/srcpkgs/qemu-user-static/template
index 2a8da9b53f2d..0198ecd9fe9e 100644
--- a/srcpkgs/qemu-user-static/template
+++ b/srcpkgs/qemu-user-static/template
@@ -1,20 +1,20 @@
 # Template file for 'qemu-user-static'
 # This package should be updated together with qemu
 pkgname=qemu-user-static
-version=7.1.0
-revision=3
+version=8.0.2
+revision=1
 build_style=configure
 configure_args="--prefix=/usr --sysconfdir=/etc --libexecdir=/usr/libexec
  --disable-kvm --disable-png --disable-virtfs --disable-fdt --disable-seccomp
  --enable-linux-user --disable-system --static --disable-pie"
-hostmakedepends="pkg-config perl python3 ninja"
-makedepends="dtc-devel libglib-devel pixman-devel libuuid-devel"
+hostmakedepends="flex glib-devel pkg-config perl python3 ninja"
+makedepends="dtc-devel pixman-devel libuuid-devel"
 short_desc="QEMU User-mode emulators (statically compiled)"
 maintainer="Orphaned <orphan@voidlinux.org>"
-license="GPL-2.0-or-later, LGPL-2.1-or-later"
+license="GPL-2.0-only, LGPL-2.1-only"
 homepage="https://www.qemu.org"
 distfiles="https://wiki.qemu.org/download/qemu-${version}.tar.bz2"
-checksum=f7ac2b85b3f1831e6810b140306e30af91556e15784864b209f3942858947fd0
+checksum=b59281923d60d358a7d7d3bde46ba43c0810d34d26608fcdaf6bf4c42492b694
 
 _fmts="aarch64 aarch64_be alpha arm armeb cris hppa i386 m68k microblaze
  microblazeel mips mipsel mips64 mips64el mipsn32 mipsn32el or1k
@@ -111,10 +111,6 @@ done
 
 binfmts="${binfmts%?}"
 
-pre_configure() {
-	unset CPP
-}
-
 post_install() {
 	# Remove unneeded stuff.
 	rm -rf ${DESTDIR}/etc ${DESTDIR}/usr/share ${DESTDIR}/usr/libexec

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [PR PATCH] [Updated] qemu: update to 8.0.2.
  2023-07-03 17:50 [PR PATCH] qemu: update to 8.0.2 motorto
  2023-07-03 17:55 ` [PR PATCH] [Updated] " motorto
@ 2023-07-03 17:59 ` motorto
  2023-07-04 13:28 ` motorto
                   ` (36 subsequent siblings)
  38 siblings, 0 replies; 40+ messages in thread
From: motorto @ 2023-07-03 17:59 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1407 bytes --]

There is an updated pull request by motorto against master on the void-packages repository

https://github.com/motorto/void-packages qemu-8.0.2
https://github.com/void-linux/void-packages/pull/44822

qemu: update to 8.0.2.
<!-- Uncomment relevant sections and delete options which are not applicable -->
[ci-skip] 
#### Testing the changes
- I tested the changes in this PR: **NO**, still haven't had the time to. Opening to have feedback on it and possible some testers as well.


Removed a bunch of patches that in my research are no longer needed:

- Removed all ppc related patches since that arch isn't no longer supported.
- gcc12.patch: because it builds fine now in this version
- fix-softfloat-fesetround.patch: don't have a system to try it, but alpine doesn't have any patch related to this)
- mmap-mremap-efaul: not sure about if we should keep this one

Kept this patches:

- musl-initialize-msghdr.patch: just update in order to apply.

Added this ones:

- CVE-2023-2861.patch:
- keymap.patch: xkeyboard-config 2.39 removed the legacy alias of ar -> ara

#### Local build testing
- I built this PR locally for my native architecture, x86-64-glibc
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl (cross)
  - x86_64-musl



A patch file from https://github.com/void-linux/void-packages/pull/44822.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-qemu-8.0.2-44822.patch --]
[-- Type: text/x-diff, Size: 33423 bytes --]

From 82918d8df95dae11907161123726522efd6b9c64 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Cerqueira?= <acerqueira021@gmail.com>
Date: Mon, 3 Jul 2023 18:41:12 +0100
Subject: [PATCH 1/2] qemu: update to 8.0.2.

---
 srcpkgs/qemu/patches/CVE-2023-2861.patch      | 177 ++++++++++++++++++
 .../qemu/patches/fix-linux-user-ppc32.patch   | 117 ------------
 .../patches/fix-softfloat-fesetround.patch    |  39 ----
 srcpkgs/qemu/patches/gcc12.patch              |  72 -------
 srcpkgs/qemu/patches/keymap.patch             |  47 +++++
 srcpkgs/qemu/patches/mmap-mremap-efault.patch |  42 -----
 .../qemu/patches/musl-initialize-msghdr.patch |   6 +-
 srcpkgs/qemu/patches/musl-ppc.patch           |  25 ---
 srcpkgs/qemu/patches/musl-rlimit-rttime.patch |  13 --
 srcpkgs/qemu/patches/xxx-ppcle.patch          | 113 -----------
 srcpkgs/qemu/template                         |  41 +---
 11 files changed, 235 insertions(+), 457 deletions(-)
 create mode 100644 srcpkgs/qemu/patches/CVE-2023-2861.patch
 delete mode 100644 srcpkgs/qemu/patches/fix-linux-user-ppc32.patch
 delete mode 100644 srcpkgs/qemu/patches/fix-softfloat-fesetround.patch
 delete mode 100644 srcpkgs/qemu/patches/gcc12.patch
 create mode 100644 srcpkgs/qemu/patches/keymap.patch
 delete mode 100644 srcpkgs/qemu/patches/mmap-mremap-efault.patch
 delete mode 100644 srcpkgs/qemu/patches/musl-ppc.patch
 delete mode 100644 srcpkgs/qemu/patches/musl-rlimit-rttime.patch
 delete mode 100644 srcpkgs/qemu/patches/xxx-ppcle.patch

diff --git a/srcpkgs/qemu/patches/CVE-2023-2861.patch b/srcpkgs/qemu/patches/CVE-2023-2861.patch
new file mode 100644
index 000000000000..dca869f1d77f
--- /dev/null
+++ b/srcpkgs/qemu/patches/CVE-2023-2861.patch
@@ -0,0 +1,177 @@
+Patch-Source: https://gitlab.com/qemu-project/qemu/-/commit/b9d2887be4e616cdaeedd0b7456bfaa71ee798af
+--
+From b9d2887be4e616cdaeedd0b7456bfaa71ee798af Mon Sep 17 00:00:00 2001
+From: Christian Schoenebeck <qemu_oss@crudebyte.com>
+Date: Wed, 7 Jun 2023 18:29:33 +0200
+Subject: [PATCH] 9pfs: prevent opening special files (CVE-2023-2861)
+
+The 9p protocol does not specifically define how server shall behave when
+client tries to open a special file, however from security POV it does
+make sense for 9p server to prohibit opening any special file on host side
+in general. A sane Linux 9p client for instance would never attempt to
+open a special file on host side, it would always handle those exclusively
+on its guest side. A malicious client however could potentially escape
+from the exported 9p tree by creating and opening a device file on host
+side.
+
+With QEMU this could only be exploited in the following unsafe setups:
+
+  - Running QEMU binary as root AND 9p 'local' fs driver AND 'passthrough'
+    security model.
+
+or
+
+  - Using 9p 'proxy' fs driver (which is running its helper daemon as
+    root).
+
+These setups were already discouraged for safety reasons before,
+however for obvious reasons we are now tightening behaviour on this.
+
+Fixes: CVE-2023-2861
+Reported-by: Yanwu Shen <ywsPlz@gmail.com>
+Reported-by: Jietao Xiao <shawtao1125@gmail.com>
+Reported-by: Jinku Li <jkli@xidian.edu.cn>
+Reported-by: Wenbo Shen <shenwenbo@zju.edu.cn>
+Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
+Reviewed-by: Greg Kurz <groug@kaod.org>
+Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
+Message-Id: <E1q6w7r-0000Q0-NM@lizzy.crudebyte.com>
+(cherry picked from commit f6b0de53fb87ddefed348a39284c8e2f28dc4eda)
+Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
+---
+ fsdev/virtfs-proxy-helper.c | 27 +++++++++++++++++++++++--
+ hw/9pfs/9p-util.h           | 39 +++++++++++++++++++++++++++++++++++++
+ 2 files changed, 64 insertions(+), 2 deletions(-)
+
+diff --git a/fsdev/virtfs-proxy-helper.c b/fsdev/virtfs-proxy-helper.c
+index 5cafcd77031..d9511f429c9 100644
+--- a/fsdev/virtfs-proxy-helper.c
++++ b/fsdev/virtfs-proxy-helper.c
+@@ -26,6 +26,7 @@
+ #include "qemu/xattr.h"
+ #include "9p-iov-marshal.h"
+ #include "hw/9pfs/9p-proxy.h"
++#include "hw/9pfs/9p-util.h"
+ #include "fsdev/9p-iov-marshal.h"
+ 
+ #define PROGNAME "virtfs-proxy-helper"
+@@ -338,6 +339,28 @@ static void resetugid(int suid, int sgid)
+     }
+ }
+ 
++/*
++ * Open regular file or directory. Attempts to open any special file are
++ * rejected.
++ *
++ * returns file descriptor or -1 on error
++ */
++static int open_regular(const char *pathname, int flags, mode_t mode)
++{
++    int fd;
++
++    fd = open(pathname, flags, mode);
++    if (fd < 0) {
++        return fd;
++    }
++
++    if (close_if_special_file(fd) < 0) {
++        return -1;
++    }
++
++    return fd;
++}
++
+ /*
+  * send response in two parts
+  * 1) ProxyHeader
+@@ -682,7 +705,7 @@ static int do_create(struct iovec *iovec)
+     if (ret < 0) {
+         goto unmarshal_err_out;
+     }
+-    ret = open(path.data, flags, mode);
++    ret = open_regular(path.data, flags, mode);
+     if (ret < 0) {
+         ret = -errno;
+     }
+@@ -707,7 +730,7 @@ static int do_open(struct iovec *iovec)
+     if (ret < 0) {
+         goto err_out;
+     }
+-    ret = open(path.data, flags);
++    ret = open_regular(path.data, flags, 0);
+     if (ret < 0) {
+         ret = -errno;
+     }
+diff --git a/hw/9pfs/9p-util.h b/hw/9pfs/9p-util.h
+index c314cf381d4..df1b583a5e4 100644
+--- a/hw/9pfs/9p-util.h
++++ b/hw/9pfs/9p-util.h
+@@ -13,6 +13,8 @@
+ #ifndef QEMU_9P_UTIL_H
+ #define QEMU_9P_UTIL_H
+ 
++#include "qemu/error-report.h"
++
+ #ifdef O_PATH
+ #define O_PATH_9P_UTIL O_PATH
+ #else
+@@ -95,6 +97,7 @@ static inline int errno_to_dotl(int err) {
+ #endif
+ 
+ #define qemu_openat     openat
++#define qemu_fstat      fstat
+ #define qemu_fstatat    fstatat
+ #define qemu_mkdirat    mkdirat
+ #define qemu_renameat   renameat
+@@ -108,6 +111,38 @@ static inline void close_preserve_errno(int fd)
+     errno = serrno;
+ }
+ 
++/**
++ * close_if_special_file() - Close @fd if neither regular file nor directory.
++ *
++ * @fd: file descriptor of open file
++ * Return: 0 on regular file or directory, -1 otherwise
++ *
++ * CVE-2023-2861: Prohibit opening any special file directly on host
++ * (especially device files), as a compromised client could potentially gain
++ * access outside exported tree under certain, unsafe setups. We expect
++ * client to handle I/O on special files exclusively on guest side.
++ */
++static inline int close_if_special_file(int fd)
++{
++    struct stat stbuf;
++
++    if (qemu_fstat(fd, &stbuf) < 0) {
++        close_preserve_errno(fd);
++        return -1;
++    }
++    if (!S_ISREG(stbuf.st_mode) && !S_ISDIR(stbuf.st_mode)) {
++        error_report_once(
++            "9p: broken or compromised client detected; attempt to open "
++            "special file (i.e. neither regular file, nor directory)"
++        );
++        close(fd);
++        errno = ENXIO;
++        return -1;
++    }
++
++    return 0;
++}
++
+ static inline int openat_dir(int dirfd, const char *name)
+ {
+     return qemu_openat(dirfd, name,
+@@ -142,6 +177,10 @@ again:
+         return -1;
+     }
+ 
++    if (close_if_special_file(fd) < 0) {
++        return -1;
++    }
++
+     serrno = errno;
+     /* O_NONBLOCK was only needed to open the file. Let's drop it. We don't
+      * do that with O_PATH since fcntl(F_SETFL) isn't supported, and openat()
+-- 
+GitLab
diff --git a/srcpkgs/qemu/patches/fix-linux-user-ppc32.patch b/srcpkgs/qemu/patches/fix-linux-user-ppc32.patch
deleted file mode 100644
index cd47435d5aa9..000000000000
--- a/srcpkgs/qemu/patches/fix-linux-user-ppc32.patch
+++ /dev/null
@@ -1,117 +0,0 @@
-commit 37814f62c2cc7aba2eea073014d6c53dcd5bf42c
-Author: q66 <daniel@octaforge.org>
-Date:   Fri Jul 1 16:53:55 2022 +0200
-
-    fix linux-user build on 32-bit ppc
-    
-    Partial revert https://gitlab.com/qemu-project/qemu/-/commit/9d1401b79463e74adbfac69d836789d4e103fb61
-    and https://gitlab.com/qemu-project/qemu/-/commit/0a7e01904d407baa73c1baddbdfc9ccf2ace8356
-
-diff --git a/common-user/host/ppc/safe-syscall.inc.S b/common-user/host/ppc/safe-syscall.inc.S
-new file mode 100644
-index 0000000..e69de29
-diff --git a/common-user/safe-syscall-error.c b/common-user/safe-syscall-error.c
-index cf74b50..a36132c 100644
---- a/common-user/safe-syscall-error.c
-+++ b/common-user/safe-syscall-error.c
-@@ -12,6 +12,7 @@
- #include "qemu/osdep.h"
- #include "user/safe-syscall.h"
- 
-+#if !defined(__powerpc__) || defined(__powerpc64__)
- /*
-  * This is intended to be invoked via tail-call on the error path
-  * from the assembly in host/arch/safe-syscall.inc.S.  This takes
-@@ -23,3 +24,4 @@ long safe_syscall_set_errno_tail(int value)
-     errno = value;
-     return -1;
- }
-+#endif
-diff --git a/include/user/safe-syscall.h b/include/user/safe-syscall.h
-index 61a04e2..793fe84 100644
---- a/include/user/safe-syscall.h
-+++ b/include/user/safe-syscall.h
-@@ -125,6 +125,8 @@
-  * kinds of restartability.
-  */
- 
-+#if !defined(__powerpc__) || defined(__powerpc64__)
-+
- /* The core part of this function is implemented in assembly */
- extern long safe_syscall_base(int *pending, long number, ...);
- extern long safe_syscall_set_errno_tail(int value);
-@@ -137,4 +139,10 @@ extern char safe_syscall_end[];
-     safe_syscall_base(&((TaskState *)thread_cpu->opaque)->signal_pending, \
-                       __VA_ARGS__)
- 
-+#else
-+
-+#define safe_syscall syscall
-+
-+#endif
-+
- #endif
-diff --git a/linux-user/include/host/ppc/host-signal.h b/linux-user/include/host/ppc/host-signal.h
-new file mode 100644
-index 0000000..b80384d
---- /dev/null
-+++ b/linux-user/include/host/ppc/host-signal.h
-@@ -0,0 +1,38 @@
-+/*
-+ * host-signal.h: signal info dependent on the host architecture
-+ *
-+ * Copyright (c) 2003-2005 Fabrice Bellard
-+ * Copyright (c) 2021 Linaro Limited
-+ *
-+ * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
-+ * See the COPYING file in the top-level directory.
-+ */
-+
-+#ifndef PPC_HOST_SIGNAL_H
-+#define PPC_HOST_SIGNAL_H
-+
-+/* The third argument to a SA_SIGINFO handler is ucontext_t. */
-+typedef ucontext_t host_sigcontext;
-+
-+static inline uintptr_t host_signal_pc(host_sigcontext *uc)
-+{
-+    return uc->uc_mcontext.regs->nip;
-+}
-+
-+static inline void host_signal_set_pc(host_sigcontext *uc, uintptr_t pc)
-+{
-+    uc->uc_mcontext.regs->nip = pc;
-+}
-+
-+static inline void *host_signal_mask(host_sigcontext *uc)
-+{
-+    return &uc->uc_sigmask;
-+}
-+
-+static inline bool host_signal_write(siginfo_t *info, host_sigcontext *uc)
-+{
-+    return uc->uc_mcontext.regs->trap != 0x400
-+        && (uc->uc_mcontext.regs->dsisr & 0x02000000);
-+}
-+
-+#endif
-diff --git a/linux-user/signal.c b/linux-user/signal.c
-index 092e70b..b8dfa8a 100644
---- a/linux-user/signal.c
-+++ b/linux-user/signal.c
-@@ -800,6 +800,7 @@ void queue_signal(CPUArchState *env, int sig, int si_type,
- /* Adjust the signal context to rewind out of safe-syscall if we're in it */
- static inline void rewind_if_in_safe_syscall(void *puc)
- {
-+#if !defined(__powerpc__) || defined(__powerpc64__)
-     host_sigcontext *uc = (host_sigcontext *)puc;
-     uintptr_t pcreg = host_signal_pc(uc);
- 
-@@ -807,6 +808,7 @@ static inline void rewind_if_in_safe_syscall(void *puc)
-         && pcreg < (uintptr_t)safe_syscall_end) {
-         host_signal_set_pc(uc, (uintptr_t)safe_syscall_start);
-     }
-+#endif
- }
- 
- static void host_signal_handler(int host_sig, siginfo_t *info, void *puc)
diff --git a/srcpkgs/qemu/patches/fix-softfloat-fesetround.patch b/srcpkgs/qemu/patches/fix-softfloat-fesetround.patch
deleted file mode 100644
index ecdd049f7921..000000000000
--- a/srcpkgs/qemu/patches/fix-softfloat-fesetround.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-Source: @pullmoll
-Upstream: no
-Reason: Target architectures with soft float do not define these constants.
-
---- a/tests/fp/fp-bench.c	2020-12-08 17:59:44.000000000 +0100
-+++ b/tests/fp/fp-bench.c	2020-12-12 20:38:40.702235420 +0100
-@@ -485,16 +485,32 @@
- 
-     switch (rounding) {
-     case ROUND_EVEN:
-+#if defined(FE_TONEAREST)
-         rhost = FE_TONEAREST;
-+#else
-+	return;
-+#endif
-         break;
-     case ROUND_ZERO:
-+#if defined(FE_TOWARDZERO)
-         rhost = FE_TOWARDZERO;
-+#else
-+	return;
-+#endif
-         break;
-     case ROUND_DOWN:
-+#if defined(FE_DOWNWARD)
-         rhost = FE_DOWNWARD;
-+#else
-+	return;
-+#endif
-         break;
-     case ROUND_UP:
-+#if defined(FE_UPWARD)
-         rhost = FE_UPWARD;
-+#else
-+	return;
-+#endif
-         break;
-     case ROUND_TIEAWAY:
-         die_host_rounding(rounding);
diff --git a/srcpkgs/qemu/patches/gcc12.patch b/srcpkgs/qemu/patches/gcc12.patch
deleted file mode 100644
index 2a4b2bd03609..000000000000
--- a/srcpkgs/qemu/patches/gcc12.patch
+++ /dev/null
@@ -1,72 +0,0 @@
-From 5cb993ff131fca2abef3ce074a20258fd6fce557 Mon Sep 17 00:00:00 2001
-From: Bernhard Beschow <shentey@gmail.com>
-Date: Sat, 18 Mar 2023 19:59:31 +0100
-Subject: [PATCH] qemu/osdep: Switch position of "extern" and "G_NORETURN"
-
-Fixes the Windows build under msys2 using GCC 12 which fails with the following
-error:
-
-  [184/579] Compiling C++ object qga/vss-win32/qga-vss.dll.p/install.cpp.obj
-  FAILED: qga/vss-win32/qga-vss.dll.p/install.cpp.obj
-  "c++" "-m64" "-mcx16" "-Iqga/vss-win32/qga-vss.dll.p" "-Iqga/vss-win32" "-I../src/qga/vss-win32" "-I." "-Iqapi" "-Itrace" "-Iui" "-Iui/shader" "-IC:/msys64/mingw64/include/glib-2.0" "-IC:/msys64/mingw64/lib/glib-2.0/include" "-fdiagnostics-color=auto" "-Wall" "-Winvalid-pch" "-Wnon-virtual-dtor" "-Werror" "-std=gnu++11" "-g" "-iquote" "." "-iquote" "C:/msys64/home/shentey/Projects/qemu/src" "-iquote" "C:/msys64/home/shentey/Projects/qemu/src/include" "-iquote" "C:/msys64/home/shentey/Projects/qemu/src/tcg/i386" "-D__STDC_LIMIT_MACROS" "-D__STDC_CONSTANT_MACROS" "-D__STDC_FORMAT_MACROS" "-fno-pie" "-no-pie" "-D_GNU_SOURCE" "-D_FILE_OFFSET_BITS=64" "-D_LARGEFILE_SOURCE" "-fno-strict-aliasing" "-fno-common" "-fwrapv" "-Wundef" "-Wwrite-strings" "-Wtype-limits" "-Wformat-security" "-Wformat-y2k" "-Winit-self" "-Wignored-qualifiers" "-Wempty-body" "-Wendif-labels" "-Wexpansion-to-defined" "-Wimplicit-fallthrough=2" "-Wmissing-format-attribute" "-Wno-missing-include-dirs" "-Wno-shift-negative-value" "-Wno-psabi" "-fstack-protector-strong" "-Wno-unknown-pragmas" "-Wno-delete-non-virtual-dtor" "-Wno-non-virtual-dtor" -MD -MQ qga/vss-win32/qga-vss.dll.p/install.cpp.obj -MF "qga/vss-win32/qga-vss.dll.p/install.cpp.obj.d" -o qga/vss-win32/qga-vss.dll.p/install.cpp.obj "-c" ../src/qga/vss-win32/install.cpp
-  In file included from C:/msys64/mingw64/lib/glib-2.0/include/glibconfig.h:9,
-              from C:/msys64/mingw64/include/glib-2.0/glib/gtypes.h:34,
-              from C:/msys64/mingw64/include/glib-2.0/glib/galloca.h:34,
-              from C:/msys64/mingw64/include/glib-2.0/glib.h:32,
-              from C:/msys64/home/shentey/Projects/qemu/src/include/glib-compat.h:32,
-              from C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:144,
-              from ../src/qga/vss-win32/install.cpp:13:
-  C:/msys64/mingw64/include/glib-2.0/glib/gmacros.h:1075:21: error: standard attributes in middle of decl-specifiers
-  1075 | # define G_NORETURN [[noreturn]]
-        |                     ^
-  C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:240:8: note: in expansion of macro 'G_NORETURN'
-  240 | extern G_NORETURN
-        |        ^~~~~~~~~~
-  C:/msys64/mingw64/include/glib-2.0/glib/gmacros.h:1075:21: note: standard attributes must precede the decl-specifiers to apply to the declaration, or follow them to apply to the type
-  1075 | # define G_NORETURN [[noreturn]]
-        |                     ^
-  C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:240:8: note: in expansion of macro 'G_NORETURN'
-  240 | extern G_NORETURN
-        |        ^~~~~~~~~~
-  C:/msys64/mingw64/include/glib-2.0/glib/gmacros.h:1075:21: error: attribute ignored [-Werror=attributes]
-  1075 | # define G_NORETURN [[noreturn]]
-        |                     ^
-  C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:240:8: note: in expansion of macro 'G_NORETURN'
-  240 | extern G_NORETURN
-        |        ^~~~~~~~~~
-  C:/msys64/mingw64/include/glib-2.0/glib/gmacros.h:1075:21: note: an attribute that appertains to a type-specifier is ignored
-  1075 | # define G_NORETURN [[noreturn]]
-        |                     ^
-  C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:240:8: note: in expansion of macro 'G_NORETURN'
-  240 | extern G_NORETURN
-        |        ^~~~~~~~~~
-  cc1plus.exe: all warnings being treated as errors
-
-Apparently it also fixes the compilation with Clang 15 (see
-https://gitlab.com/qemu-project/qemu/-/issues/1541 ).
-
-Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1541
-Signed-off-by: Bernhard Beschow <shentey@gmail.com>
-Message-Id: <20230318185931.181659-1-shentey@gmail.com>
-Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
-Signed-off-by: Thomas Huth <thuth@redhat.com>
----
- include/qemu/osdep.h | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
-index f68b5d8708c..9eff0be95bd 100644
---- a/include/qemu/osdep.h
-+++ b/include/qemu/osdep.h
-@@ -237,7 +237,7 @@ extern "C" {
-  * supports QEMU_ERROR, this will be reported at compile time; otherwise
-  * this will be reported at link time due to the missing symbol.
-  */
--extern G_NORETURN
-+G_NORETURN extern
- void QEMU_ERROR("code path is reachable")
-     qemu_build_not_reached_always(void);
- #if defined(__OPTIMIZE__) && !defined(__NO_INLINE__)
--- 
-GitLab
-
diff --git a/srcpkgs/qemu/patches/keymap.patch b/srcpkgs/qemu/patches/keymap.patch
new file mode 100644
index 000000000000..c4d9963cd636
--- /dev/null
+++ b/srcpkgs/qemu/patches/keymap.patch
@@ -0,0 +1,47 @@
+The xkb official name for the Arabic keyboard layout is 'ara'.
+However xkb has for at least the past 15 years also permitted it to
+be named via the legacy synonym 'ar'.  In xkeyboard-config 2.39 this
+synoynm was removed, which breaks compilation of QEMU:
+
+FAILED: pc-bios/keymaps/ar
+/home/fred/qemu-git/src/qemu/build-full/qemu-keymap -f pc-bios/keymaps/ar -l ar
+xkbcommon: ERROR: Couldn't find file "symbols/ar" in include paths
+xkbcommon: ERROR: 1 include paths searched:
+xkbcommon: ERROR: 	/usr/share/X11/xkb
+xkbcommon: ERROR: 3 include paths could not be added:
+xkbcommon: ERROR: 	/home/fred/.config/xkb
+xkbcommon: ERROR: 	/home/fred/.xkb
+xkbcommon: ERROR: 	/etc/xkb
+xkbcommon: ERROR: Abandoning symbols file "(unnamed)"
+xkbcommon: ERROR: Failed to compile xkb_symbols
+xkbcommon: ERROR: Failed to compile keymap
+
+The upstream xkeyboard-config change removing the compat
+mapping is:
+https://gitlab.freedesktop.org/xkeyboard-config/xkeyboard-config/-/commit/470ad2cd8fea84d7210377161d86b31999bb5ea6
+
+Make QEMU always ask for the 'ara' xkb layout, which should work on
+both older and newer xkeyboard-config.  We leave the QEMU name for
+this keyboard layout as 'ar'; it is not the only one where our name
+for it deviates from the xkb standard name.
+
+Cc: qemu-stable@nongnu.org
+Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
+Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1709
+---
+ pc-bios/keymaps/meson.build | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/pc-bios/keymaps/meson.build b/pc-bios/keymaps/meson.build
+index bff30833137..0bd8ce00775 100644
+--- a/pc-bios/keymaps/meson.build
++++ b/pc-bios/keymaps/meson.build
+@@ -1,5 +1,5 @@
+ keymaps = {
+-  'ar': '-l ar',
++  'ar': '-l ara',
+   'bepo': '-l fr -v dvorak',
+   'cz': '-l cz',
+   'da': '-l dk',
+-- 
+2.34.1
diff --git a/srcpkgs/qemu/patches/mmap-mremap-efault.patch b/srcpkgs/qemu/patches/mmap-mremap-efault.patch
deleted file mode 100644
index 5a70e9658b30..000000000000
--- a/srcpkgs/qemu/patches/mmap-mremap-efault.patch
+++ /dev/null
@@ -1,42 +0,0 @@
-Source: @pullmoll
-Upstream: no
-Reason: errno=EFAULT when the address passed to mremap(2) is not valid
-
-See Rich Felker's comment at https://www.openwall.com/lists/musl/2017/06/21/2 for
-why we need to return errno as described in man mremap(2) from qemu-user-static.
-Also speed up the loop when checking for increasing the mappings size to go
-in steps of TARGET_PAGE_SIZE and OR-in a check for the very last byte of the range.
-diff --git linux-user/mmap.c linux-user/mmap.c
-index 7e3b245..1e8d0f1 100644
---- a/linux-user/mmap.c
-+++ b/linux-user/mmap.c
-@@ -738,7 +738,7 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size,
-          !guest_range_valid_untagged(new_addr, new_size)) ||
-         ((flags & MREMAP_MAYMOVE) == 0 &&
-          !guest_range_valid_untagged(old_addr, new_size))) {
--        errno = ENOMEM;
-+        errno = EFAULT;
-         return -1;
-     }
- 
-@@ -775,9 +775,10 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size,
-             abi_ulong addr;
-             for (addr = old_addr + old_size;
-                  addr < old_addr + new_size;
--                 addr++) {
-+                 addr += TARGET_PAGE_SIZE) {
-                 prot |= page_get_flags(addr);
-             }
-+				prot |= page_get_flags(old_addr + new_size - 1);
-         }
-         if (prot == 0) {
-             host_addr = mremap(g2h_untagged(old_addr),
-@@ -796,7 +797,7 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size,
-                 }
-             }
-         } else {
--            errno = ENOMEM;
-+            errno = EFAULT;
-             host_addr = MAP_FAILED;
-         }
-     }
diff --git a/srcpkgs/qemu/patches/musl-initialize-msghdr.patch b/srcpkgs/qemu/patches/musl-initialize-msghdr.patch
index 6d96b3511daf..a88547354c1e 100644
--- a/srcpkgs/qemu/patches/musl-initialize-msghdr.patch
+++ b/srcpkgs/qemu/patches/musl-initialize-msghdr.patch
@@ -1,10 +1,10 @@
 Source: https://github.com/void-linux/void-packages/issues/23557
 
-diff --git linux-user/syscall.c linux-user/syscall.c
-index 945fc25..8d8b68a 100644
+diff --git a/linux-user/syscall.c b/linux-user/syscall.c
+index 14fdebd..de280af 100644
 --- a/linux-user/syscall.c
 +++ b/linux-user/syscall.c
-@@ -3071,7 +3071,7 @@ static abi_long do_sendrecvmsg_locked(int fd, struct target_msghdr *msgp,
+@@ -3229,7 +3229,7 @@ static abi_long do_sendrecvmsg_locked(int fd, struct target_msghdr *msgp,
                                        int flags, int send)
  {
      abi_long ret, len;
diff --git a/srcpkgs/qemu/patches/musl-ppc.patch b/srcpkgs/qemu/patches/musl-ppc.patch
deleted file mode 100644
index 0b77aa8fc63d..000000000000
--- a/srcpkgs/qemu/patches/musl-ppc.patch
+++ /dev/null
@@ -1,25 +0,0 @@
---- a/linux-user/signal.c
-+++ b/linux-user/signal.c
-@@ -21,5 +21,9 @@
- #include "exec/gdbstub.h"
- #include "hw/core/tcg-cpu-ops.h"
- 
-+#if defined(_ARCH_PPC64) && !defined(__GLIBC__) /* musl */
-+#include <asm/ptrace.h>
-+#endif
-+
- #include <sys/ucontext.h>
- #include <sys/resource.h>
---- a/util/mmap-alloc.c
-+++ b/util/mmap-alloc.c
-@@ -25,6 +25,10 @@
- 
- #ifdef CONFIG_LINUX
- #include <sys/vfs.h>
-+/* musl undefs this on ppc and mips */
-+#ifndef MAP_SYNC
-+#define MAP_SYNC 0x80000
-+#endif
- #endif
- 
- size_t qemu_fd_getpagesize(int fd)
diff --git a/srcpkgs/qemu/patches/musl-rlimit-rttime.patch b/srcpkgs/qemu/patches/musl-rlimit-rttime.patch
deleted file mode 100644
index 0cbf9be36a8f..000000000000
--- a/srcpkgs/qemu/patches/musl-rlimit-rttime.patch
+++ /dev/null
@@ -1,13 +0,0 @@
---- a/linux-user/syscall.c
-+++ b/linux-user/syscall.c
-@@ -141,6 +141,10 @@
- #include "fd-trans.h"
- #include "tcg/tcg.h"
- 
-+#ifndef RLIMIT_RTTIME
-+#define RLIMIT_RTTIME 15
-+#endif
-+
- #ifndef CLONE_IO
- #define CLONE_IO                0x80000000      /* Clone io context */
- #endif
diff --git a/srcpkgs/qemu/patches/xxx-ppcle.patch b/srcpkgs/qemu/patches/xxx-ppcle.patch
deleted file mode 100644
index 90b32b5e07cd..000000000000
--- a/srcpkgs/qemu/patches/xxx-ppcle.patch
+++ /dev/null
@@ -1,113 +0,0 @@
-From 7ece08d7902d5a8c007deeb0b75cb533a41dd882 Mon Sep 17 00:00:00 2001
-From: Daniel Kolesa <daniel@octaforge.org>
-Date: Sun, 7 Mar 2021 01:47:42 +0100
-Subject: [PATCH] support ppcle architecture
-
----
- configure                            | 14 ++++++++++++--
- configs/targets/ppcle-linux-user.mak |  4 ++++
- linux-user/ppc/target_syscall.h      |  4 ++++
- scripts/qemu-binfmt-conf.sh          |  6 +++++-
- tests/tcg/configure.sh               |  2 ++
- 5 files changed, 27 insertions(+), 3 deletions(-)
- create mode 100644 configs/targets/ppcle-linux-user.mak
-
-diff --git a/configure b/configure
-index 18c26e0..03d3e18 100755
---- a/configure
-+++ b/configure
-@@ -653,7 +653,11 @@ elif check_define _ARCH_PPC ; then
-       cpu="ppc64"
-     fi
-   else
--    cpu="ppc"
-+    if check_define _LITTLE_ENDIAN ; then
-+      cpu="ppcle"
-+    else
-+      cpu="ppc"
-+    fi
-   fi
- elif check_define __mips__ ; then
-   cpu="mips"
-@@ -638,6 +642,9 @@
- 
-   ppc)
-     CPU_CFLAGS="-m32" ;;
-+  ppcle)
-+    cpu="ppc"
-+    CPU_CFLAGS="-m32 -mlittle-endian" ;;
-   ppc64)
-     CPU_CFLAGS="-m64 -mbig-endian" ;;
-   ppc64le)
-diff --git a/configs/targets/ppcle-linux-user.mak b/configs/targets/ppcle-linux-user.mak
-new file mode 100644
-index 0000000..2259243
---- /dev/null
-+++ b/configs/targets/ppcle-linux-user.mak
-@@ -0,0 +1,4 @@
-+TARGET_ARCH=ppc
-+TARGET_SYSTBL_ABI=common,nospu,32
-+TARGET_SYSTBL=syscall.tbl
-+TARGET_XML_FILES= gdb-xml/power-core.xml gdb-xml/power-fpu.xml gdb-xml/power-altivec.xml gdb-xml/power-spe.xml
-diff --git a/linux-user/ppc/target_syscall.h b/linux-user/ppc/target_syscall.h
-index b9c4b81..cf26497 100644
---- a/linux-user/ppc/target_syscall.h
-+++ b/linux-user/ppc/target_syscall.h
-@@ -65,7 +65,11 @@ struct target_revectored_struct {
- #define UNAME_MACHINE "ppc64le"
- #endif
- #else
-+#if TARGET_BIG_ENDIAN
- #define UNAME_MACHINE "ppc"
-+#else
-+#define UNAME_MACHINE "ppcle"
-+#endif
- #endif
- #define UNAME_MINIMUM_RELEASE "2.6.32"
- 
-diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh
-index 9f1580a..393943f 100755
---- a/scripts/qemu-binfmt-conf.sh
-+++ b/scripts/qemu-binfmt-conf.sh
-@@ -46,6 +46,10 @@ ppc_magic='\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x
- ppc_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
- ppc_family=ppc
- 
-+ppcle_magic='\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x14\x00'
-+ppcle_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\x00'
-+ppc_family=ppcle
-+
- ppc64_magic='\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x15'
- ppc64_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
- ppc64_family=ppc
-@@ -148,7 +152,7 @@ qemu_get_family() {
-     "Power Macintosh"|ppc64|powerpc|ppc)
-         echo "ppc"
-         ;;
--    ppc64el|ppc64le)
-+    ppc64el|ppc64le|ppcel|ppcle)
-         echo "ppcle"
-         ;;
-     arm|armel|armhf|arm64|armv[4-9]*l|aarch64)
-diff --git a/configure b/configure
-index 72ab03f11a..0691929d76 100755
---- a/configure
-+++ b/configure
-@@ -1866,6 +1866,7 @@ fi
- : ${cross_prefix_mips="mips-linux-gnu-"}
- : ${cross_prefix_nios2="nios2-linux-gnu-"}
- : ${cross_prefix_ppc="powerpc-linux-gnu-"}
-+: ${cross_prefix_ppcle="powerpcle-linux-gnu-"}
- : ${cross_prefix_ppc64="powerpc64-linux-gnu-"}
- : ${cross_prefix_ppc64le="$cross_prefix_ppc64"}
- : ${cross_prefix_riscv64="riscv64-linux-gnu-"}
-@@ -1883,6 +1884,7 @@ fi
- : ${cross_cc_cflags_hexagon="-mv67 -O2 -static"}
- : ${cross_cc_cflags_i386="-m32"}
- : ${cross_cc_cflags_ppc="-m32 -mbig-endian"}
-+: ${cross_cc_cflags_ppcle="-m32"}
- : ${cross_cc_cflags_ppc64="-m64 -mbig-endian"}
- : ${cross_cc_ppc64le="$cross_cc_ppc64"}
- : ${cross_cc_cflags_ppc64le="-m64 -mlittle-endian"}
-2.30.1
-
diff --git a/srcpkgs/qemu/template b/srcpkgs/qemu/template
index 48ab199e5686..1ab53eeef726 100644
--- a/srcpkgs/qemu/template
+++ b/srcpkgs/qemu/template
@@ -1,8 +1,8 @@
 # Template file for 'qemu'
 # This package should be updated together with qemu-user-static
 pkgname=qemu
-version=7.1.0
-revision=2
+version=8.0.2
+revision=1
 build_style=configure
 configure_args="--prefix=/usr --sysconfdir=/etc --libexecdir=/usr/libexec --localstatedir=/var
  --disable-glusterfs --disable-xen --enable-docs --enable-kvm --enable-libusb --enable-pie
@@ -10,10 +10,10 @@ configure_args="--prefix=/usr --sysconfdir=/etc --libexecdir=/usr/libexec --loca
  --audio-drv-list=alsa$(vopt_if sdl2 ,sdl)$(vopt_if jack ,jack)$(vopt_if pulseaudio ,pa)
  $(vopt_enable opengl) $(vopt_enable pulseaudio pa) $(vopt_enable sdl2 sdl) $(vopt_enable smartcard)
  $(vopt_enable spice) $(vopt_enable virgl virglrenderer) $(vopt_if gtk3 '--enable-gtk')"
-hostmakedepends="gettext pkg-config perl python3 python3-Sphinx python3-sphinx_rtd_theme ninja"
+hostmakedepends="flex gettext glib-devel pkg-config perl python3 python3-Sphinx python3-sphinx_rtd_theme ninja"
 makedepends="capstone-devel dtc-devel libpng-devel libjpeg-turbo-devel pixman-devel
- snappy-devel libuuid-devel libX11-devel alsa-lib-devel libaio-devel gnutls-devel
- libsasl-devel libglib-devel ncurses-devel libseccomp-devel nss-devel
+ snappy-devel libuuid-devel libX11-devel alsa-lib-devel libaio-devel
+ gnutls-devel libsasl-devel ncurses-devel libseccomp-devel nss-devel
  libcurl-devel xfsprogs-devel libcap-ng-devel vde2-devel usbredir-devel
  libbluetooth-devel libssh2-devel libusb-devel libnfs-devel libslirp-devel
  libxkbcommon-devel libzstd-devel $(vopt_if sdl2 'SDL2-devel SDL2_image-devel')
@@ -25,10 +25,10 @@ makedepends="capstone-devel dtc-devel libpng-devel libjpeg-turbo-devel pixman-de
  $(vopt_if jack 'jack-devel') $(vopt_if pulseaudio 'pulseaudio-devel')"
 short_desc="Open Source Processor Emulator"
 maintainer="Orphaned <orphan@voidlinux.org>"
-license="GPL-2.0-or-later, LGPL-2.1-or-later"
+license="GPL-2.0-only, LGPL-2.1-only"
 homepage="https://www.qemu.org"
 distfiles="https://wiki.qemu.org/download/qemu-${version}.tar.bz2"
-checksum=f7ac2b85b3f1831e6810b140306e30af91556e15784864b209f3942858947fd0
+checksum=b59281923d60d358a7d7d3bde46ba43c0810d34d26608fcdaf6bf4c42492b694
 ignore_elf_dirs="/usr/share/qemu"
 nostrip_files="hppa-firmware.img openbios-ppc openbios-sparc32 openbios-sparc64
  palcode-clipper s390-ccw.img s390-netboot.img u-boot.e500 opensbi-riscv32-generic-fw_dynamic.elf
@@ -43,37 +43,12 @@ desc_option_smartcard="Enable smartcard support"
 desc_option_numa="Enable support for host NUMA"
 desc_option_iscsi="Enable support for iSCSI"
 
-case "$XBPS_TARGET_MACHINE" in
-	aarch64-musl) CFLAGS="-D_LINUX_SYSINFO_H";;
-esac
-
-if [ "$XBPS_TARGET_ENDIAN" = "le" ]; then
-	build_options_default+=" spice"
-fi
-
 if [ "$CROSS_BUILD" ]; then
-	configure_args+=" --cross-prefix=${XBPS_CROSS_TRIPLET}-"
+	configure_args+=" --cross-prefix=${XBPS_CROSS_TRIPLET}"
 else
 	build_options_default+=" smartcard"
 fi
 
-if [ "$XBPS_CHECK_PKGS" != full ]; then
-	make_check_target=check-unit
-fi
-
-post_extract() {
-	if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
-		grep -rl 'Input/output error' tests/qemu-iotests |
-			xargs -n1 sed -i -e 's;Input/output error;I/O error;g'
-		grep -rl 'Operation not supported' tests/qemu-iotests |
-			xargs -n1 sed -i -e 's;Operation not supported;Not supported;g'
-	fi
-}
-
-pre_configure() {
-	unset CPP
-}
-
 post_install() {
 	vdoc "${FILESDIR}/README.voidlinux"
 

From e6d627dd47e49835a072695253cc8ecae513f02c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Cerqueira?= <acerqueira021@gmail.com>
Date: Mon, 3 Jul 2023 18:41:30 +0100
Subject: [PATCH 2/2] qemu-user-static: update to 8.0.2.

---
 srcpkgs/qemu-user-static/template | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/srcpkgs/qemu-user-static/template b/srcpkgs/qemu-user-static/template
index 2a8da9b53f2d..509688be23f3 100644
--- a/srcpkgs/qemu-user-static/template
+++ b/srcpkgs/qemu-user-static/template
@@ -1,20 +1,20 @@
 # Template file for 'qemu-user-static'
 # This package should be updated together with qemu
 pkgname=qemu-user-static
-version=7.1.0
-revision=3
+version=8.0.2
+revision=1
 build_style=configure
 configure_args="--prefix=/usr --sysconfdir=/etc --libexecdir=/usr/libexec
  --disable-kvm --disable-png --disable-virtfs --disable-fdt --disable-seccomp
  --enable-linux-user --disable-system --static --disable-pie"
-hostmakedepends="pkg-config perl python3 ninja"
+hostmakedepends="flex glib-devel pkg-config perl python3 ninja"
 makedepends="dtc-devel libglib-devel pixman-devel libuuid-devel"
 short_desc="QEMU User-mode emulators (statically compiled)"
 maintainer="Orphaned <orphan@voidlinux.org>"
-license="GPL-2.0-or-later, LGPL-2.1-or-later"
+license="GPL-2.0-only, LGPL-2.1-only"
 homepage="https://www.qemu.org"
 distfiles="https://wiki.qemu.org/download/qemu-${version}.tar.bz2"
-checksum=f7ac2b85b3f1831e6810b140306e30af91556e15784864b209f3942858947fd0
+checksum=b59281923d60d358a7d7d3bde46ba43c0810d34d26608fcdaf6bf4c42492b694
 
 _fmts="aarch64 aarch64_be alpha arm armeb cris hppa i386 m68k microblaze
  microblazeel mips mipsel mips64 mips64el mipsn32 mipsn32el or1k
@@ -111,10 +111,6 @@ done
 
 binfmts="${binfmts%?}"
 
-pre_configure() {
-	unset CPP
-}
-
 post_install() {
 	# Remove unneeded stuff.
 	rm -rf ${DESTDIR}/etc ${DESTDIR}/usr/share ${DESTDIR}/usr/libexec

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [PR PATCH] [Updated] qemu: update to 8.0.2.
  2023-07-03 17:50 [PR PATCH] qemu: update to 8.0.2 motorto
  2023-07-03 17:55 ` [PR PATCH] [Updated] " motorto
  2023-07-03 17:59 ` motorto
@ 2023-07-04 13:28 ` motorto
  2023-07-04 13:32 ` motorto
                   ` (35 subsequent siblings)
  38 siblings, 0 replies; 40+ messages in thread
From: motorto @ 2023-07-04 13:28 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1407 bytes --]

There is an updated pull request by motorto against master on the void-packages repository

https://github.com/motorto/void-packages qemu-8.0.2
https://github.com/void-linux/void-packages/pull/44822

qemu: update to 8.0.2.
<!-- Uncomment relevant sections and delete options which are not applicable -->
[ci-skip] 
#### Testing the changes
- I tested the changes in this PR: **NO**, still haven't had the time to. Opening to have feedback on it and possible some testers as well.


Removed a bunch of patches that in my research are no longer needed:

- Removed all ppc related patches since that arch isn't no longer supported.
- gcc12.patch: because it builds fine now in this version
- fix-softfloat-fesetround.patch: don't have a system to try it, but alpine doesn't have any patch related to this)
- mmap-mremap-efaul: not sure about if we should keep this one

Kept this patches:

- musl-initialize-msghdr.patch: just update in order to apply.

Added this ones:

- CVE-2023-2861.patch:
- keymap.patch: xkeyboard-config 2.39 removed the legacy alias of ar -> ara

#### Local build testing
- I built this PR locally for my native architecture, x86-64-glibc
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl (cross)
  - x86_64-musl



A patch file from https://github.com/void-linux/void-packages/pull/44822.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-qemu-8.0.2-44822.patch --]
[-- Type: text/x-diff, Size: 33970 bytes --]

From 059a38b5ec367a57534e7e63605ba334604e0ae9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Cerqueira?= <acerqueira021@gmail.com>
Date: Mon, 3 Jul 2023 18:41:12 +0100
Subject: [PATCH 1/2] qemu: update to 8.0.2.

---
 srcpkgs/qemu/patches/CVE-2023-2861.patch      | 177 ++++++++++++++++++
 .../qemu/patches/fix-linux-user-ppc32.patch   | 117 ------------
 .../patches/fix-softfloat-fesetround.patch    |  39 ----
 srcpkgs/qemu/patches/gcc12.patch              |  72 -------
 srcpkgs/qemu/patches/keymap.patch             |  47 +++++
 srcpkgs/qemu/patches/mmap-mremap-efault.patch |  42 -----
 .../qemu/patches/musl-initialize-msghdr.patch |   6 +-
 srcpkgs/qemu/patches/musl-ppc.patch           |  25 ---
 srcpkgs/qemu/patches/musl-rlimit-rttime.patch |  13 --
 srcpkgs/qemu/patches/xxx-ppcle.patch          | 113 -----------
 srcpkgs/qemu/template                         |  47 +----
 11 files changed, 237 insertions(+), 461 deletions(-)
 create mode 100644 srcpkgs/qemu/patches/CVE-2023-2861.patch
 delete mode 100644 srcpkgs/qemu/patches/fix-linux-user-ppc32.patch
 delete mode 100644 srcpkgs/qemu/patches/fix-softfloat-fesetround.patch
 delete mode 100644 srcpkgs/qemu/patches/gcc12.patch
 create mode 100644 srcpkgs/qemu/patches/keymap.patch
 delete mode 100644 srcpkgs/qemu/patches/mmap-mremap-efault.patch
 delete mode 100644 srcpkgs/qemu/patches/musl-ppc.patch
 delete mode 100644 srcpkgs/qemu/patches/musl-rlimit-rttime.patch
 delete mode 100644 srcpkgs/qemu/patches/xxx-ppcle.patch

diff --git a/srcpkgs/qemu/patches/CVE-2023-2861.patch b/srcpkgs/qemu/patches/CVE-2023-2861.patch
new file mode 100644
index 000000000000..dca869f1d77f
--- /dev/null
+++ b/srcpkgs/qemu/patches/CVE-2023-2861.patch
@@ -0,0 +1,177 @@
+Patch-Source: https://gitlab.com/qemu-project/qemu/-/commit/b9d2887be4e616cdaeedd0b7456bfaa71ee798af
+--
+From b9d2887be4e616cdaeedd0b7456bfaa71ee798af Mon Sep 17 00:00:00 2001
+From: Christian Schoenebeck <qemu_oss@crudebyte.com>
+Date: Wed, 7 Jun 2023 18:29:33 +0200
+Subject: [PATCH] 9pfs: prevent opening special files (CVE-2023-2861)
+
+The 9p protocol does not specifically define how server shall behave when
+client tries to open a special file, however from security POV it does
+make sense for 9p server to prohibit opening any special file on host side
+in general. A sane Linux 9p client for instance would never attempt to
+open a special file on host side, it would always handle those exclusively
+on its guest side. A malicious client however could potentially escape
+from the exported 9p tree by creating and opening a device file on host
+side.
+
+With QEMU this could only be exploited in the following unsafe setups:
+
+  - Running QEMU binary as root AND 9p 'local' fs driver AND 'passthrough'
+    security model.
+
+or
+
+  - Using 9p 'proxy' fs driver (which is running its helper daemon as
+    root).
+
+These setups were already discouraged for safety reasons before,
+however for obvious reasons we are now tightening behaviour on this.
+
+Fixes: CVE-2023-2861
+Reported-by: Yanwu Shen <ywsPlz@gmail.com>
+Reported-by: Jietao Xiao <shawtao1125@gmail.com>
+Reported-by: Jinku Li <jkli@xidian.edu.cn>
+Reported-by: Wenbo Shen <shenwenbo@zju.edu.cn>
+Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
+Reviewed-by: Greg Kurz <groug@kaod.org>
+Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
+Message-Id: <E1q6w7r-0000Q0-NM@lizzy.crudebyte.com>
+(cherry picked from commit f6b0de53fb87ddefed348a39284c8e2f28dc4eda)
+Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
+---
+ fsdev/virtfs-proxy-helper.c | 27 +++++++++++++++++++++++--
+ hw/9pfs/9p-util.h           | 39 +++++++++++++++++++++++++++++++++++++
+ 2 files changed, 64 insertions(+), 2 deletions(-)
+
+diff --git a/fsdev/virtfs-proxy-helper.c b/fsdev/virtfs-proxy-helper.c
+index 5cafcd77031..d9511f429c9 100644
+--- a/fsdev/virtfs-proxy-helper.c
++++ b/fsdev/virtfs-proxy-helper.c
+@@ -26,6 +26,7 @@
+ #include "qemu/xattr.h"
+ #include "9p-iov-marshal.h"
+ #include "hw/9pfs/9p-proxy.h"
++#include "hw/9pfs/9p-util.h"
+ #include "fsdev/9p-iov-marshal.h"
+ 
+ #define PROGNAME "virtfs-proxy-helper"
+@@ -338,6 +339,28 @@ static void resetugid(int suid, int sgid)
+     }
+ }
+ 
++/*
++ * Open regular file or directory. Attempts to open any special file are
++ * rejected.
++ *
++ * returns file descriptor or -1 on error
++ */
++static int open_regular(const char *pathname, int flags, mode_t mode)
++{
++    int fd;
++
++    fd = open(pathname, flags, mode);
++    if (fd < 0) {
++        return fd;
++    }
++
++    if (close_if_special_file(fd) < 0) {
++        return -1;
++    }
++
++    return fd;
++}
++
+ /*
+  * send response in two parts
+  * 1) ProxyHeader
+@@ -682,7 +705,7 @@ static int do_create(struct iovec *iovec)
+     if (ret < 0) {
+         goto unmarshal_err_out;
+     }
+-    ret = open(path.data, flags, mode);
++    ret = open_regular(path.data, flags, mode);
+     if (ret < 0) {
+         ret = -errno;
+     }
+@@ -707,7 +730,7 @@ static int do_open(struct iovec *iovec)
+     if (ret < 0) {
+         goto err_out;
+     }
+-    ret = open(path.data, flags);
++    ret = open_regular(path.data, flags, 0);
+     if (ret < 0) {
+         ret = -errno;
+     }
+diff --git a/hw/9pfs/9p-util.h b/hw/9pfs/9p-util.h
+index c314cf381d4..df1b583a5e4 100644
+--- a/hw/9pfs/9p-util.h
++++ b/hw/9pfs/9p-util.h
+@@ -13,6 +13,8 @@
+ #ifndef QEMU_9P_UTIL_H
+ #define QEMU_9P_UTIL_H
+ 
++#include "qemu/error-report.h"
++
+ #ifdef O_PATH
+ #define O_PATH_9P_UTIL O_PATH
+ #else
+@@ -95,6 +97,7 @@ static inline int errno_to_dotl(int err) {
+ #endif
+ 
+ #define qemu_openat     openat
++#define qemu_fstat      fstat
+ #define qemu_fstatat    fstatat
+ #define qemu_mkdirat    mkdirat
+ #define qemu_renameat   renameat
+@@ -108,6 +111,38 @@ static inline void close_preserve_errno(int fd)
+     errno = serrno;
+ }
+ 
++/**
++ * close_if_special_file() - Close @fd if neither regular file nor directory.
++ *
++ * @fd: file descriptor of open file
++ * Return: 0 on regular file or directory, -1 otherwise
++ *
++ * CVE-2023-2861: Prohibit opening any special file directly on host
++ * (especially device files), as a compromised client could potentially gain
++ * access outside exported tree under certain, unsafe setups. We expect
++ * client to handle I/O on special files exclusively on guest side.
++ */
++static inline int close_if_special_file(int fd)
++{
++    struct stat stbuf;
++
++    if (qemu_fstat(fd, &stbuf) < 0) {
++        close_preserve_errno(fd);
++        return -1;
++    }
++    if (!S_ISREG(stbuf.st_mode) && !S_ISDIR(stbuf.st_mode)) {
++        error_report_once(
++            "9p: broken or compromised client detected; attempt to open "
++            "special file (i.e. neither regular file, nor directory)"
++        );
++        close(fd);
++        errno = ENXIO;
++        return -1;
++    }
++
++    return 0;
++}
++
+ static inline int openat_dir(int dirfd, const char *name)
+ {
+     return qemu_openat(dirfd, name,
+@@ -142,6 +177,10 @@ again:
+         return -1;
+     }
+ 
++    if (close_if_special_file(fd) < 0) {
++        return -1;
++    }
++
+     serrno = errno;
+     /* O_NONBLOCK was only needed to open the file. Let's drop it. We don't
+      * do that with O_PATH since fcntl(F_SETFL) isn't supported, and openat()
+-- 
+GitLab
diff --git a/srcpkgs/qemu/patches/fix-linux-user-ppc32.patch b/srcpkgs/qemu/patches/fix-linux-user-ppc32.patch
deleted file mode 100644
index cd47435d5aa9..000000000000
--- a/srcpkgs/qemu/patches/fix-linux-user-ppc32.patch
+++ /dev/null
@@ -1,117 +0,0 @@
-commit 37814f62c2cc7aba2eea073014d6c53dcd5bf42c
-Author: q66 <daniel@octaforge.org>
-Date:   Fri Jul 1 16:53:55 2022 +0200
-
-    fix linux-user build on 32-bit ppc
-    
-    Partial revert https://gitlab.com/qemu-project/qemu/-/commit/9d1401b79463e74adbfac69d836789d4e103fb61
-    and https://gitlab.com/qemu-project/qemu/-/commit/0a7e01904d407baa73c1baddbdfc9ccf2ace8356
-
-diff --git a/common-user/host/ppc/safe-syscall.inc.S b/common-user/host/ppc/safe-syscall.inc.S
-new file mode 100644
-index 0000000..e69de29
-diff --git a/common-user/safe-syscall-error.c b/common-user/safe-syscall-error.c
-index cf74b50..a36132c 100644
---- a/common-user/safe-syscall-error.c
-+++ b/common-user/safe-syscall-error.c
-@@ -12,6 +12,7 @@
- #include "qemu/osdep.h"
- #include "user/safe-syscall.h"
- 
-+#if !defined(__powerpc__) || defined(__powerpc64__)
- /*
-  * This is intended to be invoked via tail-call on the error path
-  * from the assembly in host/arch/safe-syscall.inc.S.  This takes
-@@ -23,3 +24,4 @@ long safe_syscall_set_errno_tail(int value)
-     errno = value;
-     return -1;
- }
-+#endif
-diff --git a/include/user/safe-syscall.h b/include/user/safe-syscall.h
-index 61a04e2..793fe84 100644
---- a/include/user/safe-syscall.h
-+++ b/include/user/safe-syscall.h
-@@ -125,6 +125,8 @@
-  * kinds of restartability.
-  */
- 
-+#if !defined(__powerpc__) || defined(__powerpc64__)
-+
- /* The core part of this function is implemented in assembly */
- extern long safe_syscall_base(int *pending, long number, ...);
- extern long safe_syscall_set_errno_tail(int value);
-@@ -137,4 +139,10 @@ extern char safe_syscall_end[];
-     safe_syscall_base(&((TaskState *)thread_cpu->opaque)->signal_pending, \
-                       __VA_ARGS__)
- 
-+#else
-+
-+#define safe_syscall syscall
-+
-+#endif
-+
- #endif
-diff --git a/linux-user/include/host/ppc/host-signal.h b/linux-user/include/host/ppc/host-signal.h
-new file mode 100644
-index 0000000..b80384d
---- /dev/null
-+++ b/linux-user/include/host/ppc/host-signal.h
-@@ -0,0 +1,38 @@
-+/*
-+ * host-signal.h: signal info dependent on the host architecture
-+ *
-+ * Copyright (c) 2003-2005 Fabrice Bellard
-+ * Copyright (c) 2021 Linaro Limited
-+ *
-+ * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
-+ * See the COPYING file in the top-level directory.
-+ */
-+
-+#ifndef PPC_HOST_SIGNAL_H
-+#define PPC_HOST_SIGNAL_H
-+
-+/* The third argument to a SA_SIGINFO handler is ucontext_t. */
-+typedef ucontext_t host_sigcontext;
-+
-+static inline uintptr_t host_signal_pc(host_sigcontext *uc)
-+{
-+    return uc->uc_mcontext.regs->nip;
-+}
-+
-+static inline void host_signal_set_pc(host_sigcontext *uc, uintptr_t pc)
-+{
-+    uc->uc_mcontext.regs->nip = pc;
-+}
-+
-+static inline void *host_signal_mask(host_sigcontext *uc)
-+{
-+    return &uc->uc_sigmask;
-+}
-+
-+static inline bool host_signal_write(siginfo_t *info, host_sigcontext *uc)
-+{
-+    return uc->uc_mcontext.regs->trap != 0x400
-+        && (uc->uc_mcontext.regs->dsisr & 0x02000000);
-+}
-+
-+#endif
-diff --git a/linux-user/signal.c b/linux-user/signal.c
-index 092e70b..b8dfa8a 100644
---- a/linux-user/signal.c
-+++ b/linux-user/signal.c
-@@ -800,6 +800,7 @@ void queue_signal(CPUArchState *env, int sig, int si_type,
- /* Adjust the signal context to rewind out of safe-syscall if we're in it */
- static inline void rewind_if_in_safe_syscall(void *puc)
- {
-+#if !defined(__powerpc__) || defined(__powerpc64__)
-     host_sigcontext *uc = (host_sigcontext *)puc;
-     uintptr_t pcreg = host_signal_pc(uc);
- 
-@@ -807,6 +808,7 @@ static inline void rewind_if_in_safe_syscall(void *puc)
-         && pcreg < (uintptr_t)safe_syscall_end) {
-         host_signal_set_pc(uc, (uintptr_t)safe_syscall_start);
-     }
-+#endif
- }
- 
- static void host_signal_handler(int host_sig, siginfo_t *info, void *puc)
diff --git a/srcpkgs/qemu/patches/fix-softfloat-fesetround.patch b/srcpkgs/qemu/patches/fix-softfloat-fesetround.patch
deleted file mode 100644
index ecdd049f7921..000000000000
--- a/srcpkgs/qemu/patches/fix-softfloat-fesetround.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-Source: @pullmoll
-Upstream: no
-Reason: Target architectures with soft float do not define these constants.
-
---- a/tests/fp/fp-bench.c	2020-12-08 17:59:44.000000000 +0100
-+++ b/tests/fp/fp-bench.c	2020-12-12 20:38:40.702235420 +0100
-@@ -485,16 +485,32 @@
- 
-     switch (rounding) {
-     case ROUND_EVEN:
-+#if defined(FE_TONEAREST)
-         rhost = FE_TONEAREST;
-+#else
-+	return;
-+#endif
-         break;
-     case ROUND_ZERO:
-+#if defined(FE_TOWARDZERO)
-         rhost = FE_TOWARDZERO;
-+#else
-+	return;
-+#endif
-         break;
-     case ROUND_DOWN:
-+#if defined(FE_DOWNWARD)
-         rhost = FE_DOWNWARD;
-+#else
-+	return;
-+#endif
-         break;
-     case ROUND_UP:
-+#if defined(FE_UPWARD)
-         rhost = FE_UPWARD;
-+#else
-+	return;
-+#endif
-         break;
-     case ROUND_TIEAWAY:
-         die_host_rounding(rounding);
diff --git a/srcpkgs/qemu/patches/gcc12.patch b/srcpkgs/qemu/patches/gcc12.patch
deleted file mode 100644
index 2a4b2bd03609..000000000000
--- a/srcpkgs/qemu/patches/gcc12.patch
+++ /dev/null
@@ -1,72 +0,0 @@
-From 5cb993ff131fca2abef3ce074a20258fd6fce557 Mon Sep 17 00:00:00 2001
-From: Bernhard Beschow <shentey@gmail.com>
-Date: Sat, 18 Mar 2023 19:59:31 +0100
-Subject: [PATCH] qemu/osdep: Switch position of "extern" and "G_NORETURN"
-
-Fixes the Windows build under msys2 using GCC 12 which fails with the following
-error:
-
-  [184/579] Compiling C++ object qga/vss-win32/qga-vss.dll.p/install.cpp.obj
-  FAILED: qga/vss-win32/qga-vss.dll.p/install.cpp.obj
-  "c++" "-m64" "-mcx16" "-Iqga/vss-win32/qga-vss.dll.p" "-Iqga/vss-win32" "-I../src/qga/vss-win32" "-I." "-Iqapi" "-Itrace" "-Iui" "-Iui/shader" "-IC:/msys64/mingw64/include/glib-2.0" "-IC:/msys64/mingw64/lib/glib-2.0/include" "-fdiagnostics-color=auto" "-Wall" "-Winvalid-pch" "-Wnon-virtual-dtor" "-Werror" "-std=gnu++11" "-g" "-iquote" "." "-iquote" "C:/msys64/home/shentey/Projects/qemu/src" "-iquote" "C:/msys64/home/shentey/Projects/qemu/src/include" "-iquote" "C:/msys64/home/shentey/Projects/qemu/src/tcg/i386" "-D__STDC_LIMIT_MACROS" "-D__STDC_CONSTANT_MACROS" "-D__STDC_FORMAT_MACROS" "-fno-pie" "-no-pie" "-D_GNU_SOURCE" "-D_FILE_OFFSET_BITS=64" "-D_LARGEFILE_SOURCE" "-fno-strict-aliasing" "-fno-common" "-fwrapv" "-Wundef" "-Wwrite-strings" "-Wtype-limits" "-Wformat-security" "-Wformat-y2k" "-Winit-self" "-Wignored-qualifiers" "-Wempty-body" "-Wendif-labels" "-Wexpansion-to-defined" "-Wimplicit-fallthrough=2" "-Wmissing-format-attribute" "-Wno-missing-include-dirs" "-Wno-shift-negative-value" "-Wno-psabi" "-fstack-protector-strong" "-Wno-unknown-pragmas" "-Wno-delete-non-virtual-dtor" "-Wno-non-virtual-dtor" -MD -MQ qga/vss-win32/qga-vss.dll.p/install.cpp.obj -MF "qga/vss-win32/qga-vss.dll.p/install.cpp.obj.d" -o qga/vss-win32/qga-vss.dll.p/install.cpp.obj "-c" ../src/qga/vss-win32/install.cpp
-  In file included from C:/msys64/mingw64/lib/glib-2.0/include/glibconfig.h:9,
-              from C:/msys64/mingw64/include/glib-2.0/glib/gtypes.h:34,
-              from C:/msys64/mingw64/include/glib-2.0/glib/galloca.h:34,
-              from C:/msys64/mingw64/include/glib-2.0/glib.h:32,
-              from C:/msys64/home/shentey/Projects/qemu/src/include/glib-compat.h:32,
-              from C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:144,
-              from ../src/qga/vss-win32/install.cpp:13:
-  C:/msys64/mingw64/include/glib-2.0/glib/gmacros.h:1075:21: error: standard attributes in middle of decl-specifiers
-  1075 | # define G_NORETURN [[noreturn]]
-        |                     ^
-  C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:240:8: note: in expansion of macro 'G_NORETURN'
-  240 | extern G_NORETURN
-        |        ^~~~~~~~~~
-  C:/msys64/mingw64/include/glib-2.0/glib/gmacros.h:1075:21: note: standard attributes must precede the decl-specifiers to apply to the declaration, or follow them to apply to the type
-  1075 | # define G_NORETURN [[noreturn]]
-        |                     ^
-  C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:240:8: note: in expansion of macro 'G_NORETURN'
-  240 | extern G_NORETURN
-        |        ^~~~~~~~~~
-  C:/msys64/mingw64/include/glib-2.0/glib/gmacros.h:1075:21: error: attribute ignored [-Werror=attributes]
-  1075 | # define G_NORETURN [[noreturn]]
-        |                     ^
-  C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:240:8: note: in expansion of macro 'G_NORETURN'
-  240 | extern G_NORETURN
-        |        ^~~~~~~~~~
-  C:/msys64/mingw64/include/glib-2.0/glib/gmacros.h:1075:21: note: an attribute that appertains to a type-specifier is ignored
-  1075 | # define G_NORETURN [[noreturn]]
-        |                     ^
-  C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:240:8: note: in expansion of macro 'G_NORETURN'
-  240 | extern G_NORETURN
-        |        ^~~~~~~~~~
-  cc1plus.exe: all warnings being treated as errors
-
-Apparently it also fixes the compilation with Clang 15 (see
-https://gitlab.com/qemu-project/qemu/-/issues/1541 ).
-
-Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1541
-Signed-off-by: Bernhard Beschow <shentey@gmail.com>
-Message-Id: <20230318185931.181659-1-shentey@gmail.com>
-Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
-Signed-off-by: Thomas Huth <thuth@redhat.com>
----
- include/qemu/osdep.h | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
-index f68b5d8708c..9eff0be95bd 100644
---- a/include/qemu/osdep.h
-+++ b/include/qemu/osdep.h
-@@ -237,7 +237,7 @@ extern "C" {
-  * supports QEMU_ERROR, this will be reported at compile time; otherwise
-  * this will be reported at link time due to the missing symbol.
-  */
--extern G_NORETURN
-+G_NORETURN extern
- void QEMU_ERROR("code path is reachable")
-     qemu_build_not_reached_always(void);
- #if defined(__OPTIMIZE__) && !defined(__NO_INLINE__)
--- 
-GitLab
-
diff --git a/srcpkgs/qemu/patches/keymap.patch b/srcpkgs/qemu/patches/keymap.patch
new file mode 100644
index 000000000000..c4d9963cd636
--- /dev/null
+++ b/srcpkgs/qemu/patches/keymap.patch
@@ -0,0 +1,47 @@
+The xkb official name for the Arabic keyboard layout is 'ara'.
+However xkb has for at least the past 15 years also permitted it to
+be named via the legacy synonym 'ar'.  In xkeyboard-config 2.39 this
+synoynm was removed, which breaks compilation of QEMU:
+
+FAILED: pc-bios/keymaps/ar
+/home/fred/qemu-git/src/qemu/build-full/qemu-keymap -f pc-bios/keymaps/ar -l ar
+xkbcommon: ERROR: Couldn't find file "symbols/ar" in include paths
+xkbcommon: ERROR: 1 include paths searched:
+xkbcommon: ERROR: 	/usr/share/X11/xkb
+xkbcommon: ERROR: 3 include paths could not be added:
+xkbcommon: ERROR: 	/home/fred/.config/xkb
+xkbcommon: ERROR: 	/home/fred/.xkb
+xkbcommon: ERROR: 	/etc/xkb
+xkbcommon: ERROR: Abandoning symbols file "(unnamed)"
+xkbcommon: ERROR: Failed to compile xkb_symbols
+xkbcommon: ERROR: Failed to compile keymap
+
+The upstream xkeyboard-config change removing the compat
+mapping is:
+https://gitlab.freedesktop.org/xkeyboard-config/xkeyboard-config/-/commit/470ad2cd8fea84d7210377161d86b31999bb5ea6
+
+Make QEMU always ask for the 'ara' xkb layout, which should work on
+both older and newer xkeyboard-config.  We leave the QEMU name for
+this keyboard layout as 'ar'; it is not the only one where our name
+for it deviates from the xkb standard name.
+
+Cc: qemu-stable@nongnu.org
+Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
+Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1709
+---
+ pc-bios/keymaps/meson.build | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/pc-bios/keymaps/meson.build b/pc-bios/keymaps/meson.build
+index bff30833137..0bd8ce00775 100644
+--- a/pc-bios/keymaps/meson.build
++++ b/pc-bios/keymaps/meson.build
+@@ -1,5 +1,5 @@
+ keymaps = {
+-  'ar': '-l ar',
++  'ar': '-l ara',
+   'bepo': '-l fr -v dvorak',
+   'cz': '-l cz',
+   'da': '-l dk',
+-- 
+2.34.1
diff --git a/srcpkgs/qemu/patches/mmap-mremap-efault.patch b/srcpkgs/qemu/patches/mmap-mremap-efault.patch
deleted file mode 100644
index 5a70e9658b30..000000000000
--- a/srcpkgs/qemu/patches/mmap-mremap-efault.patch
+++ /dev/null
@@ -1,42 +0,0 @@
-Source: @pullmoll
-Upstream: no
-Reason: errno=EFAULT when the address passed to mremap(2) is not valid
-
-See Rich Felker's comment at https://www.openwall.com/lists/musl/2017/06/21/2 for
-why we need to return errno as described in man mremap(2) from qemu-user-static.
-Also speed up the loop when checking for increasing the mappings size to go
-in steps of TARGET_PAGE_SIZE and OR-in a check for the very last byte of the range.
-diff --git linux-user/mmap.c linux-user/mmap.c
-index 7e3b245..1e8d0f1 100644
---- a/linux-user/mmap.c
-+++ b/linux-user/mmap.c
-@@ -738,7 +738,7 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size,
-          !guest_range_valid_untagged(new_addr, new_size)) ||
-         ((flags & MREMAP_MAYMOVE) == 0 &&
-          !guest_range_valid_untagged(old_addr, new_size))) {
--        errno = ENOMEM;
-+        errno = EFAULT;
-         return -1;
-     }
- 
-@@ -775,9 +775,10 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size,
-             abi_ulong addr;
-             for (addr = old_addr + old_size;
-                  addr < old_addr + new_size;
--                 addr++) {
-+                 addr += TARGET_PAGE_SIZE) {
-                 prot |= page_get_flags(addr);
-             }
-+				prot |= page_get_flags(old_addr + new_size - 1);
-         }
-         if (prot == 0) {
-             host_addr = mremap(g2h_untagged(old_addr),
-@@ -796,7 +797,7 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size,
-                 }
-             }
-         } else {
--            errno = ENOMEM;
-+            errno = EFAULT;
-             host_addr = MAP_FAILED;
-         }
-     }
diff --git a/srcpkgs/qemu/patches/musl-initialize-msghdr.patch b/srcpkgs/qemu/patches/musl-initialize-msghdr.patch
index 6d96b3511daf..a88547354c1e 100644
--- a/srcpkgs/qemu/patches/musl-initialize-msghdr.patch
+++ b/srcpkgs/qemu/patches/musl-initialize-msghdr.patch
@@ -1,10 +1,10 @@
 Source: https://github.com/void-linux/void-packages/issues/23557
 
-diff --git linux-user/syscall.c linux-user/syscall.c
-index 945fc25..8d8b68a 100644
+diff --git a/linux-user/syscall.c b/linux-user/syscall.c
+index 14fdebd..de280af 100644
 --- a/linux-user/syscall.c
 +++ b/linux-user/syscall.c
-@@ -3071,7 +3071,7 @@ static abi_long do_sendrecvmsg_locked(int fd, struct target_msghdr *msgp,
+@@ -3229,7 +3229,7 @@ static abi_long do_sendrecvmsg_locked(int fd, struct target_msghdr *msgp,
                                        int flags, int send)
  {
      abi_long ret, len;
diff --git a/srcpkgs/qemu/patches/musl-ppc.patch b/srcpkgs/qemu/patches/musl-ppc.patch
deleted file mode 100644
index 0b77aa8fc63d..000000000000
--- a/srcpkgs/qemu/patches/musl-ppc.patch
+++ /dev/null
@@ -1,25 +0,0 @@
---- a/linux-user/signal.c
-+++ b/linux-user/signal.c
-@@ -21,5 +21,9 @@
- #include "exec/gdbstub.h"
- #include "hw/core/tcg-cpu-ops.h"
- 
-+#if defined(_ARCH_PPC64) && !defined(__GLIBC__) /* musl */
-+#include <asm/ptrace.h>
-+#endif
-+
- #include <sys/ucontext.h>
- #include <sys/resource.h>
---- a/util/mmap-alloc.c
-+++ b/util/mmap-alloc.c
-@@ -25,6 +25,10 @@
- 
- #ifdef CONFIG_LINUX
- #include <sys/vfs.h>
-+/* musl undefs this on ppc and mips */
-+#ifndef MAP_SYNC
-+#define MAP_SYNC 0x80000
-+#endif
- #endif
- 
- size_t qemu_fd_getpagesize(int fd)
diff --git a/srcpkgs/qemu/patches/musl-rlimit-rttime.patch b/srcpkgs/qemu/patches/musl-rlimit-rttime.patch
deleted file mode 100644
index 0cbf9be36a8f..000000000000
--- a/srcpkgs/qemu/patches/musl-rlimit-rttime.patch
+++ /dev/null
@@ -1,13 +0,0 @@
---- a/linux-user/syscall.c
-+++ b/linux-user/syscall.c
-@@ -141,6 +141,10 @@
- #include "fd-trans.h"
- #include "tcg/tcg.h"
- 
-+#ifndef RLIMIT_RTTIME
-+#define RLIMIT_RTTIME 15
-+#endif
-+
- #ifndef CLONE_IO
- #define CLONE_IO                0x80000000      /* Clone io context */
- #endif
diff --git a/srcpkgs/qemu/patches/xxx-ppcle.patch b/srcpkgs/qemu/patches/xxx-ppcle.patch
deleted file mode 100644
index 90b32b5e07cd..000000000000
--- a/srcpkgs/qemu/patches/xxx-ppcle.patch
+++ /dev/null
@@ -1,113 +0,0 @@
-From 7ece08d7902d5a8c007deeb0b75cb533a41dd882 Mon Sep 17 00:00:00 2001
-From: Daniel Kolesa <daniel@octaforge.org>
-Date: Sun, 7 Mar 2021 01:47:42 +0100
-Subject: [PATCH] support ppcle architecture
-
----
- configure                            | 14 ++++++++++++--
- configs/targets/ppcle-linux-user.mak |  4 ++++
- linux-user/ppc/target_syscall.h      |  4 ++++
- scripts/qemu-binfmt-conf.sh          |  6 +++++-
- tests/tcg/configure.sh               |  2 ++
- 5 files changed, 27 insertions(+), 3 deletions(-)
- create mode 100644 configs/targets/ppcle-linux-user.mak
-
-diff --git a/configure b/configure
-index 18c26e0..03d3e18 100755
---- a/configure
-+++ b/configure
-@@ -653,7 +653,11 @@ elif check_define _ARCH_PPC ; then
-       cpu="ppc64"
-     fi
-   else
--    cpu="ppc"
-+    if check_define _LITTLE_ENDIAN ; then
-+      cpu="ppcle"
-+    else
-+      cpu="ppc"
-+    fi
-   fi
- elif check_define __mips__ ; then
-   cpu="mips"
-@@ -638,6 +642,9 @@
- 
-   ppc)
-     CPU_CFLAGS="-m32" ;;
-+  ppcle)
-+    cpu="ppc"
-+    CPU_CFLAGS="-m32 -mlittle-endian" ;;
-   ppc64)
-     CPU_CFLAGS="-m64 -mbig-endian" ;;
-   ppc64le)
-diff --git a/configs/targets/ppcle-linux-user.mak b/configs/targets/ppcle-linux-user.mak
-new file mode 100644
-index 0000000..2259243
---- /dev/null
-+++ b/configs/targets/ppcle-linux-user.mak
-@@ -0,0 +1,4 @@
-+TARGET_ARCH=ppc
-+TARGET_SYSTBL_ABI=common,nospu,32
-+TARGET_SYSTBL=syscall.tbl
-+TARGET_XML_FILES= gdb-xml/power-core.xml gdb-xml/power-fpu.xml gdb-xml/power-altivec.xml gdb-xml/power-spe.xml
-diff --git a/linux-user/ppc/target_syscall.h b/linux-user/ppc/target_syscall.h
-index b9c4b81..cf26497 100644
---- a/linux-user/ppc/target_syscall.h
-+++ b/linux-user/ppc/target_syscall.h
-@@ -65,7 +65,11 @@ struct target_revectored_struct {
- #define UNAME_MACHINE "ppc64le"
- #endif
- #else
-+#if TARGET_BIG_ENDIAN
- #define UNAME_MACHINE "ppc"
-+#else
-+#define UNAME_MACHINE "ppcle"
-+#endif
- #endif
- #define UNAME_MINIMUM_RELEASE "2.6.32"
- 
-diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh
-index 9f1580a..393943f 100755
---- a/scripts/qemu-binfmt-conf.sh
-+++ b/scripts/qemu-binfmt-conf.sh
-@@ -46,6 +46,10 @@ ppc_magic='\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x
- ppc_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
- ppc_family=ppc
- 
-+ppcle_magic='\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x14\x00'
-+ppcle_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\x00'
-+ppc_family=ppcle
-+
- ppc64_magic='\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x15'
- ppc64_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
- ppc64_family=ppc
-@@ -148,7 +152,7 @@ qemu_get_family() {
-     "Power Macintosh"|ppc64|powerpc|ppc)
-         echo "ppc"
-         ;;
--    ppc64el|ppc64le)
-+    ppc64el|ppc64le|ppcel|ppcle)
-         echo "ppcle"
-         ;;
-     arm|armel|armhf|arm64|armv[4-9]*l|aarch64)
-diff --git a/configure b/configure
-index 72ab03f11a..0691929d76 100755
---- a/configure
-+++ b/configure
-@@ -1866,6 +1866,7 @@ fi
- : ${cross_prefix_mips="mips-linux-gnu-"}
- : ${cross_prefix_nios2="nios2-linux-gnu-"}
- : ${cross_prefix_ppc="powerpc-linux-gnu-"}
-+: ${cross_prefix_ppcle="powerpcle-linux-gnu-"}
- : ${cross_prefix_ppc64="powerpc64-linux-gnu-"}
- : ${cross_prefix_ppc64le="$cross_prefix_ppc64"}
- : ${cross_prefix_riscv64="riscv64-linux-gnu-"}
-@@ -1883,6 +1884,7 @@ fi
- : ${cross_cc_cflags_hexagon="-mv67 -O2 -static"}
- : ${cross_cc_cflags_i386="-m32"}
- : ${cross_cc_cflags_ppc="-m32 -mbig-endian"}
-+: ${cross_cc_cflags_ppcle="-m32"}
- : ${cross_cc_cflags_ppc64="-m64 -mbig-endian"}
- : ${cross_cc_ppc64le="$cross_cc_ppc64"}
- : ${cross_cc_cflags_ppc64le="-m64 -mlittle-endian"}
-2.30.1
-
diff --git a/srcpkgs/qemu/template b/srcpkgs/qemu/template
index 48ab199e5686..178a3f08f24d 100644
--- a/srcpkgs/qemu/template
+++ b/srcpkgs/qemu/template
@@ -1,8 +1,8 @@
 # Template file for 'qemu'
 # This package should be updated together with qemu-user-static
 pkgname=qemu
-version=7.1.0
-revision=2
+version=8.0.2
+revision=1
 build_style=configure
 configure_args="--prefix=/usr --sysconfdir=/etc --libexecdir=/usr/libexec --localstatedir=/var
  --disable-glusterfs --disable-xen --enable-docs --enable-kvm --enable-libusb --enable-pie
@@ -10,10 +10,10 @@ configure_args="--prefix=/usr --sysconfdir=/etc --libexecdir=/usr/libexec --loca
  --audio-drv-list=alsa$(vopt_if sdl2 ,sdl)$(vopt_if jack ,jack)$(vopt_if pulseaudio ,pa)
  $(vopt_enable opengl) $(vopt_enable pulseaudio pa) $(vopt_enable sdl2 sdl) $(vopt_enable smartcard)
  $(vopt_enable spice) $(vopt_enable virgl virglrenderer) $(vopt_if gtk3 '--enable-gtk')"
-hostmakedepends="gettext pkg-config perl python3 python3-Sphinx python3-sphinx_rtd_theme ninja"
+hostmakedepends="flex gettext glib-devel pkg-config perl python3 python3-Sphinx python3-sphinx_rtd_theme ninja"
 makedepends="capstone-devel dtc-devel libpng-devel libjpeg-turbo-devel pixman-devel
- snappy-devel libuuid-devel libX11-devel alsa-lib-devel libaio-devel gnutls-devel
- libsasl-devel libglib-devel ncurses-devel libseccomp-devel nss-devel
+ snappy-devel libuuid-devel libX11-devel alsa-lib-devel libaio-devel
+ gnutls-devel libsasl-devel ncurses-devel libseccomp-devel nss-devel
  libcurl-devel xfsprogs-devel libcap-ng-devel vde2-devel usbredir-devel
  libbluetooth-devel libssh2-devel libusb-devel libnfs-devel libslirp-devel
  libxkbcommon-devel libzstd-devel $(vopt_if sdl2 'SDL2-devel SDL2_image-devel')
@@ -25,17 +25,17 @@ makedepends="capstone-devel dtc-devel libpng-devel libjpeg-turbo-devel pixman-de
  $(vopt_if jack 'jack-devel') $(vopt_if pulseaudio 'pulseaudio-devel')"
 short_desc="Open Source Processor Emulator"
 maintainer="Orphaned <orphan@voidlinux.org>"
-license="GPL-2.0-or-later, LGPL-2.1-or-later"
+license="GPL-2.0-only, LGPL-2.1-only"
 homepage="https://www.qemu.org"
 distfiles="https://wiki.qemu.org/download/qemu-${version}.tar.bz2"
-checksum=f7ac2b85b3f1831e6810b140306e30af91556e15784864b209f3942858947fd0
+checksum=b59281923d60d358a7d7d3bde46ba43c0810d34d26608fcdaf6bf4c42492b694
 ignore_elf_dirs="/usr/share/qemu"
 nostrip_files="hppa-firmware.img openbios-ppc openbios-sparc32 openbios-sparc64
  palcode-clipper s390-ccw.img s390-netboot.img u-boot.e500 opensbi-riscv32-generic-fw_dynamic.elf
  opensbi-riscv64-generic-fw_dynamic.elf"
 
-build_options="gtk3 opengl sdl2 spice virgl smartcard numa iscsi jack pulseaudio"
-build_options_default="opengl gtk3 virgl sdl2 numa iscsi jack pulseaudio"
+build_options="gtk3 iscsi jack numa opengl pulseaudio sdl2 smartcard spice virgl"
+build_options_default="gtk3 iscsi jack numa opengl pulseaudio sdl2 smartcard spice virgl"
 desc_option_sdl2="Enable SDL (2.x) video output"
 desc_option_spice="Enable support for SPICE"
 desc_option_virgl="Enable support for VirGL (A Virtual 3D GPU renderer)"
@@ -43,37 +43,10 @@ desc_option_smartcard="Enable smartcard support"
 desc_option_numa="Enable support for host NUMA"
 desc_option_iscsi="Enable support for iSCSI"
 
-case "$XBPS_TARGET_MACHINE" in
-	aarch64-musl) CFLAGS="-D_LINUX_SYSINFO_H";;
-esac
-
-if [ "$XBPS_TARGET_ENDIAN" = "le" ]; then
-	build_options_default+=" spice"
-fi
-
 if [ "$CROSS_BUILD" ]; then
-	configure_args+=" --cross-prefix=${XBPS_CROSS_TRIPLET}-"
-else
-	build_options_default+=" smartcard"
-fi
-
-if [ "$XBPS_CHECK_PKGS" != full ]; then
-	make_check_target=check-unit
+	configure_args+=" --cross-prefix=${XBPS_CROSS_TRIPLET}"
 fi
 
-post_extract() {
-	if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
-		grep -rl 'Input/output error' tests/qemu-iotests |
-			xargs -n1 sed -i -e 's;Input/output error;I/O error;g'
-		grep -rl 'Operation not supported' tests/qemu-iotests |
-			xargs -n1 sed -i -e 's;Operation not supported;Not supported;g'
-	fi
-}
-
-pre_configure() {
-	unset CPP
-}
-
 post_install() {
 	vdoc "${FILESDIR}/README.voidlinux"
 

From 6300509c8bfef8e839deb9434d024b0f2f698d02 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Cerqueira?= <acerqueira021@gmail.com>
Date: Mon, 3 Jul 2023 18:41:30 +0100
Subject: [PATCH 2/2] qemu-user-static: update to 8.0.2.

---
 srcpkgs/qemu-user-static/template | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/srcpkgs/qemu-user-static/template b/srcpkgs/qemu-user-static/template
index 2a8da9b53f2d..509688be23f3 100644
--- a/srcpkgs/qemu-user-static/template
+++ b/srcpkgs/qemu-user-static/template
@@ -1,20 +1,20 @@
 # Template file for 'qemu-user-static'
 # This package should be updated together with qemu
 pkgname=qemu-user-static
-version=7.1.0
-revision=3
+version=8.0.2
+revision=1
 build_style=configure
 configure_args="--prefix=/usr --sysconfdir=/etc --libexecdir=/usr/libexec
  --disable-kvm --disable-png --disable-virtfs --disable-fdt --disable-seccomp
  --enable-linux-user --disable-system --static --disable-pie"
-hostmakedepends="pkg-config perl python3 ninja"
+hostmakedepends="flex glib-devel pkg-config perl python3 ninja"
 makedepends="dtc-devel libglib-devel pixman-devel libuuid-devel"
 short_desc="QEMU User-mode emulators (statically compiled)"
 maintainer="Orphaned <orphan@voidlinux.org>"
-license="GPL-2.0-or-later, LGPL-2.1-or-later"
+license="GPL-2.0-only, LGPL-2.1-only"
 homepage="https://www.qemu.org"
 distfiles="https://wiki.qemu.org/download/qemu-${version}.tar.bz2"
-checksum=f7ac2b85b3f1831e6810b140306e30af91556e15784864b209f3942858947fd0
+checksum=b59281923d60d358a7d7d3bde46ba43c0810d34d26608fcdaf6bf4c42492b694
 
 _fmts="aarch64 aarch64_be alpha arm armeb cris hppa i386 m68k microblaze
  microblazeel mips mipsel mips64 mips64el mipsn32 mipsn32el or1k
@@ -111,10 +111,6 @@ done
 
 binfmts="${binfmts%?}"
 
-pre_configure() {
-	unset CPP
-}
-
 post_install() {
 	# Remove unneeded stuff.
 	rm -rf ${DESTDIR}/etc ${DESTDIR}/usr/share ${DESTDIR}/usr/libexec

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [PR PATCH] [Updated] qemu: update to 8.0.2.
  2023-07-03 17:50 [PR PATCH] qemu: update to 8.0.2 motorto
                   ` (2 preceding siblings ...)
  2023-07-04 13:28 ` motorto
@ 2023-07-04 13:32 ` motorto
  2023-07-10 14:43 ` motorto
                   ` (34 subsequent siblings)
  38 siblings, 0 replies; 40+ messages in thread
From: motorto @ 2023-07-04 13:32 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1357 bytes --]

There is an updated pull request by motorto against master on the void-packages repository

https://github.com/motorto/void-packages qemu-8.0.2
https://github.com/void-linux/void-packages/pull/44822

qemu: update to 8.0.2.
<!-- Uncomment relevant sections and delete options which are not applicable -->
[ci-skip] 
#### Testing the changes
- I tested the changes in this PR: **YES**, runned a Windows vm machine and it worked fine.

Removed a bunch of patches that in my research are no longer needed:

- Removed all ppc related patches since that arch isn't no longer supported.
- gcc12.patch: because it builds fine now in this version
- fix-softfloat-fesetround.patch: don't have a system to try it, but alpine doesn't have any patch related to this)
- mmap-mremap-efaul: not sure about if we should keep this one

Kept this patches:

- musl-initialize-msghdr.patch: just update in order to apply.

Added this ones:

- CVE-2023-2861.patch:
- keymap.patch: xkeyboard-config 2.39 removed the legacy alias of ar -> ara

#### Local build testing
- I built this PR locally for my native architecture, x86-64-glibc
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl (cross)
  - x86_64-musl



A patch file from https://github.com/void-linux/void-packages/pull/44822.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-qemu-8.0.2-44822.patch --]
[-- Type: text/x-diff, Size: 33205 bytes --]

From 326703382a2865f5f75c502441ba5af476756baa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Cerqueira?= <acerqueira021@gmail.com>
Date: Mon, 3 Jul 2023 18:41:12 +0100
Subject: [PATCH 1/2] qemu: update to 8.0.2.

---
 srcpkgs/qemu/patches/CVE-2023-2861.patch      | 177 ++++++++++++++++++
 .../qemu/patches/fix-linux-user-ppc32.patch   | 117 ------------
 .../patches/fix-softfloat-fesetround.patch    |  39 ----
 srcpkgs/qemu/patches/gcc12.patch              |  72 -------
 srcpkgs/qemu/patches/keymap.patch             |  30 +++
 srcpkgs/qemu/patches/mmap-mremap-efault.patch |  42 -----
 .../qemu/patches/musl-initialize-msghdr.patch |   6 +-
 srcpkgs/qemu/patches/musl-ppc.patch           |  25 ---
 srcpkgs/qemu/patches/musl-rlimit-rttime.patch |  13 --
 srcpkgs/qemu/patches/xxx-ppcle.patch          | 113 -----------
 srcpkgs/qemu/template                         |  47 +----
 11 files changed, 220 insertions(+), 461 deletions(-)
 create mode 100644 srcpkgs/qemu/patches/CVE-2023-2861.patch
 delete mode 100644 srcpkgs/qemu/patches/fix-linux-user-ppc32.patch
 delete mode 100644 srcpkgs/qemu/patches/fix-softfloat-fesetround.patch
 delete mode 100644 srcpkgs/qemu/patches/gcc12.patch
 create mode 100644 srcpkgs/qemu/patches/keymap.patch
 delete mode 100644 srcpkgs/qemu/patches/mmap-mremap-efault.patch
 delete mode 100644 srcpkgs/qemu/patches/musl-ppc.patch
 delete mode 100644 srcpkgs/qemu/patches/musl-rlimit-rttime.patch
 delete mode 100644 srcpkgs/qemu/patches/xxx-ppcle.patch

diff --git a/srcpkgs/qemu/patches/CVE-2023-2861.patch b/srcpkgs/qemu/patches/CVE-2023-2861.patch
new file mode 100644
index 000000000000..dca869f1d77f
--- /dev/null
+++ b/srcpkgs/qemu/patches/CVE-2023-2861.patch
@@ -0,0 +1,177 @@
+Patch-Source: https://gitlab.com/qemu-project/qemu/-/commit/b9d2887be4e616cdaeedd0b7456bfaa71ee798af
+--
+From b9d2887be4e616cdaeedd0b7456bfaa71ee798af Mon Sep 17 00:00:00 2001
+From: Christian Schoenebeck <qemu_oss@crudebyte.com>
+Date: Wed, 7 Jun 2023 18:29:33 +0200
+Subject: [PATCH] 9pfs: prevent opening special files (CVE-2023-2861)
+
+The 9p protocol does not specifically define how server shall behave when
+client tries to open a special file, however from security POV it does
+make sense for 9p server to prohibit opening any special file on host side
+in general. A sane Linux 9p client for instance would never attempt to
+open a special file on host side, it would always handle those exclusively
+on its guest side. A malicious client however could potentially escape
+from the exported 9p tree by creating and opening a device file on host
+side.
+
+With QEMU this could only be exploited in the following unsafe setups:
+
+  - Running QEMU binary as root AND 9p 'local' fs driver AND 'passthrough'
+    security model.
+
+or
+
+  - Using 9p 'proxy' fs driver (which is running its helper daemon as
+    root).
+
+These setups were already discouraged for safety reasons before,
+however for obvious reasons we are now tightening behaviour on this.
+
+Fixes: CVE-2023-2861
+Reported-by: Yanwu Shen <ywsPlz@gmail.com>
+Reported-by: Jietao Xiao <shawtao1125@gmail.com>
+Reported-by: Jinku Li <jkli@xidian.edu.cn>
+Reported-by: Wenbo Shen <shenwenbo@zju.edu.cn>
+Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
+Reviewed-by: Greg Kurz <groug@kaod.org>
+Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
+Message-Id: <E1q6w7r-0000Q0-NM@lizzy.crudebyte.com>
+(cherry picked from commit f6b0de53fb87ddefed348a39284c8e2f28dc4eda)
+Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
+---
+ fsdev/virtfs-proxy-helper.c | 27 +++++++++++++++++++++++--
+ hw/9pfs/9p-util.h           | 39 +++++++++++++++++++++++++++++++++++++
+ 2 files changed, 64 insertions(+), 2 deletions(-)
+
+diff --git a/fsdev/virtfs-proxy-helper.c b/fsdev/virtfs-proxy-helper.c
+index 5cafcd77031..d9511f429c9 100644
+--- a/fsdev/virtfs-proxy-helper.c
++++ b/fsdev/virtfs-proxy-helper.c
+@@ -26,6 +26,7 @@
+ #include "qemu/xattr.h"
+ #include "9p-iov-marshal.h"
+ #include "hw/9pfs/9p-proxy.h"
++#include "hw/9pfs/9p-util.h"
+ #include "fsdev/9p-iov-marshal.h"
+ 
+ #define PROGNAME "virtfs-proxy-helper"
+@@ -338,6 +339,28 @@ static void resetugid(int suid, int sgid)
+     }
+ }
+ 
++/*
++ * Open regular file or directory. Attempts to open any special file are
++ * rejected.
++ *
++ * returns file descriptor or -1 on error
++ */
++static int open_regular(const char *pathname, int flags, mode_t mode)
++{
++    int fd;
++
++    fd = open(pathname, flags, mode);
++    if (fd < 0) {
++        return fd;
++    }
++
++    if (close_if_special_file(fd) < 0) {
++        return -1;
++    }
++
++    return fd;
++}
++
+ /*
+  * send response in two parts
+  * 1) ProxyHeader
+@@ -682,7 +705,7 @@ static int do_create(struct iovec *iovec)
+     if (ret < 0) {
+         goto unmarshal_err_out;
+     }
+-    ret = open(path.data, flags, mode);
++    ret = open_regular(path.data, flags, mode);
+     if (ret < 0) {
+         ret = -errno;
+     }
+@@ -707,7 +730,7 @@ static int do_open(struct iovec *iovec)
+     if (ret < 0) {
+         goto err_out;
+     }
+-    ret = open(path.data, flags);
++    ret = open_regular(path.data, flags, 0);
+     if (ret < 0) {
+         ret = -errno;
+     }
+diff --git a/hw/9pfs/9p-util.h b/hw/9pfs/9p-util.h
+index c314cf381d4..df1b583a5e4 100644
+--- a/hw/9pfs/9p-util.h
++++ b/hw/9pfs/9p-util.h
+@@ -13,6 +13,8 @@
+ #ifndef QEMU_9P_UTIL_H
+ #define QEMU_9P_UTIL_H
+ 
++#include "qemu/error-report.h"
++
+ #ifdef O_PATH
+ #define O_PATH_9P_UTIL O_PATH
+ #else
+@@ -95,6 +97,7 @@ static inline int errno_to_dotl(int err) {
+ #endif
+ 
+ #define qemu_openat     openat
++#define qemu_fstat      fstat
+ #define qemu_fstatat    fstatat
+ #define qemu_mkdirat    mkdirat
+ #define qemu_renameat   renameat
+@@ -108,6 +111,38 @@ static inline void close_preserve_errno(int fd)
+     errno = serrno;
+ }
+ 
++/**
++ * close_if_special_file() - Close @fd if neither regular file nor directory.
++ *
++ * @fd: file descriptor of open file
++ * Return: 0 on regular file or directory, -1 otherwise
++ *
++ * CVE-2023-2861: Prohibit opening any special file directly on host
++ * (especially device files), as a compromised client could potentially gain
++ * access outside exported tree under certain, unsafe setups. We expect
++ * client to handle I/O on special files exclusively on guest side.
++ */
++static inline int close_if_special_file(int fd)
++{
++    struct stat stbuf;
++
++    if (qemu_fstat(fd, &stbuf) < 0) {
++        close_preserve_errno(fd);
++        return -1;
++    }
++    if (!S_ISREG(stbuf.st_mode) && !S_ISDIR(stbuf.st_mode)) {
++        error_report_once(
++            "9p: broken or compromised client detected; attempt to open "
++            "special file (i.e. neither regular file, nor directory)"
++        );
++        close(fd);
++        errno = ENXIO;
++        return -1;
++    }
++
++    return 0;
++}
++
+ static inline int openat_dir(int dirfd, const char *name)
+ {
+     return qemu_openat(dirfd, name,
+@@ -142,6 +177,10 @@ again:
+         return -1;
+     }
+ 
++    if (close_if_special_file(fd) < 0) {
++        return -1;
++    }
++
+     serrno = errno;
+     /* O_NONBLOCK was only needed to open the file. Let's drop it. We don't
+      * do that with O_PATH since fcntl(F_SETFL) isn't supported, and openat()
+-- 
+GitLab
diff --git a/srcpkgs/qemu/patches/fix-linux-user-ppc32.patch b/srcpkgs/qemu/patches/fix-linux-user-ppc32.patch
deleted file mode 100644
index cd47435d5aa9..000000000000
--- a/srcpkgs/qemu/patches/fix-linux-user-ppc32.patch
+++ /dev/null
@@ -1,117 +0,0 @@
-commit 37814f62c2cc7aba2eea073014d6c53dcd5bf42c
-Author: q66 <daniel@octaforge.org>
-Date:   Fri Jul 1 16:53:55 2022 +0200
-
-    fix linux-user build on 32-bit ppc
-    
-    Partial revert https://gitlab.com/qemu-project/qemu/-/commit/9d1401b79463e74adbfac69d836789d4e103fb61
-    and https://gitlab.com/qemu-project/qemu/-/commit/0a7e01904d407baa73c1baddbdfc9ccf2ace8356
-
-diff --git a/common-user/host/ppc/safe-syscall.inc.S b/common-user/host/ppc/safe-syscall.inc.S
-new file mode 100644
-index 0000000..e69de29
-diff --git a/common-user/safe-syscall-error.c b/common-user/safe-syscall-error.c
-index cf74b50..a36132c 100644
---- a/common-user/safe-syscall-error.c
-+++ b/common-user/safe-syscall-error.c
-@@ -12,6 +12,7 @@
- #include "qemu/osdep.h"
- #include "user/safe-syscall.h"
- 
-+#if !defined(__powerpc__) || defined(__powerpc64__)
- /*
-  * This is intended to be invoked via tail-call on the error path
-  * from the assembly in host/arch/safe-syscall.inc.S.  This takes
-@@ -23,3 +24,4 @@ long safe_syscall_set_errno_tail(int value)
-     errno = value;
-     return -1;
- }
-+#endif
-diff --git a/include/user/safe-syscall.h b/include/user/safe-syscall.h
-index 61a04e2..793fe84 100644
---- a/include/user/safe-syscall.h
-+++ b/include/user/safe-syscall.h
-@@ -125,6 +125,8 @@
-  * kinds of restartability.
-  */
- 
-+#if !defined(__powerpc__) || defined(__powerpc64__)
-+
- /* The core part of this function is implemented in assembly */
- extern long safe_syscall_base(int *pending, long number, ...);
- extern long safe_syscall_set_errno_tail(int value);
-@@ -137,4 +139,10 @@ extern char safe_syscall_end[];
-     safe_syscall_base(&((TaskState *)thread_cpu->opaque)->signal_pending, \
-                       __VA_ARGS__)
- 
-+#else
-+
-+#define safe_syscall syscall
-+
-+#endif
-+
- #endif
-diff --git a/linux-user/include/host/ppc/host-signal.h b/linux-user/include/host/ppc/host-signal.h
-new file mode 100644
-index 0000000..b80384d
---- /dev/null
-+++ b/linux-user/include/host/ppc/host-signal.h
-@@ -0,0 +1,38 @@
-+/*
-+ * host-signal.h: signal info dependent on the host architecture
-+ *
-+ * Copyright (c) 2003-2005 Fabrice Bellard
-+ * Copyright (c) 2021 Linaro Limited
-+ *
-+ * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
-+ * See the COPYING file in the top-level directory.
-+ */
-+
-+#ifndef PPC_HOST_SIGNAL_H
-+#define PPC_HOST_SIGNAL_H
-+
-+/* The third argument to a SA_SIGINFO handler is ucontext_t. */
-+typedef ucontext_t host_sigcontext;
-+
-+static inline uintptr_t host_signal_pc(host_sigcontext *uc)
-+{
-+    return uc->uc_mcontext.regs->nip;
-+}
-+
-+static inline void host_signal_set_pc(host_sigcontext *uc, uintptr_t pc)
-+{
-+    uc->uc_mcontext.regs->nip = pc;
-+}
-+
-+static inline void *host_signal_mask(host_sigcontext *uc)
-+{
-+    return &uc->uc_sigmask;
-+}
-+
-+static inline bool host_signal_write(siginfo_t *info, host_sigcontext *uc)
-+{
-+    return uc->uc_mcontext.regs->trap != 0x400
-+        && (uc->uc_mcontext.regs->dsisr & 0x02000000);
-+}
-+
-+#endif
-diff --git a/linux-user/signal.c b/linux-user/signal.c
-index 092e70b..b8dfa8a 100644
---- a/linux-user/signal.c
-+++ b/linux-user/signal.c
-@@ -800,6 +800,7 @@ void queue_signal(CPUArchState *env, int sig, int si_type,
- /* Adjust the signal context to rewind out of safe-syscall if we're in it */
- static inline void rewind_if_in_safe_syscall(void *puc)
- {
-+#if !defined(__powerpc__) || defined(__powerpc64__)
-     host_sigcontext *uc = (host_sigcontext *)puc;
-     uintptr_t pcreg = host_signal_pc(uc);
- 
-@@ -807,6 +808,7 @@ static inline void rewind_if_in_safe_syscall(void *puc)
-         && pcreg < (uintptr_t)safe_syscall_end) {
-         host_signal_set_pc(uc, (uintptr_t)safe_syscall_start);
-     }
-+#endif
- }
- 
- static void host_signal_handler(int host_sig, siginfo_t *info, void *puc)
diff --git a/srcpkgs/qemu/patches/fix-softfloat-fesetround.patch b/srcpkgs/qemu/patches/fix-softfloat-fesetround.patch
deleted file mode 100644
index ecdd049f7921..000000000000
--- a/srcpkgs/qemu/patches/fix-softfloat-fesetround.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-Source: @pullmoll
-Upstream: no
-Reason: Target architectures with soft float do not define these constants.
-
---- a/tests/fp/fp-bench.c	2020-12-08 17:59:44.000000000 +0100
-+++ b/tests/fp/fp-bench.c	2020-12-12 20:38:40.702235420 +0100
-@@ -485,16 +485,32 @@
- 
-     switch (rounding) {
-     case ROUND_EVEN:
-+#if defined(FE_TONEAREST)
-         rhost = FE_TONEAREST;
-+#else
-+	return;
-+#endif
-         break;
-     case ROUND_ZERO:
-+#if defined(FE_TOWARDZERO)
-         rhost = FE_TOWARDZERO;
-+#else
-+	return;
-+#endif
-         break;
-     case ROUND_DOWN:
-+#if defined(FE_DOWNWARD)
-         rhost = FE_DOWNWARD;
-+#else
-+	return;
-+#endif
-         break;
-     case ROUND_UP:
-+#if defined(FE_UPWARD)
-         rhost = FE_UPWARD;
-+#else
-+	return;
-+#endif
-         break;
-     case ROUND_TIEAWAY:
-         die_host_rounding(rounding);
diff --git a/srcpkgs/qemu/patches/gcc12.patch b/srcpkgs/qemu/patches/gcc12.patch
deleted file mode 100644
index 2a4b2bd03609..000000000000
--- a/srcpkgs/qemu/patches/gcc12.patch
+++ /dev/null
@@ -1,72 +0,0 @@
-From 5cb993ff131fca2abef3ce074a20258fd6fce557 Mon Sep 17 00:00:00 2001
-From: Bernhard Beschow <shentey@gmail.com>
-Date: Sat, 18 Mar 2023 19:59:31 +0100
-Subject: [PATCH] qemu/osdep: Switch position of "extern" and "G_NORETURN"
-
-Fixes the Windows build under msys2 using GCC 12 which fails with the following
-error:
-
-  [184/579] Compiling C++ object qga/vss-win32/qga-vss.dll.p/install.cpp.obj
-  FAILED: qga/vss-win32/qga-vss.dll.p/install.cpp.obj
-  "c++" "-m64" "-mcx16" "-Iqga/vss-win32/qga-vss.dll.p" "-Iqga/vss-win32" "-I../src/qga/vss-win32" "-I." "-Iqapi" "-Itrace" "-Iui" "-Iui/shader" "-IC:/msys64/mingw64/include/glib-2.0" "-IC:/msys64/mingw64/lib/glib-2.0/include" "-fdiagnostics-color=auto" "-Wall" "-Winvalid-pch" "-Wnon-virtual-dtor" "-Werror" "-std=gnu++11" "-g" "-iquote" "." "-iquote" "C:/msys64/home/shentey/Projects/qemu/src" "-iquote" "C:/msys64/home/shentey/Projects/qemu/src/include" "-iquote" "C:/msys64/home/shentey/Projects/qemu/src/tcg/i386" "-D__STDC_LIMIT_MACROS" "-D__STDC_CONSTANT_MACROS" "-D__STDC_FORMAT_MACROS" "-fno-pie" "-no-pie" "-D_GNU_SOURCE" "-D_FILE_OFFSET_BITS=64" "-D_LARGEFILE_SOURCE" "-fno-strict-aliasing" "-fno-common" "-fwrapv" "-Wundef" "-Wwrite-strings" "-Wtype-limits" "-Wformat-security" "-Wformat-y2k" "-Winit-self" "-Wignored-qualifiers" "-Wempty-body" "-Wendif-labels" "-Wexpansion-to-defined" "-Wimplicit-fallthrough=2" "-Wmissing-format-attribute" "-Wno-missing-include-dirs" "-Wno-shift-negative-value" "-Wno-psabi" "-fstack-protector-strong" "-Wno-unknown-pragmas" "-Wno-delete-non-virtual-dtor" "-Wno-non-virtual-dtor" -MD -MQ qga/vss-win32/qga-vss.dll.p/install.cpp.obj -MF "qga/vss-win32/qga-vss.dll.p/install.cpp.obj.d" -o qga/vss-win32/qga-vss.dll.p/install.cpp.obj "-c" ../src/qga/vss-win32/install.cpp
-  In file included from C:/msys64/mingw64/lib/glib-2.0/include/glibconfig.h:9,
-              from C:/msys64/mingw64/include/glib-2.0/glib/gtypes.h:34,
-              from C:/msys64/mingw64/include/glib-2.0/glib/galloca.h:34,
-              from C:/msys64/mingw64/include/glib-2.0/glib.h:32,
-              from C:/msys64/home/shentey/Projects/qemu/src/include/glib-compat.h:32,
-              from C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:144,
-              from ../src/qga/vss-win32/install.cpp:13:
-  C:/msys64/mingw64/include/glib-2.0/glib/gmacros.h:1075:21: error: standard attributes in middle of decl-specifiers
-  1075 | # define G_NORETURN [[noreturn]]
-        |                     ^
-  C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:240:8: note: in expansion of macro 'G_NORETURN'
-  240 | extern G_NORETURN
-        |        ^~~~~~~~~~
-  C:/msys64/mingw64/include/glib-2.0/glib/gmacros.h:1075:21: note: standard attributes must precede the decl-specifiers to apply to the declaration, or follow them to apply to the type
-  1075 | # define G_NORETURN [[noreturn]]
-        |                     ^
-  C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:240:8: note: in expansion of macro 'G_NORETURN'
-  240 | extern G_NORETURN
-        |        ^~~~~~~~~~
-  C:/msys64/mingw64/include/glib-2.0/glib/gmacros.h:1075:21: error: attribute ignored [-Werror=attributes]
-  1075 | # define G_NORETURN [[noreturn]]
-        |                     ^
-  C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:240:8: note: in expansion of macro 'G_NORETURN'
-  240 | extern G_NORETURN
-        |        ^~~~~~~~~~
-  C:/msys64/mingw64/include/glib-2.0/glib/gmacros.h:1075:21: note: an attribute that appertains to a type-specifier is ignored
-  1075 | # define G_NORETURN [[noreturn]]
-        |                     ^
-  C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:240:8: note: in expansion of macro 'G_NORETURN'
-  240 | extern G_NORETURN
-        |        ^~~~~~~~~~
-  cc1plus.exe: all warnings being treated as errors
-
-Apparently it also fixes the compilation with Clang 15 (see
-https://gitlab.com/qemu-project/qemu/-/issues/1541 ).
-
-Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1541
-Signed-off-by: Bernhard Beschow <shentey@gmail.com>
-Message-Id: <20230318185931.181659-1-shentey@gmail.com>
-Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
-Signed-off-by: Thomas Huth <thuth@redhat.com>
----
- include/qemu/osdep.h | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
-index f68b5d8708c..9eff0be95bd 100644
---- a/include/qemu/osdep.h
-+++ b/include/qemu/osdep.h
-@@ -237,7 +237,7 @@ extern "C" {
-  * supports QEMU_ERROR, this will be reported at compile time; otherwise
-  * this will be reported at link time due to the missing symbol.
-  */
--extern G_NORETURN
-+G_NORETURN extern
- void QEMU_ERROR("code path is reachable")
-     qemu_build_not_reached_always(void);
- #if defined(__OPTIMIZE__) && !defined(__NO_INLINE__)
--- 
-GitLab
-
diff --git a/srcpkgs/qemu/patches/keymap.patch b/srcpkgs/qemu/patches/keymap.patch
new file mode 100644
index 000000000000..fe54c3982051
--- /dev/null
+++ b/srcpkgs/qemu/patches/keymap.patch
@@ -0,0 +1,30 @@
+The xkb official name for the Arabic keyboard layout is 'ara'.
+However xkb has for at least the past 15 years also permitted it to
+be named via the legacy synonym 'ar'.  In xkeyboard-config 2.39 this
+synoynm was removed, which breaks compilation of QEMU:
+
+Make QEMU always ask for the 'ara' xkb layout, which should work on
+both older and newer xkeyboard-config.  We leave the QEMU name for
+this keyboard layout as 'ar'; it is not the only one where our name
+for it deviates from the xkb standard name.
+
+Cc: qemu-stable@nongnu.org
+Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
+Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1709
+---
+ pc-bios/keymaps/meson.build | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/pc-bios/keymaps/meson.build b/pc-bios/keymaps/meson.build
+index bff30833137..0bd8ce00775 100644
+--- a/pc-bios/keymaps/meson.build
++++ b/pc-bios/keymaps/meson.build
+@@ -1,5 +1,5 @@
+ keymaps = {
+-  'ar': '-l ar',
++  'ar': '-l ara',
+   'bepo': '-l fr -v dvorak',
+   'cz': '-l cz',
+   'da': '-l dk',
+-- 
+2.34.1
diff --git a/srcpkgs/qemu/patches/mmap-mremap-efault.patch b/srcpkgs/qemu/patches/mmap-mremap-efault.patch
deleted file mode 100644
index 5a70e9658b30..000000000000
--- a/srcpkgs/qemu/patches/mmap-mremap-efault.patch
+++ /dev/null
@@ -1,42 +0,0 @@
-Source: @pullmoll
-Upstream: no
-Reason: errno=EFAULT when the address passed to mremap(2) is not valid
-
-See Rich Felker's comment at https://www.openwall.com/lists/musl/2017/06/21/2 for
-why we need to return errno as described in man mremap(2) from qemu-user-static.
-Also speed up the loop when checking for increasing the mappings size to go
-in steps of TARGET_PAGE_SIZE and OR-in a check for the very last byte of the range.
-diff --git linux-user/mmap.c linux-user/mmap.c
-index 7e3b245..1e8d0f1 100644
---- a/linux-user/mmap.c
-+++ b/linux-user/mmap.c
-@@ -738,7 +738,7 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size,
-          !guest_range_valid_untagged(new_addr, new_size)) ||
-         ((flags & MREMAP_MAYMOVE) == 0 &&
-          !guest_range_valid_untagged(old_addr, new_size))) {
--        errno = ENOMEM;
-+        errno = EFAULT;
-         return -1;
-     }
- 
-@@ -775,9 +775,10 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size,
-             abi_ulong addr;
-             for (addr = old_addr + old_size;
-                  addr < old_addr + new_size;
--                 addr++) {
-+                 addr += TARGET_PAGE_SIZE) {
-                 prot |= page_get_flags(addr);
-             }
-+				prot |= page_get_flags(old_addr + new_size - 1);
-         }
-         if (prot == 0) {
-             host_addr = mremap(g2h_untagged(old_addr),
-@@ -796,7 +797,7 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size,
-                 }
-             }
-         } else {
--            errno = ENOMEM;
-+            errno = EFAULT;
-             host_addr = MAP_FAILED;
-         }
-     }
diff --git a/srcpkgs/qemu/patches/musl-initialize-msghdr.patch b/srcpkgs/qemu/patches/musl-initialize-msghdr.patch
index 6d96b3511daf..a88547354c1e 100644
--- a/srcpkgs/qemu/patches/musl-initialize-msghdr.patch
+++ b/srcpkgs/qemu/patches/musl-initialize-msghdr.patch
@@ -1,10 +1,10 @@
 Source: https://github.com/void-linux/void-packages/issues/23557
 
-diff --git linux-user/syscall.c linux-user/syscall.c
-index 945fc25..8d8b68a 100644
+diff --git a/linux-user/syscall.c b/linux-user/syscall.c
+index 14fdebd..de280af 100644
 --- a/linux-user/syscall.c
 +++ b/linux-user/syscall.c
-@@ -3071,7 +3071,7 @@ static abi_long do_sendrecvmsg_locked(int fd, struct target_msghdr *msgp,
+@@ -3229,7 +3229,7 @@ static abi_long do_sendrecvmsg_locked(int fd, struct target_msghdr *msgp,
                                        int flags, int send)
  {
      abi_long ret, len;
diff --git a/srcpkgs/qemu/patches/musl-ppc.patch b/srcpkgs/qemu/patches/musl-ppc.patch
deleted file mode 100644
index 0b77aa8fc63d..000000000000
--- a/srcpkgs/qemu/patches/musl-ppc.patch
+++ /dev/null
@@ -1,25 +0,0 @@
---- a/linux-user/signal.c
-+++ b/linux-user/signal.c
-@@ -21,5 +21,9 @@
- #include "exec/gdbstub.h"
- #include "hw/core/tcg-cpu-ops.h"
- 
-+#if defined(_ARCH_PPC64) && !defined(__GLIBC__) /* musl */
-+#include <asm/ptrace.h>
-+#endif
-+
- #include <sys/ucontext.h>
- #include <sys/resource.h>
---- a/util/mmap-alloc.c
-+++ b/util/mmap-alloc.c
-@@ -25,6 +25,10 @@
- 
- #ifdef CONFIG_LINUX
- #include <sys/vfs.h>
-+/* musl undefs this on ppc and mips */
-+#ifndef MAP_SYNC
-+#define MAP_SYNC 0x80000
-+#endif
- #endif
- 
- size_t qemu_fd_getpagesize(int fd)
diff --git a/srcpkgs/qemu/patches/musl-rlimit-rttime.patch b/srcpkgs/qemu/patches/musl-rlimit-rttime.patch
deleted file mode 100644
index 0cbf9be36a8f..000000000000
--- a/srcpkgs/qemu/patches/musl-rlimit-rttime.patch
+++ /dev/null
@@ -1,13 +0,0 @@
---- a/linux-user/syscall.c
-+++ b/linux-user/syscall.c
-@@ -141,6 +141,10 @@
- #include "fd-trans.h"
- #include "tcg/tcg.h"
- 
-+#ifndef RLIMIT_RTTIME
-+#define RLIMIT_RTTIME 15
-+#endif
-+
- #ifndef CLONE_IO
- #define CLONE_IO                0x80000000      /* Clone io context */
- #endif
diff --git a/srcpkgs/qemu/patches/xxx-ppcle.patch b/srcpkgs/qemu/patches/xxx-ppcle.patch
deleted file mode 100644
index 90b32b5e07cd..000000000000
--- a/srcpkgs/qemu/patches/xxx-ppcle.patch
+++ /dev/null
@@ -1,113 +0,0 @@
-From 7ece08d7902d5a8c007deeb0b75cb533a41dd882 Mon Sep 17 00:00:00 2001
-From: Daniel Kolesa <daniel@octaforge.org>
-Date: Sun, 7 Mar 2021 01:47:42 +0100
-Subject: [PATCH] support ppcle architecture
-
----
- configure                            | 14 ++++++++++++--
- configs/targets/ppcle-linux-user.mak |  4 ++++
- linux-user/ppc/target_syscall.h      |  4 ++++
- scripts/qemu-binfmt-conf.sh          |  6 +++++-
- tests/tcg/configure.sh               |  2 ++
- 5 files changed, 27 insertions(+), 3 deletions(-)
- create mode 100644 configs/targets/ppcle-linux-user.mak
-
-diff --git a/configure b/configure
-index 18c26e0..03d3e18 100755
---- a/configure
-+++ b/configure
-@@ -653,7 +653,11 @@ elif check_define _ARCH_PPC ; then
-       cpu="ppc64"
-     fi
-   else
--    cpu="ppc"
-+    if check_define _LITTLE_ENDIAN ; then
-+      cpu="ppcle"
-+    else
-+      cpu="ppc"
-+    fi
-   fi
- elif check_define __mips__ ; then
-   cpu="mips"
-@@ -638,6 +642,9 @@
- 
-   ppc)
-     CPU_CFLAGS="-m32" ;;
-+  ppcle)
-+    cpu="ppc"
-+    CPU_CFLAGS="-m32 -mlittle-endian" ;;
-   ppc64)
-     CPU_CFLAGS="-m64 -mbig-endian" ;;
-   ppc64le)
-diff --git a/configs/targets/ppcle-linux-user.mak b/configs/targets/ppcle-linux-user.mak
-new file mode 100644
-index 0000000..2259243
---- /dev/null
-+++ b/configs/targets/ppcle-linux-user.mak
-@@ -0,0 +1,4 @@
-+TARGET_ARCH=ppc
-+TARGET_SYSTBL_ABI=common,nospu,32
-+TARGET_SYSTBL=syscall.tbl
-+TARGET_XML_FILES= gdb-xml/power-core.xml gdb-xml/power-fpu.xml gdb-xml/power-altivec.xml gdb-xml/power-spe.xml
-diff --git a/linux-user/ppc/target_syscall.h b/linux-user/ppc/target_syscall.h
-index b9c4b81..cf26497 100644
---- a/linux-user/ppc/target_syscall.h
-+++ b/linux-user/ppc/target_syscall.h
-@@ -65,7 +65,11 @@ struct target_revectored_struct {
- #define UNAME_MACHINE "ppc64le"
- #endif
- #else
-+#if TARGET_BIG_ENDIAN
- #define UNAME_MACHINE "ppc"
-+#else
-+#define UNAME_MACHINE "ppcle"
-+#endif
- #endif
- #define UNAME_MINIMUM_RELEASE "2.6.32"
- 
-diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh
-index 9f1580a..393943f 100755
---- a/scripts/qemu-binfmt-conf.sh
-+++ b/scripts/qemu-binfmt-conf.sh
-@@ -46,6 +46,10 @@ ppc_magic='\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x
- ppc_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
- ppc_family=ppc
- 
-+ppcle_magic='\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x14\x00'
-+ppcle_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\x00'
-+ppc_family=ppcle
-+
- ppc64_magic='\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x15'
- ppc64_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
- ppc64_family=ppc
-@@ -148,7 +152,7 @@ qemu_get_family() {
-     "Power Macintosh"|ppc64|powerpc|ppc)
-         echo "ppc"
-         ;;
--    ppc64el|ppc64le)
-+    ppc64el|ppc64le|ppcel|ppcle)
-         echo "ppcle"
-         ;;
-     arm|armel|armhf|arm64|armv[4-9]*l|aarch64)
-diff --git a/configure b/configure
-index 72ab03f11a..0691929d76 100755
---- a/configure
-+++ b/configure
-@@ -1866,6 +1866,7 @@ fi
- : ${cross_prefix_mips="mips-linux-gnu-"}
- : ${cross_prefix_nios2="nios2-linux-gnu-"}
- : ${cross_prefix_ppc="powerpc-linux-gnu-"}
-+: ${cross_prefix_ppcle="powerpcle-linux-gnu-"}
- : ${cross_prefix_ppc64="powerpc64-linux-gnu-"}
- : ${cross_prefix_ppc64le="$cross_prefix_ppc64"}
- : ${cross_prefix_riscv64="riscv64-linux-gnu-"}
-@@ -1883,6 +1884,7 @@ fi
- : ${cross_cc_cflags_hexagon="-mv67 -O2 -static"}
- : ${cross_cc_cflags_i386="-m32"}
- : ${cross_cc_cflags_ppc="-m32 -mbig-endian"}
-+: ${cross_cc_cflags_ppcle="-m32"}
- : ${cross_cc_cflags_ppc64="-m64 -mbig-endian"}
- : ${cross_cc_ppc64le="$cross_cc_ppc64"}
- : ${cross_cc_cflags_ppc64le="-m64 -mlittle-endian"}
-2.30.1
-
diff --git a/srcpkgs/qemu/template b/srcpkgs/qemu/template
index 48ab199e5686..178a3f08f24d 100644
--- a/srcpkgs/qemu/template
+++ b/srcpkgs/qemu/template
@@ -1,8 +1,8 @@
 # Template file for 'qemu'
 # This package should be updated together with qemu-user-static
 pkgname=qemu
-version=7.1.0
-revision=2
+version=8.0.2
+revision=1
 build_style=configure
 configure_args="--prefix=/usr --sysconfdir=/etc --libexecdir=/usr/libexec --localstatedir=/var
  --disable-glusterfs --disable-xen --enable-docs --enable-kvm --enable-libusb --enable-pie
@@ -10,10 +10,10 @@ configure_args="--prefix=/usr --sysconfdir=/etc --libexecdir=/usr/libexec --loca
  --audio-drv-list=alsa$(vopt_if sdl2 ,sdl)$(vopt_if jack ,jack)$(vopt_if pulseaudio ,pa)
  $(vopt_enable opengl) $(vopt_enable pulseaudio pa) $(vopt_enable sdl2 sdl) $(vopt_enable smartcard)
  $(vopt_enable spice) $(vopt_enable virgl virglrenderer) $(vopt_if gtk3 '--enable-gtk')"
-hostmakedepends="gettext pkg-config perl python3 python3-Sphinx python3-sphinx_rtd_theme ninja"
+hostmakedepends="flex gettext glib-devel pkg-config perl python3 python3-Sphinx python3-sphinx_rtd_theme ninja"
 makedepends="capstone-devel dtc-devel libpng-devel libjpeg-turbo-devel pixman-devel
- snappy-devel libuuid-devel libX11-devel alsa-lib-devel libaio-devel gnutls-devel
- libsasl-devel libglib-devel ncurses-devel libseccomp-devel nss-devel
+ snappy-devel libuuid-devel libX11-devel alsa-lib-devel libaio-devel
+ gnutls-devel libsasl-devel ncurses-devel libseccomp-devel nss-devel
  libcurl-devel xfsprogs-devel libcap-ng-devel vde2-devel usbredir-devel
  libbluetooth-devel libssh2-devel libusb-devel libnfs-devel libslirp-devel
  libxkbcommon-devel libzstd-devel $(vopt_if sdl2 'SDL2-devel SDL2_image-devel')
@@ -25,17 +25,17 @@ makedepends="capstone-devel dtc-devel libpng-devel libjpeg-turbo-devel pixman-de
  $(vopt_if jack 'jack-devel') $(vopt_if pulseaudio 'pulseaudio-devel')"
 short_desc="Open Source Processor Emulator"
 maintainer="Orphaned <orphan@voidlinux.org>"
-license="GPL-2.0-or-later, LGPL-2.1-or-later"
+license="GPL-2.0-only, LGPL-2.1-only"
 homepage="https://www.qemu.org"
 distfiles="https://wiki.qemu.org/download/qemu-${version}.tar.bz2"
-checksum=f7ac2b85b3f1831e6810b140306e30af91556e15784864b209f3942858947fd0
+checksum=b59281923d60d358a7d7d3bde46ba43c0810d34d26608fcdaf6bf4c42492b694
 ignore_elf_dirs="/usr/share/qemu"
 nostrip_files="hppa-firmware.img openbios-ppc openbios-sparc32 openbios-sparc64
  palcode-clipper s390-ccw.img s390-netboot.img u-boot.e500 opensbi-riscv32-generic-fw_dynamic.elf
  opensbi-riscv64-generic-fw_dynamic.elf"
 
-build_options="gtk3 opengl sdl2 spice virgl smartcard numa iscsi jack pulseaudio"
-build_options_default="opengl gtk3 virgl sdl2 numa iscsi jack pulseaudio"
+build_options="gtk3 iscsi jack numa opengl pulseaudio sdl2 smartcard spice virgl"
+build_options_default="gtk3 iscsi jack numa opengl pulseaudio sdl2 smartcard spice virgl"
 desc_option_sdl2="Enable SDL (2.x) video output"
 desc_option_spice="Enable support for SPICE"
 desc_option_virgl="Enable support for VirGL (A Virtual 3D GPU renderer)"
@@ -43,37 +43,10 @@ desc_option_smartcard="Enable smartcard support"
 desc_option_numa="Enable support for host NUMA"
 desc_option_iscsi="Enable support for iSCSI"
 
-case "$XBPS_TARGET_MACHINE" in
-	aarch64-musl) CFLAGS="-D_LINUX_SYSINFO_H";;
-esac
-
-if [ "$XBPS_TARGET_ENDIAN" = "le" ]; then
-	build_options_default+=" spice"
-fi
-
 if [ "$CROSS_BUILD" ]; then
-	configure_args+=" --cross-prefix=${XBPS_CROSS_TRIPLET}-"
-else
-	build_options_default+=" smartcard"
-fi
-
-if [ "$XBPS_CHECK_PKGS" != full ]; then
-	make_check_target=check-unit
+	configure_args+=" --cross-prefix=${XBPS_CROSS_TRIPLET}"
 fi
 
-post_extract() {
-	if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
-		grep -rl 'Input/output error' tests/qemu-iotests |
-			xargs -n1 sed -i -e 's;Input/output error;I/O error;g'
-		grep -rl 'Operation not supported' tests/qemu-iotests |
-			xargs -n1 sed -i -e 's;Operation not supported;Not supported;g'
-	fi
-}
-
-pre_configure() {
-	unset CPP
-}
-
 post_install() {
 	vdoc "${FILESDIR}/README.voidlinux"
 

From 2a2467725a46e54494f94646039d387bc042012a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Cerqueira?= <acerqueira021@gmail.com>
Date: Mon, 3 Jul 2023 18:41:30 +0100
Subject: [PATCH 2/2] qemu-user-static: update to 8.0.2.

---
 srcpkgs/qemu-user-static/template | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/srcpkgs/qemu-user-static/template b/srcpkgs/qemu-user-static/template
index 2a8da9b53f2d..509688be23f3 100644
--- a/srcpkgs/qemu-user-static/template
+++ b/srcpkgs/qemu-user-static/template
@@ -1,20 +1,20 @@
 # Template file for 'qemu-user-static'
 # This package should be updated together with qemu
 pkgname=qemu-user-static
-version=7.1.0
-revision=3
+version=8.0.2
+revision=1
 build_style=configure
 configure_args="--prefix=/usr --sysconfdir=/etc --libexecdir=/usr/libexec
  --disable-kvm --disable-png --disable-virtfs --disable-fdt --disable-seccomp
  --enable-linux-user --disable-system --static --disable-pie"
-hostmakedepends="pkg-config perl python3 ninja"
+hostmakedepends="flex glib-devel pkg-config perl python3 ninja"
 makedepends="dtc-devel libglib-devel pixman-devel libuuid-devel"
 short_desc="QEMU User-mode emulators (statically compiled)"
 maintainer="Orphaned <orphan@voidlinux.org>"
-license="GPL-2.0-or-later, LGPL-2.1-or-later"
+license="GPL-2.0-only, LGPL-2.1-only"
 homepage="https://www.qemu.org"
 distfiles="https://wiki.qemu.org/download/qemu-${version}.tar.bz2"
-checksum=f7ac2b85b3f1831e6810b140306e30af91556e15784864b209f3942858947fd0
+checksum=b59281923d60d358a7d7d3bde46ba43c0810d34d26608fcdaf6bf4c42492b694
 
 _fmts="aarch64 aarch64_be alpha arm armeb cris hppa i386 m68k microblaze
  microblazeel mips mipsel mips64 mips64el mipsn32 mipsn32el or1k
@@ -111,10 +111,6 @@ done
 
 binfmts="${binfmts%?}"
 
-pre_configure() {
-	unset CPP
-}
-
 post_install() {
 	# Remove unneeded stuff.
 	rm -rf ${DESTDIR}/etc ${DESTDIR}/usr/share ${DESTDIR}/usr/libexec

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [PR PATCH] [Updated] qemu: update to 8.0.2.
  2023-07-03 17:50 [PR PATCH] qemu: update to 8.0.2 motorto
                   ` (3 preceding siblings ...)
  2023-07-04 13:32 ` motorto
@ 2023-07-10 14:43 ` motorto
  2023-07-12 10:30 ` JamiKettunen
                   ` (33 subsequent siblings)
  38 siblings, 0 replies; 40+ messages in thread
From: motorto @ 2023-07-10 14:43 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1357 bytes --]

There is an updated pull request by motorto against master on the void-packages repository

https://github.com/motorto/void-packages qemu-8.0.2
https://github.com/void-linux/void-packages/pull/44822

qemu: update to 8.0.2.
<!-- Uncomment relevant sections and delete options which are not applicable -->
[ci-skip] 
#### Testing the changes
- I tested the changes in this PR: **YES**, runned a Windows vm machine and it worked fine.

Removed a bunch of patches that in my research are no longer needed:

- Removed all ppc related patches since that arch isn't no longer supported.
- gcc12.patch: because it builds fine now in this version
- fix-softfloat-fesetround.patch: don't have a system to try it, but alpine doesn't have any patch related to this)
- mmap-mremap-efaul: not sure about if we should keep this one

Kept this patches:

- musl-initialize-msghdr.patch: just update in order to apply.

Added this ones:

- CVE-2023-2861.patch:
- keymap.patch: xkeyboard-config 2.39 removed the legacy alias of ar -> ara

#### Local build testing
- I built this PR locally for my native architecture, x86-64-glibc
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl (cross)
  - x86_64-musl



A patch file from https://github.com/void-linux/void-packages/pull/44822.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-qemu-8.0.2-44822.patch --]
[-- Type: text/x-diff, Size: 33205 bytes --]

From eaf045e4ed7af8525f6da66e84a33b2049aa0076 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Cerqueira?= <acerqueira021@gmail.com>
Date: Mon, 3 Jul 2023 18:41:12 +0100
Subject: [PATCH 1/2] qemu: update to 8.0.2.

---
 srcpkgs/qemu/patches/CVE-2023-2861.patch      | 177 ++++++++++++++++++
 .../qemu/patches/fix-linux-user-ppc32.patch   | 117 ------------
 .../patches/fix-softfloat-fesetround.patch    |  39 ----
 srcpkgs/qemu/patches/gcc12.patch              |  72 -------
 srcpkgs/qemu/patches/keymap.patch             |  30 +++
 srcpkgs/qemu/patches/mmap-mremap-efault.patch |  42 -----
 .../qemu/patches/musl-initialize-msghdr.patch |   6 +-
 srcpkgs/qemu/patches/musl-ppc.patch           |  25 ---
 srcpkgs/qemu/patches/musl-rlimit-rttime.patch |  13 --
 srcpkgs/qemu/patches/xxx-ppcle.patch          | 113 -----------
 srcpkgs/qemu/template                         |  47 +----
 11 files changed, 220 insertions(+), 461 deletions(-)
 create mode 100644 srcpkgs/qemu/patches/CVE-2023-2861.patch
 delete mode 100644 srcpkgs/qemu/patches/fix-linux-user-ppc32.patch
 delete mode 100644 srcpkgs/qemu/patches/fix-softfloat-fesetround.patch
 delete mode 100644 srcpkgs/qemu/patches/gcc12.patch
 create mode 100644 srcpkgs/qemu/patches/keymap.patch
 delete mode 100644 srcpkgs/qemu/patches/mmap-mremap-efault.patch
 delete mode 100644 srcpkgs/qemu/patches/musl-ppc.patch
 delete mode 100644 srcpkgs/qemu/patches/musl-rlimit-rttime.patch
 delete mode 100644 srcpkgs/qemu/patches/xxx-ppcle.patch

diff --git a/srcpkgs/qemu/patches/CVE-2023-2861.patch b/srcpkgs/qemu/patches/CVE-2023-2861.patch
new file mode 100644
index 000000000000..dca869f1d77f
--- /dev/null
+++ b/srcpkgs/qemu/patches/CVE-2023-2861.patch
@@ -0,0 +1,177 @@
+Patch-Source: https://gitlab.com/qemu-project/qemu/-/commit/b9d2887be4e616cdaeedd0b7456bfaa71ee798af
+--
+From b9d2887be4e616cdaeedd0b7456bfaa71ee798af Mon Sep 17 00:00:00 2001
+From: Christian Schoenebeck <qemu_oss@crudebyte.com>
+Date: Wed, 7 Jun 2023 18:29:33 +0200
+Subject: [PATCH] 9pfs: prevent opening special files (CVE-2023-2861)
+
+The 9p protocol does not specifically define how server shall behave when
+client tries to open a special file, however from security POV it does
+make sense for 9p server to prohibit opening any special file on host side
+in general. A sane Linux 9p client for instance would never attempt to
+open a special file on host side, it would always handle those exclusively
+on its guest side. A malicious client however could potentially escape
+from the exported 9p tree by creating and opening a device file on host
+side.
+
+With QEMU this could only be exploited in the following unsafe setups:
+
+  - Running QEMU binary as root AND 9p 'local' fs driver AND 'passthrough'
+    security model.
+
+or
+
+  - Using 9p 'proxy' fs driver (which is running its helper daemon as
+    root).
+
+These setups were already discouraged for safety reasons before,
+however for obvious reasons we are now tightening behaviour on this.
+
+Fixes: CVE-2023-2861
+Reported-by: Yanwu Shen <ywsPlz@gmail.com>
+Reported-by: Jietao Xiao <shawtao1125@gmail.com>
+Reported-by: Jinku Li <jkli@xidian.edu.cn>
+Reported-by: Wenbo Shen <shenwenbo@zju.edu.cn>
+Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
+Reviewed-by: Greg Kurz <groug@kaod.org>
+Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
+Message-Id: <E1q6w7r-0000Q0-NM@lizzy.crudebyte.com>
+(cherry picked from commit f6b0de53fb87ddefed348a39284c8e2f28dc4eda)
+Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
+---
+ fsdev/virtfs-proxy-helper.c | 27 +++++++++++++++++++++++--
+ hw/9pfs/9p-util.h           | 39 +++++++++++++++++++++++++++++++++++++
+ 2 files changed, 64 insertions(+), 2 deletions(-)
+
+diff --git a/fsdev/virtfs-proxy-helper.c b/fsdev/virtfs-proxy-helper.c
+index 5cafcd77031..d9511f429c9 100644
+--- a/fsdev/virtfs-proxy-helper.c
++++ b/fsdev/virtfs-proxy-helper.c
+@@ -26,6 +26,7 @@
+ #include "qemu/xattr.h"
+ #include "9p-iov-marshal.h"
+ #include "hw/9pfs/9p-proxy.h"
++#include "hw/9pfs/9p-util.h"
+ #include "fsdev/9p-iov-marshal.h"
+ 
+ #define PROGNAME "virtfs-proxy-helper"
+@@ -338,6 +339,28 @@ static void resetugid(int suid, int sgid)
+     }
+ }
+ 
++/*
++ * Open regular file or directory. Attempts to open any special file are
++ * rejected.
++ *
++ * returns file descriptor or -1 on error
++ */
++static int open_regular(const char *pathname, int flags, mode_t mode)
++{
++    int fd;
++
++    fd = open(pathname, flags, mode);
++    if (fd < 0) {
++        return fd;
++    }
++
++    if (close_if_special_file(fd) < 0) {
++        return -1;
++    }
++
++    return fd;
++}
++
+ /*
+  * send response in two parts
+  * 1) ProxyHeader
+@@ -682,7 +705,7 @@ static int do_create(struct iovec *iovec)
+     if (ret < 0) {
+         goto unmarshal_err_out;
+     }
+-    ret = open(path.data, flags, mode);
++    ret = open_regular(path.data, flags, mode);
+     if (ret < 0) {
+         ret = -errno;
+     }
+@@ -707,7 +730,7 @@ static int do_open(struct iovec *iovec)
+     if (ret < 0) {
+         goto err_out;
+     }
+-    ret = open(path.data, flags);
++    ret = open_regular(path.data, flags, 0);
+     if (ret < 0) {
+         ret = -errno;
+     }
+diff --git a/hw/9pfs/9p-util.h b/hw/9pfs/9p-util.h
+index c314cf381d4..df1b583a5e4 100644
+--- a/hw/9pfs/9p-util.h
++++ b/hw/9pfs/9p-util.h
+@@ -13,6 +13,8 @@
+ #ifndef QEMU_9P_UTIL_H
+ #define QEMU_9P_UTIL_H
+ 
++#include "qemu/error-report.h"
++
+ #ifdef O_PATH
+ #define O_PATH_9P_UTIL O_PATH
+ #else
+@@ -95,6 +97,7 @@ static inline int errno_to_dotl(int err) {
+ #endif
+ 
+ #define qemu_openat     openat
++#define qemu_fstat      fstat
+ #define qemu_fstatat    fstatat
+ #define qemu_mkdirat    mkdirat
+ #define qemu_renameat   renameat
+@@ -108,6 +111,38 @@ static inline void close_preserve_errno(int fd)
+     errno = serrno;
+ }
+ 
++/**
++ * close_if_special_file() - Close @fd if neither regular file nor directory.
++ *
++ * @fd: file descriptor of open file
++ * Return: 0 on regular file or directory, -1 otherwise
++ *
++ * CVE-2023-2861: Prohibit opening any special file directly on host
++ * (especially device files), as a compromised client could potentially gain
++ * access outside exported tree under certain, unsafe setups. We expect
++ * client to handle I/O on special files exclusively on guest side.
++ */
++static inline int close_if_special_file(int fd)
++{
++    struct stat stbuf;
++
++    if (qemu_fstat(fd, &stbuf) < 0) {
++        close_preserve_errno(fd);
++        return -1;
++    }
++    if (!S_ISREG(stbuf.st_mode) && !S_ISDIR(stbuf.st_mode)) {
++        error_report_once(
++            "9p: broken or compromised client detected; attempt to open "
++            "special file (i.e. neither regular file, nor directory)"
++        );
++        close(fd);
++        errno = ENXIO;
++        return -1;
++    }
++
++    return 0;
++}
++
+ static inline int openat_dir(int dirfd, const char *name)
+ {
+     return qemu_openat(dirfd, name,
+@@ -142,6 +177,10 @@ again:
+         return -1;
+     }
+ 
++    if (close_if_special_file(fd) < 0) {
++        return -1;
++    }
++
+     serrno = errno;
+     /* O_NONBLOCK was only needed to open the file. Let's drop it. We don't
+      * do that with O_PATH since fcntl(F_SETFL) isn't supported, and openat()
+-- 
+GitLab
diff --git a/srcpkgs/qemu/patches/fix-linux-user-ppc32.patch b/srcpkgs/qemu/patches/fix-linux-user-ppc32.patch
deleted file mode 100644
index cd47435d5aa9..000000000000
--- a/srcpkgs/qemu/patches/fix-linux-user-ppc32.patch
+++ /dev/null
@@ -1,117 +0,0 @@
-commit 37814f62c2cc7aba2eea073014d6c53dcd5bf42c
-Author: q66 <daniel@octaforge.org>
-Date:   Fri Jul 1 16:53:55 2022 +0200
-
-    fix linux-user build on 32-bit ppc
-    
-    Partial revert https://gitlab.com/qemu-project/qemu/-/commit/9d1401b79463e74adbfac69d836789d4e103fb61
-    and https://gitlab.com/qemu-project/qemu/-/commit/0a7e01904d407baa73c1baddbdfc9ccf2ace8356
-
-diff --git a/common-user/host/ppc/safe-syscall.inc.S b/common-user/host/ppc/safe-syscall.inc.S
-new file mode 100644
-index 0000000..e69de29
-diff --git a/common-user/safe-syscall-error.c b/common-user/safe-syscall-error.c
-index cf74b50..a36132c 100644
---- a/common-user/safe-syscall-error.c
-+++ b/common-user/safe-syscall-error.c
-@@ -12,6 +12,7 @@
- #include "qemu/osdep.h"
- #include "user/safe-syscall.h"
- 
-+#if !defined(__powerpc__) || defined(__powerpc64__)
- /*
-  * This is intended to be invoked via tail-call on the error path
-  * from the assembly in host/arch/safe-syscall.inc.S.  This takes
-@@ -23,3 +24,4 @@ long safe_syscall_set_errno_tail(int value)
-     errno = value;
-     return -1;
- }
-+#endif
-diff --git a/include/user/safe-syscall.h b/include/user/safe-syscall.h
-index 61a04e2..793fe84 100644
---- a/include/user/safe-syscall.h
-+++ b/include/user/safe-syscall.h
-@@ -125,6 +125,8 @@
-  * kinds of restartability.
-  */
- 
-+#if !defined(__powerpc__) || defined(__powerpc64__)
-+
- /* The core part of this function is implemented in assembly */
- extern long safe_syscall_base(int *pending, long number, ...);
- extern long safe_syscall_set_errno_tail(int value);
-@@ -137,4 +139,10 @@ extern char safe_syscall_end[];
-     safe_syscall_base(&((TaskState *)thread_cpu->opaque)->signal_pending, \
-                       __VA_ARGS__)
- 
-+#else
-+
-+#define safe_syscall syscall
-+
-+#endif
-+
- #endif
-diff --git a/linux-user/include/host/ppc/host-signal.h b/linux-user/include/host/ppc/host-signal.h
-new file mode 100644
-index 0000000..b80384d
---- /dev/null
-+++ b/linux-user/include/host/ppc/host-signal.h
-@@ -0,0 +1,38 @@
-+/*
-+ * host-signal.h: signal info dependent on the host architecture
-+ *
-+ * Copyright (c) 2003-2005 Fabrice Bellard
-+ * Copyright (c) 2021 Linaro Limited
-+ *
-+ * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
-+ * See the COPYING file in the top-level directory.
-+ */
-+
-+#ifndef PPC_HOST_SIGNAL_H
-+#define PPC_HOST_SIGNAL_H
-+
-+/* The third argument to a SA_SIGINFO handler is ucontext_t. */
-+typedef ucontext_t host_sigcontext;
-+
-+static inline uintptr_t host_signal_pc(host_sigcontext *uc)
-+{
-+    return uc->uc_mcontext.regs->nip;
-+}
-+
-+static inline void host_signal_set_pc(host_sigcontext *uc, uintptr_t pc)
-+{
-+    uc->uc_mcontext.regs->nip = pc;
-+}
-+
-+static inline void *host_signal_mask(host_sigcontext *uc)
-+{
-+    return &uc->uc_sigmask;
-+}
-+
-+static inline bool host_signal_write(siginfo_t *info, host_sigcontext *uc)
-+{
-+    return uc->uc_mcontext.regs->trap != 0x400
-+        && (uc->uc_mcontext.regs->dsisr & 0x02000000);
-+}
-+
-+#endif
-diff --git a/linux-user/signal.c b/linux-user/signal.c
-index 092e70b..b8dfa8a 100644
---- a/linux-user/signal.c
-+++ b/linux-user/signal.c
-@@ -800,6 +800,7 @@ void queue_signal(CPUArchState *env, int sig, int si_type,
- /* Adjust the signal context to rewind out of safe-syscall if we're in it */
- static inline void rewind_if_in_safe_syscall(void *puc)
- {
-+#if !defined(__powerpc__) || defined(__powerpc64__)
-     host_sigcontext *uc = (host_sigcontext *)puc;
-     uintptr_t pcreg = host_signal_pc(uc);
- 
-@@ -807,6 +808,7 @@ static inline void rewind_if_in_safe_syscall(void *puc)
-         && pcreg < (uintptr_t)safe_syscall_end) {
-         host_signal_set_pc(uc, (uintptr_t)safe_syscall_start);
-     }
-+#endif
- }
- 
- static void host_signal_handler(int host_sig, siginfo_t *info, void *puc)
diff --git a/srcpkgs/qemu/patches/fix-softfloat-fesetround.patch b/srcpkgs/qemu/patches/fix-softfloat-fesetround.patch
deleted file mode 100644
index ecdd049f7921..000000000000
--- a/srcpkgs/qemu/patches/fix-softfloat-fesetround.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-Source: @pullmoll
-Upstream: no
-Reason: Target architectures with soft float do not define these constants.
-
---- a/tests/fp/fp-bench.c	2020-12-08 17:59:44.000000000 +0100
-+++ b/tests/fp/fp-bench.c	2020-12-12 20:38:40.702235420 +0100
-@@ -485,16 +485,32 @@
- 
-     switch (rounding) {
-     case ROUND_EVEN:
-+#if defined(FE_TONEAREST)
-         rhost = FE_TONEAREST;
-+#else
-+	return;
-+#endif
-         break;
-     case ROUND_ZERO:
-+#if defined(FE_TOWARDZERO)
-         rhost = FE_TOWARDZERO;
-+#else
-+	return;
-+#endif
-         break;
-     case ROUND_DOWN:
-+#if defined(FE_DOWNWARD)
-         rhost = FE_DOWNWARD;
-+#else
-+	return;
-+#endif
-         break;
-     case ROUND_UP:
-+#if defined(FE_UPWARD)
-         rhost = FE_UPWARD;
-+#else
-+	return;
-+#endif
-         break;
-     case ROUND_TIEAWAY:
-         die_host_rounding(rounding);
diff --git a/srcpkgs/qemu/patches/gcc12.patch b/srcpkgs/qemu/patches/gcc12.patch
deleted file mode 100644
index 2a4b2bd03609..000000000000
--- a/srcpkgs/qemu/patches/gcc12.patch
+++ /dev/null
@@ -1,72 +0,0 @@
-From 5cb993ff131fca2abef3ce074a20258fd6fce557 Mon Sep 17 00:00:00 2001
-From: Bernhard Beschow <shentey@gmail.com>
-Date: Sat, 18 Mar 2023 19:59:31 +0100
-Subject: [PATCH] qemu/osdep: Switch position of "extern" and "G_NORETURN"
-
-Fixes the Windows build under msys2 using GCC 12 which fails with the following
-error:
-
-  [184/579] Compiling C++ object qga/vss-win32/qga-vss.dll.p/install.cpp.obj
-  FAILED: qga/vss-win32/qga-vss.dll.p/install.cpp.obj
-  "c++" "-m64" "-mcx16" "-Iqga/vss-win32/qga-vss.dll.p" "-Iqga/vss-win32" "-I../src/qga/vss-win32" "-I." "-Iqapi" "-Itrace" "-Iui" "-Iui/shader" "-IC:/msys64/mingw64/include/glib-2.0" "-IC:/msys64/mingw64/lib/glib-2.0/include" "-fdiagnostics-color=auto" "-Wall" "-Winvalid-pch" "-Wnon-virtual-dtor" "-Werror" "-std=gnu++11" "-g" "-iquote" "." "-iquote" "C:/msys64/home/shentey/Projects/qemu/src" "-iquote" "C:/msys64/home/shentey/Projects/qemu/src/include" "-iquote" "C:/msys64/home/shentey/Projects/qemu/src/tcg/i386" "-D__STDC_LIMIT_MACROS" "-D__STDC_CONSTANT_MACROS" "-D__STDC_FORMAT_MACROS" "-fno-pie" "-no-pie" "-D_GNU_SOURCE" "-D_FILE_OFFSET_BITS=64" "-D_LARGEFILE_SOURCE" "-fno-strict-aliasing" "-fno-common" "-fwrapv" "-Wundef" "-Wwrite-strings" "-Wtype-limits" "-Wformat-security" "-Wformat-y2k" "-Winit-self" "-Wignored-qualifiers" "-Wempty-body" "-Wendif-labels" "-Wexpansion-to-defined" "-Wimplicit-fallthrough=2" "-Wmissing-format-attribute" "-Wno-missing-include-dirs" "-Wno-shift-negative-value" "-Wno-psabi" "-fstack-protector-strong" "-Wno-unknown-pragmas" "-Wno-delete-non-virtual-dtor" "-Wno-non-virtual-dtor" -MD -MQ qga/vss-win32/qga-vss.dll.p/install.cpp.obj -MF "qga/vss-win32/qga-vss.dll.p/install.cpp.obj.d" -o qga/vss-win32/qga-vss.dll.p/install.cpp.obj "-c" ../src/qga/vss-win32/install.cpp
-  In file included from C:/msys64/mingw64/lib/glib-2.0/include/glibconfig.h:9,
-              from C:/msys64/mingw64/include/glib-2.0/glib/gtypes.h:34,
-              from C:/msys64/mingw64/include/glib-2.0/glib/galloca.h:34,
-              from C:/msys64/mingw64/include/glib-2.0/glib.h:32,
-              from C:/msys64/home/shentey/Projects/qemu/src/include/glib-compat.h:32,
-              from C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:144,
-              from ../src/qga/vss-win32/install.cpp:13:
-  C:/msys64/mingw64/include/glib-2.0/glib/gmacros.h:1075:21: error: standard attributes in middle of decl-specifiers
-  1075 | # define G_NORETURN [[noreturn]]
-        |                     ^
-  C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:240:8: note: in expansion of macro 'G_NORETURN'
-  240 | extern G_NORETURN
-        |        ^~~~~~~~~~
-  C:/msys64/mingw64/include/glib-2.0/glib/gmacros.h:1075:21: note: standard attributes must precede the decl-specifiers to apply to the declaration, or follow them to apply to the type
-  1075 | # define G_NORETURN [[noreturn]]
-        |                     ^
-  C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:240:8: note: in expansion of macro 'G_NORETURN'
-  240 | extern G_NORETURN
-        |        ^~~~~~~~~~
-  C:/msys64/mingw64/include/glib-2.0/glib/gmacros.h:1075:21: error: attribute ignored [-Werror=attributes]
-  1075 | # define G_NORETURN [[noreturn]]
-        |                     ^
-  C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:240:8: note: in expansion of macro 'G_NORETURN'
-  240 | extern G_NORETURN
-        |        ^~~~~~~~~~
-  C:/msys64/mingw64/include/glib-2.0/glib/gmacros.h:1075:21: note: an attribute that appertains to a type-specifier is ignored
-  1075 | # define G_NORETURN [[noreturn]]
-        |                     ^
-  C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:240:8: note: in expansion of macro 'G_NORETURN'
-  240 | extern G_NORETURN
-        |        ^~~~~~~~~~
-  cc1plus.exe: all warnings being treated as errors
-
-Apparently it also fixes the compilation with Clang 15 (see
-https://gitlab.com/qemu-project/qemu/-/issues/1541 ).
-
-Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1541
-Signed-off-by: Bernhard Beschow <shentey@gmail.com>
-Message-Id: <20230318185931.181659-1-shentey@gmail.com>
-Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
-Signed-off-by: Thomas Huth <thuth@redhat.com>
----
- include/qemu/osdep.h | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
-index f68b5d8708c..9eff0be95bd 100644
---- a/include/qemu/osdep.h
-+++ b/include/qemu/osdep.h
-@@ -237,7 +237,7 @@ extern "C" {
-  * supports QEMU_ERROR, this will be reported at compile time; otherwise
-  * this will be reported at link time due to the missing symbol.
-  */
--extern G_NORETURN
-+G_NORETURN extern
- void QEMU_ERROR("code path is reachable")
-     qemu_build_not_reached_always(void);
- #if defined(__OPTIMIZE__) && !defined(__NO_INLINE__)
--- 
-GitLab
-
diff --git a/srcpkgs/qemu/patches/keymap.patch b/srcpkgs/qemu/patches/keymap.patch
new file mode 100644
index 000000000000..fe54c3982051
--- /dev/null
+++ b/srcpkgs/qemu/patches/keymap.patch
@@ -0,0 +1,30 @@
+The xkb official name for the Arabic keyboard layout is 'ara'.
+However xkb has for at least the past 15 years also permitted it to
+be named via the legacy synonym 'ar'.  In xkeyboard-config 2.39 this
+synoynm was removed, which breaks compilation of QEMU:
+
+Make QEMU always ask for the 'ara' xkb layout, which should work on
+both older and newer xkeyboard-config.  We leave the QEMU name for
+this keyboard layout as 'ar'; it is not the only one where our name
+for it deviates from the xkb standard name.
+
+Cc: qemu-stable@nongnu.org
+Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
+Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1709
+---
+ pc-bios/keymaps/meson.build | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/pc-bios/keymaps/meson.build b/pc-bios/keymaps/meson.build
+index bff30833137..0bd8ce00775 100644
+--- a/pc-bios/keymaps/meson.build
++++ b/pc-bios/keymaps/meson.build
+@@ -1,5 +1,5 @@
+ keymaps = {
+-  'ar': '-l ar',
++  'ar': '-l ara',
+   'bepo': '-l fr -v dvorak',
+   'cz': '-l cz',
+   'da': '-l dk',
+-- 
+2.34.1
diff --git a/srcpkgs/qemu/patches/mmap-mremap-efault.patch b/srcpkgs/qemu/patches/mmap-mremap-efault.patch
deleted file mode 100644
index 5a70e9658b30..000000000000
--- a/srcpkgs/qemu/patches/mmap-mremap-efault.patch
+++ /dev/null
@@ -1,42 +0,0 @@
-Source: @pullmoll
-Upstream: no
-Reason: errno=EFAULT when the address passed to mremap(2) is not valid
-
-See Rich Felker's comment at https://www.openwall.com/lists/musl/2017/06/21/2 for
-why we need to return errno as described in man mremap(2) from qemu-user-static.
-Also speed up the loop when checking for increasing the mappings size to go
-in steps of TARGET_PAGE_SIZE and OR-in a check for the very last byte of the range.
-diff --git linux-user/mmap.c linux-user/mmap.c
-index 7e3b245..1e8d0f1 100644
---- a/linux-user/mmap.c
-+++ b/linux-user/mmap.c
-@@ -738,7 +738,7 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size,
-          !guest_range_valid_untagged(new_addr, new_size)) ||
-         ((flags & MREMAP_MAYMOVE) == 0 &&
-          !guest_range_valid_untagged(old_addr, new_size))) {
--        errno = ENOMEM;
-+        errno = EFAULT;
-         return -1;
-     }
- 
-@@ -775,9 +775,10 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size,
-             abi_ulong addr;
-             for (addr = old_addr + old_size;
-                  addr < old_addr + new_size;
--                 addr++) {
-+                 addr += TARGET_PAGE_SIZE) {
-                 prot |= page_get_flags(addr);
-             }
-+				prot |= page_get_flags(old_addr + new_size - 1);
-         }
-         if (prot == 0) {
-             host_addr = mremap(g2h_untagged(old_addr),
-@@ -796,7 +797,7 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size,
-                 }
-             }
-         } else {
--            errno = ENOMEM;
-+            errno = EFAULT;
-             host_addr = MAP_FAILED;
-         }
-     }
diff --git a/srcpkgs/qemu/patches/musl-initialize-msghdr.patch b/srcpkgs/qemu/patches/musl-initialize-msghdr.patch
index 6d96b3511daf..a88547354c1e 100644
--- a/srcpkgs/qemu/patches/musl-initialize-msghdr.patch
+++ b/srcpkgs/qemu/patches/musl-initialize-msghdr.patch
@@ -1,10 +1,10 @@
 Source: https://github.com/void-linux/void-packages/issues/23557
 
-diff --git linux-user/syscall.c linux-user/syscall.c
-index 945fc25..8d8b68a 100644
+diff --git a/linux-user/syscall.c b/linux-user/syscall.c
+index 14fdebd..de280af 100644
 --- a/linux-user/syscall.c
 +++ b/linux-user/syscall.c
-@@ -3071,7 +3071,7 @@ static abi_long do_sendrecvmsg_locked(int fd, struct target_msghdr *msgp,
+@@ -3229,7 +3229,7 @@ static abi_long do_sendrecvmsg_locked(int fd, struct target_msghdr *msgp,
                                        int flags, int send)
  {
      abi_long ret, len;
diff --git a/srcpkgs/qemu/patches/musl-ppc.patch b/srcpkgs/qemu/patches/musl-ppc.patch
deleted file mode 100644
index 0b77aa8fc63d..000000000000
--- a/srcpkgs/qemu/patches/musl-ppc.patch
+++ /dev/null
@@ -1,25 +0,0 @@
---- a/linux-user/signal.c
-+++ b/linux-user/signal.c
-@@ -21,5 +21,9 @@
- #include "exec/gdbstub.h"
- #include "hw/core/tcg-cpu-ops.h"
- 
-+#if defined(_ARCH_PPC64) && !defined(__GLIBC__) /* musl */
-+#include <asm/ptrace.h>
-+#endif
-+
- #include <sys/ucontext.h>
- #include <sys/resource.h>
---- a/util/mmap-alloc.c
-+++ b/util/mmap-alloc.c
-@@ -25,6 +25,10 @@
- 
- #ifdef CONFIG_LINUX
- #include <sys/vfs.h>
-+/* musl undefs this on ppc and mips */
-+#ifndef MAP_SYNC
-+#define MAP_SYNC 0x80000
-+#endif
- #endif
- 
- size_t qemu_fd_getpagesize(int fd)
diff --git a/srcpkgs/qemu/patches/musl-rlimit-rttime.patch b/srcpkgs/qemu/patches/musl-rlimit-rttime.patch
deleted file mode 100644
index 0cbf9be36a8f..000000000000
--- a/srcpkgs/qemu/patches/musl-rlimit-rttime.patch
+++ /dev/null
@@ -1,13 +0,0 @@
---- a/linux-user/syscall.c
-+++ b/linux-user/syscall.c
-@@ -141,6 +141,10 @@
- #include "fd-trans.h"
- #include "tcg/tcg.h"
- 
-+#ifndef RLIMIT_RTTIME
-+#define RLIMIT_RTTIME 15
-+#endif
-+
- #ifndef CLONE_IO
- #define CLONE_IO                0x80000000      /* Clone io context */
- #endif
diff --git a/srcpkgs/qemu/patches/xxx-ppcle.patch b/srcpkgs/qemu/patches/xxx-ppcle.patch
deleted file mode 100644
index 90b32b5e07cd..000000000000
--- a/srcpkgs/qemu/patches/xxx-ppcle.patch
+++ /dev/null
@@ -1,113 +0,0 @@
-From 7ece08d7902d5a8c007deeb0b75cb533a41dd882 Mon Sep 17 00:00:00 2001
-From: Daniel Kolesa <daniel@octaforge.org>
-Date: Sun, 7 Mar 2021 01:47:42 +0100
-Subject: [PATCH] support ppcle architecture
-
----
- configure                            | 14 ++++++++++++--
- configs/targets/ppcle-linux-user.mak |  4 ++++
- linux-user/ppc/target_syscall.h      |  4 ++++
- scripts/qemu-binfmt-conf.sh          |  6 +++++-
- tests/tcg/configure.sh               |  2 ++
- 5 files changed, 27 insertions(+), 3 deletions(-)
- create mode 100644 configs/targets/ppcle-linux-user.mak
-
-diff --git a/configure b/configure
-index 18c26e0..03d3e18 100755
---- a/configure
-+++ b/configure
-@@ -653,7 +653,11 @@ elif check_define _ARCH_PPC ; then
-       cpu="ppc64"
-     fi
-   else
--    cpu="ppc"
-+    if check_define _LITTLE_ENDIAN ; then
-+      cpu="ppcle"
-+    else
-+      cpu="ppc"
-+    fi
-   fi
- elif check_define __mips__ ; then
-   cpu="mips"
-@@ -638,6 +642,9 @@
- 
-   ppc)
-     CPU_CFLAGS="-m32" ;;
-+  ppcle)
-+    cpu="ppc"
-+    CPU_CFLAGS="-m32 -mlittle-endian" ;;
-   ppc64)
-     CPU_CFLAGS="-m64 -mbig-endian" ;;
-   ppc64le)
-diff --git a/configs/targets/ppcle-linux-user.mak b/configs/targets/ppcle-linux-user.mak
-new file mode 100644
-index 0000000..2259243
---- /dev/null
-+++ b/configs/targets/ppcle-linux-user.mak
-@@ -0,0 +1,4 @@
-+TARGET_ARCH=ppc
-+TARGET_SYSTBL_ABI=common,nospu,32
-+TARGET_SYSTBL=syscall.tbl
-+TARGET_XML_FILES= gdb-xml/power-core.xml gdb-xml/power-fpu.xml gdb-xml/power-altivec.xml gdb-xml/power-spe.xml
-diff --git a/linux-user/ppc/target_syscall.h b/linux-user/ppc/target_syscall.h
-index b9c4b81..cf26497 100644
---- a/linux-user/ppc/target_syscall.h
-+++ b/linux-user/ppc/target_syscall.h
-@@ -65,7 +65,11 @@ struct target_revectored_struct {
- #define UNAME_MACHINE "ppc64le"
- #endif
- #else
-+#if TARGET_BIG_ENDIAN
- #define UNAME_MACHINE "ppc"
-+#else
-+#define UNAME_MACHINE "ppcle"
-+#endif
- #endif
- #define UNAME_MINIMUM_RELEASE "2.6.32"
- 
-diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh
-index 9f1580a..393943f 100755
---- a/scripts/qemu-binfmt-conf.sh
-+++ b/scripts/qemu-binfmt-conf.sh
-@@ -46,6 +46,10 @@ ppc_magic='\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x
- ppc_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
- ppc_family=ppc
- 
-+ppcle_magic='\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x14\x00'
-+ppcle_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\x00'
-+ppc_family=ppcle
-+
- ppc64_magic='\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x15'
- ppc64_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
- ppc64_family=ppc
-@@ -148,7 +152,7 @@ qemu_get_family() {
-     "Power Macintosh"|ppc64|powerpc|ppc)
-         echo "ppc"
-         ;;
--    ppc64el|ppc64le)
-+    ppc64el|ppc64le|ppcel|ppcle)
-         echo "ppcle"
-         ;;
-     arm|armel|armhf|arm64|armv[4-9]*l|aarch64)
-diff --git a/configure b/configure
-index 72ab03f11a..0691929d76 100755
---- a/configure
-+++ b/configure
-@@ -1866,6 +1866,7 @@ fi
- : ${cross_prefix_mips="mips-linux-gnu-"}
- : ${cross_prefix_nios2="nios2-linux-gnu-"}
- : ${cross_prefix_ppc="powerpc-linux-gnu-"}
-+: ${cross_prefix_ppcle="powerpcle-linux-gnu-"}
- : ${cross_prefix_ppc64="powerpc64-linux-gnu-"}
- : ${cross_prefix_ppc64le="$cross_prefix_ppc64"}
- : ${cross_prefix_riscv64="riscv64-linux-gnu-"}
-@@ -1883,6 +1884,7 @@ fi
- : ${cross_cc_cflags_hexagon="-mv67 -O2 -static"}
- : ${cross_cc_cflags_i386="-m32"}
- : ${cross_cc_cflags_ppc="-m32 -mbig-endian"}
-+: ${cross_cc_cflags_ppcle="-m32"}
- : ${cross_cc_cflags_ppc64="-m64 -mbig-endian"}
- : ${cross_cc_ppc64le="$cross_cc_ppc64"}
- : ${cross_cc_cflags_ppc64le="-m64 -mlittle-endian"}
-2.30.1
-
diff --git a/srcpkgs/qemu/template b/srcpkgs/qemu/template
index 48ab199e5686..178a3f08f24d 100644
--- a/srcpkgs/qemu/template
+++ b/srcpkgs/qemu/template
@@ -1,8 +1,8 @@
 # Template file for 'qemu'
 # This package should be updated together with qemu-user-static
 pkgname=qemu
-version=7.1.0
-revision=2
+version=8.0.2
+revision=1
 build_style=configure
 configure_args="--prefix=/usr --sysconfdir=/etc --libexecdir=/usr/libexec --localstatedir=/var
  --disable-glusterfs --disable-xen --enable-docs --enable-kvm --enable-libusb --enable-pie
@@ -10,10 +10,10 @@ configure_args="--prefix=/usr --sysconfdir=/etc --libexecdir=/usr/libexec --loca
  --audio-drv-list=alsa$(vopt_if sdl2 ,sdl)$(vopt_if jack ,jack)$(vopt_if pulseaudio ,pa)
  $(vopt_enable opengl) $(vopt_enable pulseaudio pa) $(vopt_enable sdl2 sdl) $(vopt_enable smartcard)
  $(vopt_enable spice) $(vopt_enable virgl virglrenderer) $(vopt_if gtk3 '--enable-gtk')"
-hostmakedepends="gettext pkg-config perl python3 python3-Sphinx python3-sphinx_rtd_theme ninja"
+hostmakedepends="flex gettext glib-devel pkg-config perl python3 python3-Sphinx python3-sphinx_rtd_theme ninja"
 makedepends="capstone-devel dtc-devel libpng-devel libjpeg-turbo-devel pixman-devel
- snappy-devel libuuid-devel libX11-devel alsa-lib-devel libaio-devel gnutls-devel
- libsasl-devel libglib-devel ncurses-devel libseccomp-devel nss-devel
+ snappy-devel libuuid-devel libX11-devel alsa-lib-devel libaio-devel
+ gnutls-devel libsasl-devel ncurses-devel libseccomp-devel nss-devel
  libcurl-devel xfsprogs-devel libcap-ng-devel vde2-devel usbredir-devel
  libbluetooth-devel libssh2-devel libusb-devel libnfs-devel libslirp-devel
  libxkbcommon-devel libzstd-devel $(vopt_if sdl2 'SDL2-devel SDL2_image-devel')
@@ -25,17 +25,17 @@ makedepends="capstone-devel dtc-devel libpng-devel libjpeg-turbo-devel pixman-de
  $(vopt_if jack 'jack-devel') $(vopt_if pulseaudio 'pulseaudio-devel')"
 short_desc="Open Source Processor Emulator"
 maintainer="Orphaned <orphan@voidlinux.org>"
-license="GPL-2.0-or-later, LGPL-2.1-or-later"
+license="GPL-2.0-only, LGPL-2.1-only"
 homepage="https://www.qemu.org"
 distfiles="https://wiki.qemu.org/download/qemu-${version}.tar.bz2"
-checksum=f7ac2b85b3f1831e6810b140306e30af91556e15784864b209f3942858947fd0
+checksum=b59281923d60d358a7d7d3bde46ba43c0810d34d26608fcdaf6bf4c42492b694
 ignore_elf_dirs="/usr/share/qemu"
 nostrip_files="hppa-firmware.img openbios-ppc openbios-sparc32 openbios-sparc64
  palcode-clipper s390-ccw.img s390-netboot.img u-boot.e500 opensbi-riscv32-generic-fw_dynamic.elf
  opensbi-riscv64-generic-fw_dynamic.elf"
 
-build_options="gtk3 opengl sdl2 spice virgl smartcard numa iscsi jack pulseaudio"
-build_options_default="opengl gtk3 virgl sdl2 numa iscsi jack pulseaudio"
+build_options="gtk3 iscsi jack numa opengl pulseaudio sdl2 smartcard spice virgl"
+build_options_default="gtk3 iscsi jack numa opengl pulseaudio sdl2 smartcard spice virgl"
 desc_option_sdl2="Enable SDL (2.x) video output"
 desc_option_spice="Enable support for SPICE"
 desc_option_virgl="Enable support for VirGL (A Virtual 3D GPU renderer)"
@@ -43,37 +43,10 @@ desc_option_smartcard="Enable smartcard support"
 desc_option_numa="Enable support for host NUMA"
 desc_option_iscsi="Enable support for iSCSI"
 
-case "$XBPS_TARGET_MACHINE" in
-	aarch64-musl) CFLAGS="-D_LINUX_SYSINFO_H";;
-esac
-
-if [ "$XBPS_TARGET_ENDIAN" = "le" ]; then
-	build_options_default+=" spice"
-fi
-
 if [ "$CROSS_BUILD" ]; then
-	configure_args+=" --cross-prefix=${XBPS_CROSS_TRIPLET}-"
-else
-	build_options_default+=" smartcard"
-fi
-
-if [ "$XBPS_CHECK_PKGS" != full ]; then
-	make_check_target=check-unit
+	configure_args+=" --cross-prefix=${XBPS_CROSS_TRIPLET}"
 fi
 
-post_extract() {
-	if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
-		grep -rl 'Input/output error' tests/qemu-iotests |
-			xargs -n1 sed -i -e 's;Input/output error;I/O error;g'
-		grep -rl 'Operation not supported' tests/qemu-iotests |
-			xargs -n1 sed -i -e 's;Operation not supported;Not supported;g'
-	fi
-}
-
-pre_configure() {
-	unset CPP
-}
-
 post_install() {
 	vdoc "${FILESDIR}/README.voidlinux"
 

From e513a5054c4f6c9cb2f25115ad5255d43ab746bd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Cerqueira?= <acerqueira021@gmail.com>
Date: Mon, 3 Jul 2023 18:41:30 +0100
Subject: [PATCH 2/2] qemu-user-static: update to 8.0.2.

---
 srcpkgs/qemu-user-static/template | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/srcpkgs/qemu-user-static/template b/srcpkgs/qemu-user-static/template
index 2a8da9b53f2d..509688be23f3 100644
--- a/srcpkgs/qemu-user-static/template
+++ b/srcpkgs/qemu-user-static/template
@@ -1,20 +1,20 @@
 # Template file for 'qemu-user-static'
 # This package should be updated together with qemu
 pkgname=qemu-user-static
-version=7.1.0
-revision=3
+version=8.0.2
+revision=1
 build_style=configure
 configure_args="--prefix=/usr --sysconfdir=/etc --libexecdir=/usr/libexec
  --disable-kvm --disable-png --disable-virtfs --disable-fdt --disable-seccomp
  --enable-linux-user --disable-system --static --disable-pie"
-hostmakedepends="pkg-config perl python3 ninja"
+hostmakedepends="flex glib-devel pkg-config perl python3 ninja"
 makedepends="dtc-devel libglib-devel pixman-devel libuuid-devel"
 short_desc="QEMU User-mode emulators (statically compiled)"
 maintainer="Orphaned <orphan@voidlinux.org>"
-license="GPL-2.0-or-later, LGPL-2.1-or-later"
+license="GPL-2.0-only, LGPL-2.1-only"
 homepage="https://www.qemu.org"
 distfiles="https://wiki.qemu.org/download/qemu-${version}.tar.bz2"
-checksum=f7ac2b85b3f1831e6810b140306e30af91556e15784864b209f3942858947fd0
+checksum=b59281923d60d358a7d7d3bde46ba43c0810d34d26608fcdaf6bf4c42492b694
 
 _fmts="aarch64 aarch64_be alpha arm armeb cris hppa i386 m68k microblaze
  microblazeel mips mipsel mips64 mips64el mipsn32 mipsn32el or1k
@@ -111,10 +111,6 @@ done
 
 binfmts="${binfmts%?}"
 
-pre_configure() {
-	unset CPP
-}
-
 post_install() {
 	# Remove unneeded stuff.
 	rm -rf ${DESTDIR}/etc ${DESTDIR}/usr/share ${DESTDIR}/usr/libexec

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: qemu: update to 8.0.2.
  2023-07-03 17:50 [PR PATCH] qemu: update to 8.0.2 motorto
                   ` (4 preceding siblings ...)
  2023-07-10 14:43 ` motorto
@ 2023-07-12 10:30 ` JamiKettunen
  2023-07-12 10:37 ` JamiKettunen
                   ` (32 subsequent siblings)
  38 siblings, 0 replies; 40+ messages in thread
From: JamiKettunen @ 2023-07-12 10:30 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 218 bytes --]

New comment by JamiKettunen on void-packages repository

https://github.com/void-linux/void-packages/pull/44822#issuecomment-1632254271

Comment:
v8.0.3 is released, also I guess this supersedes both #41138 and #44310

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: qemu: update to 8.0.2.
  2023-07-03 17:50 [PR PATCH] qemu: update to 8.0.2 motorto
                   ` (5 preceding siblings ...)
  2023-07-12 10:30 ` JamiKettunen
@ 2023-07-12 10:37 ` JamiKettunen
  2023-07-12 13:05 ` motorto
                   ` (31 subsequent siblings)
  38 siblings, 0 replies; 40+ messages in thread
From: JamiKettunen @ 2023-07-12 10:37 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 586 bytes --]

New comment by JamiKettunen on void-packages repository

https://github.com/void-linux/void-packages/pull/44822#issuecomment-1632264352

Comment:
```
qemu-user-static-8.0.2_1: configuring ...
update-binfmts: warning: no executable /usr/bin/qemu-ppcle-static found, but continuing anyway as you request
update-binfmts: warning: unable to close /proc/sys/fs/binfmt_misc/register: No such file or directory
update-binfmts: warning: unable to enable binary format qemu-ppcle-static
update-binfmts: exiting due to previous errors
qemu-user-static-8.0.2_1: installed successfully.
```

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: qemu: update to 8.0.2.
  2023-07-03 17:50 [PR PATCH] qemu: update to 8.0.2 motorto
                   ` (6 preceding siblings ...)
  2023-07-12 10:37 ` JamiKettunen
@ 2023-07-12 13:05 ` motorto
  2023-07-12 13:35 ` JamiKettunen
                   ` (30 subsequent siblings)
  38 siblings, 0 replies; 40+ messages in thread
From: motorto @ 2023-07-12 13:05 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 628 bytes --]

New comment by motorto on void-packages repository

https://github.com/void-linux/void-packages/pull/44822#issuecomment-1632495377

Comment:
> ```
> qemu-user-static-8.0.2_1: configuring ...
> update-binfmts: warning: no executable /usr/bin/qemu-ppcle-static found, but continuing anyway as you request
> update-binfmts: warning: unable to close /proc/sys/fs/binfmt_misc/register: No such file or directory
> update-binfmts: warning: unable to enable binary format qemu-ppcle-static
> update-binfmts: exiting due to previous errors
> qemu-user-static-8.0.2_1: installed successfully.
> ```

What system are you using ?

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: qemu: update to 8.0.2.
  2023-07-03 17:50 [PR PATCH] qemu: update to 8.0.2 motorto
                   ` (7 preceding siblings ...)
  2023-07-12 13:05 ` motorto
@ 2023-07-12 13:35 ` JamiKettunen
  2023-07-13  6:12 ` JamiKettunen
                   ` (29 subsequent siblings)
  38 siblings, 0 replies; 40+ messages in thread
From: JamiKettunen @ 2023-07-12 13:35 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 311 bytes --]

New comment by JamiKettunen on void-packages repository

https://github.com/void-linux/void-packages/pull/44822#issuecomment-1632544305

Comment:
x86_64 with glibc, `xbps-query -f qemu-user-static | grep ppc` returns
```
/usr/bin/qemu-ppc-static
/usr/bin/qemu-ppc64-static
/usr/bin/qemu-ppc64le-static
```

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: qemu: update to 8.0.2.
  2023-07-03 17:50 [PR PATCH] qemu: update to 8.0.2 motorto
                   ` (8 preceding siblings ...)
  2023-07-12 13:35 ` JamiKettunen
@ 2023-07-13  6:12 ` JamiKettunen
  2023-07-13  6:13 ` JamiKettunen
                   ` (28 subsequent siblings)
  38 siblings, 0 replies; 40+ messages in thread
From: JamiKettunen @ 2023-07-13  6:12 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 921 bytes --]

New comment by JamiKettunen on void-packages repository

https://github.com/void-linux/void-packages/pull/44822#issuecomment-1633611714

Comment:
This will break most possible chroot actions at least from `x86_64` hosts via `qemu-aarch64-static` specifically on musl Void root filesystems, some patches introduced in musl 1.2.x (with one being import and defaulting to `mallocng` which is over 1k lines of added code in total) seem to help with this as with #43106 installed on the target makes QEMU at least not segfault anymore when running even `/bin/ls`.

We discussed this a bit more on `#xbps` already yesterday with @Duncaen and about the possibility of bringing modern musl version for 64-bit targets and leaving `armv{6,7}-musl` with the 1.1 legacy version since upgrading those in particular will be more work due to `time_t` breakages in 1.2 for 32-bit targets requiring pretty much rebuilding all packages.

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: qemu: update to 8.0.2.
  2023-07-03 17:50 [PR PATCH] qemu: update to 8.0.2 motorto
                   ` (9 preceding siblings ...)
  2023-07-13  6:12 ` JamiKettunen
@ 2023-07-13  6:13 ` JamiKettunen
  2023-07-18  7:35 ` JamiKettunen
                   ` (27 subsequent siblings)
  38 siblings, 0 replies; 40+ messages in thread
From: JamiKettunen @ 2023-07-13  6:13 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 925 bytes --]

New comment by JamiKettunen on void-packages repository

https://github.com/void-linux/void-packages/pull/44822#issuecomment-1633611714

Comment:
This will break most possible chroot actions at least from `x86_64` hosts via `qemu-aarch64-static` specifically on musl Void root filesystems, some patches introduced in musl 1.2.x (with one being import and defaulting to `mallocng` which is over 1k lines of added code in total) seem to help with this as with #43106 installed on the target makes QEMU at least not segfault anymore when running even `/bin/ls`.

We discussed this a bit more on `#xbps` already yesterday with @Duncaen and about the possibility of bringing modern musl version for 64-bit targets and leaving `armv{6,7}-musl` with the 1.1 legacy version since upgrading those in particular will be more work due to `time_t` ABI breakages in 1.2 for 32-bit targets requiring pretty much rebuilding all packages.

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: qemu: update to 8.0.2.
  2023-07-03 17:50 [PR PATCH] qemu: update to 8.0.2 motorto
                   ` (10 preceding siblings ...)
  2023-07-13  6:13 ` JamiKettunen
@ 2023-07-18  7:35 ` JamiKettunen
  2023-07-18  7:45 ` JamiKettunen
                   ` (26 subsequent siblings)
  38 siblings, 0 replies; 40+ messages in thread
From: JamiKettunen @ 2023-07-18  7:35 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 357 bytes --]

New comment by JamiKettunen on void-packages repository

https://github.com/void-linux/void-packages/pull/44822#issuecomment-1639667651

Comment:
Looks like something might've happened upstream fixing this even on the old musl 1.1, will bisect https://gitlab.com/qemu-project/qemu/-/compare/887cba8...361d539 for the commit we could include until a new tag

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: qemu: update to 8.0.2.
  2023-07-03 17:50 [PR PATCH] qemu: update to 8.0.2 motorto
                   ` (11 preceding siblings ...)
  2023-07-18  7:35 ` JamiKettunen
@ 2023-07-18  7:45 ` JamiKettunen
  2023-07-18  8:59 ` JamiKettunen
                   ` (25 subsequent siblings)
  38 siblings, 0 replies; 40+ messages in thread
From: JamiKettunen @ 2023-07-18  7:45 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 542 bytes --]

New comment by JamiKettunen on void-packages repository

https://github.com/void-linux/void-packages/pull/44822#issuecomment-1639667651

Comment:
Looks like something might've happened upstream fixing this even on the old musl 1.1, will bisect https://gitlab.com/qemu-project/qemu/-/compare/887cba8...361d539 for the commit we could include until a new tag.

https://gitlab.com/qemu-project/qemu/-/commit/d28b3c9 (`linux-user: Make sure initial brk(0) is page-aligned`) stuck out to me just looking at it and that looks to fix the issue :)

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: qemu: update to 8.0.2.
  2023-07-03 17:50 [PR PATCH] qemu: update to 8.0.2 motorto
                   ` (12 preceding siblings ...)
  2023-07-18  7:45 ` JamiKettunen
@ 2023-07-18  8:59 ` JamiKettunen
  2023-07-18  9:10 ` JamiKettunen
                   ` (24 subsequent siblings)
  38 siblings, 0 replies; 40+ messages in thread
From: JamiKettunen @ 2023-07-18  8:59 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 667 bytes --]

New comment by JamiKettunen on void-packages repository

https://github.com/void-linux/void-packages/pull/44822#issuecomment-1639667651

Comment:
~~Looks like something might've happened upstream fixing this even on the old musl 1.1, will bisect https://gitlab.com/qemu-project/qemu/-/compare/887cba8...361d539 for the commit we could include until a new tag.~~

~~https://gitlab.com/qemu-project/qemu/-/commit/d28b3c9 (`linux-user: Make sure initial brk(0) is page-aligned`) stuck out to me just looking at it and that looks to fix the issue :)~~

nvm it's already getting reverted upstream https://lists.nongnu.org/archive/html/qemu-devel/2023-07/msg03443.html

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: qemu: update to 8.0.2.
  2023-07-03 17:50 [PR PATCH] qemu: update to 8.0.2 motorto
                   ` (13 preceding siblings ...)
  2023-07-18  8:59 ` JamiKettunen
@ 2023-07-18  9:10 ` JamiKettunen
  2023-07-18  9:14 ` JamiKettunen
                   ` (23 subsequent siblings)
  38 siblings, 0 replies; 40+ messages in thread
From: JamiKettunen @ 2023-07-18  9:10 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 659 bytes --]

New comment by JamiKettunen on void-packages repository

https://github.com/void-linux/void-packages/pull/44822#issuecomment-1639667651

Comment:
~~Looks like something might've happened upstream fixing this even on the old musl 1.1, will bisect https://gitlab.com/qemu-project/qemu/-/compare/887cba8...361d539 for the commit we could include until a new tag.~~

~~https://gitlab.com/qemu-project/qemu/-/commit/d28b3c9 (`linux-user: Make sure initial brk(0) is page-aligned`) stuck out to me just looking at it and that looks to fix the issue :)~~

it's already getting superseded by https://lists.nongnu.org/archive/html/qemu-devel/2023-07/msg03445.html

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: qemu: update to 8.0.2.
  2023-07-03 17:50 [PR PATCH] qemu: update to 8.0.2 motorto
                   ` (14 preceding siblings ...)
  2023-07-18  9:10 ` JamiKettunen
@ 2023-07-18  9:14 ` JamiKettunen
  2023-07-18 14:17 ` [PR PATCH] [Updated] " motorto
                   ` (22 subsequent siblings)
  38 siblings, 0 replies; 40+ messages in thread
From: JamiKettunen @ 2023-07-18  9:14 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 681 bytes --]

New comment by JamiKettunen on void-packages repository

https://github.com/void-linux/void-packages/pull/44822#issuecomment-1639667651

Comment:
~~Looks like something might've happened upstream fixing this even on the old musl 1.1, will bisect https://gitlab.com/qemu-project/qemu/-/compare/887cba8...361d539 for the commit we could include until a new tag.~~

~~https://gitlab.com/qemu-project/qemu/-/commit/d28b3c9 (`linux-user: Make sure initial brk(0) is page-aligned`) stuck out to me just looking at it and that looks to fix the issue :)~~

it's already getting superseded by https://patchwork.kernel.org/project/qemu-devel/cover/20230717213545.142598-1-deller@gmx.de/

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [PR PATCH] [Updated] qemu: update to 8.0.2.
  2023-07-03 17:50 [PR PATCH] qemu: update to 8.0.2 motorto
                   ` (15 preceding siblings ...)
  2023-07-18  9:14 ` JamiKettunen
@ 2023-07-18 14:17 ` motorto
  2023-07-18 14:23 ` qemu: update to 8.0.3 motorto
                   ` (21 subsequent siblings)
  38 siblings, 0 replies; 40+ messages in thread
From: motorto @ 2023-07-18 14:17 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1461 bytes --]

There is an updated pull request by motorto against master on the void-packages repository

https://github.com/motorto/void-packages qemu-8.0.2
https://github.com/void-linux/void-packages/pull/44822

qemu: update to 8.0.2.
<!-- Uncomment relevant sections and delete options which are not applicable -->
[ci-skip] 

Draft because of: https://github.com/void-linux/void-packages/pull/44822#issuecomment-1633611714


#### Testing the changes
- I tested the changes in this PR: **YES**, runned a Windows vm machine and it worked fine.

Removed a bunch of patches that in my research are no longer needed:

- Removed all ppc related patches since that arch isn't no longer supported.
- gcc12.patch: because it builds fine now in this version
- fix-softfloat-fesetround.patch: don't have a system to try it, but alpine doesn't have any patch related to this)
- mmap-mremap-efaul: not sure about if we should keep this one

Kept this patches:

- musl-initialize-msghdr.patch: just update in order to apply.

Added this ones:

- CVE-2023-2861.patch:
- keymap.patch: xkeyboard-config 2.39 removed the legacy alias of ar -> ara

#### Local build testing
- I built this PR locally for my native architecture, x86-64-glibc
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl (cross)
  - x86_64-musl



A patch file from https://github.com/void-linux/void-packages/pull/44822.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-qemu-8.0.2-44822.patch --]
[-- Type: text/x-diff, Size: 35178 bytes --]

From 29203ff8cbc08661eb08d2634238ccda87023e26 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Cerqueira?= <acerqueira021@gmail.com>
Date: Mon, 3 Jul 2023 18:41:12 +0100
Subject: [PATCH 1/2] qemu: update to 8.0.3.

---
 srcpkgs/qemu/patches/fix-brk0.patch           |  30 +++
 .../qemu/patches/fix-linux-user-ppc32.patch   | 117 ----------
 .../patches/fix-softfloat-fesetround.patch    |  39 ----
 srcpkgs/qemu/patches/gcc12.patch              |  72 ------
 srcpkgs/qemu/patches/lfs64.patch              | 208 ++++++++++++++++++
 srcpkgs/qemu/patches/mmap-mremap-efault.patch |  42 ----
 .../qemu/patches/musl-initialize-msghdr.patch |   6 +-
 srcpkgs/qemu/patches/musl-ppc.patch           |  25 ---
 srcpkgs/qemu/patches/musl-rlimit-rttime.patch |  13 --
 srcpkgs/qemu/patches/xxx-ppcle.patch          | 113 ----------
 srcpkgs/qemu/template                         |  47 +---
 11 files changed, 251 insertions(+), 461 deletions(-)
 create mode 100644 srcpkgs/qemu/patches/fix-brk0.patch
 delete mode 100644 srcpkgs/qemu/patches/fix-linux-user-ppc32.patch
 delete mode 100644 srcpkgs/qemu/patches/fix-softfloat-fesetround.patch
 delete mode 100644 srcpkgs/qemu/patches/gcc12.patch
 create mode 100644 srcpkgs/qemu/patches/lfs64.patch
 delete mode 100644 srcpkgs/qemu/patches/mmap-mremap-efault.patch
 delete mode 100644 srcpkgs/qemu/patches/musl-ppc.patch
 delete mode 100644 srcpkgs/qemu/patches/musl-rlimit-rttime.patch
 delete mode 100644 srcpkgs/qemu/patches/xxx-ppcle.patch

diff --git a/srcpkgs/qemu/patches/fix-brk0.patch b/srcpkgs/qemu/patches/fix-brk0.patch
new file mode 100644
index 000000000000..0ec31a1ff3bc
--- /dev/null
+++ b/srcpkgs/qemu/patches/fix-brk0.patch
@@ -0,0 +1,30 @@
+From d28b3c90cfad1a7e211ae2bce36ecb9071086129 Mon Sep 17 00:00:00 2001
+From: Andreas Schwab <schwab@suse.de>
+Date: Thu, 6 Jul 2023 13:34:19 +0200
+Subject: [PATCH] linux-user: Make sure initial brk(0) is page-aligned
+
+Fixes: 86f04735ac ("linux-user: Fix brk() to release pages")
+Signed-off-by: Andreas Schwab <schwab@suse.de>
+Message-Id: <mvmpm55qnno.fsf@suse.de>
+Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
+Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
+---
+ linux-user/syscall.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/linux-user/syscall.c b/linux-user/syscall.c
+index b78eb686d8..02d3b6c90a 100644
+--- a/linux-user/syscall.c
++++ b/linux-user/syscall.c
+@@ -806,7 +806,7 @@ static abi_ulong brk_page;
+ 
+ void target_set_brk(abi_ulong new_brk)
+ {
+-    target_brk = new_brk;
++    target_brk = TARGET_PAGE_ALIGN(new_brk);
+     brk_page = HOST_PAGE_ALIGN(target_brk);
+ }
+ 
+-- 
+GitLab
+
diff --git a/srcpkgs/qemu/patches/fix-linux-user-ppc32.patch b/srcpkgs/qemu/patches/fix-linux-user-ppc32.patch
deleted file mode 100644
index cd47435d5aa9..000000000000
--- a/srcpkgs/qemu/patches/fix-linux-user-ppc32.patch
+++ /dev/null
@@ -1,117 +0,0 @@
-commit 37814f62c2cc7aba2eea073014d6c53dcd5bf42c
-Author: q66 <daniel@octaforge.org>
-Date:   Fri Jul 1 16:53:55 2022 +0200
-
-    fix linux-user build on 32-bit ppc
-    
-    Partial revert https://gitlab.com/qemu-project/qemu/-/commit/9d1401b79463e74adbfac69d836789d4e103fb61
-    and https://gitlab.com/qemu-project/qemu/-/commit/0a7e01904d407baa73c1baddbdfc9ccf2ace8356
-
-diff --git a/common-user/host/ppc/safe-syscall.inc.S b/common-user/host/ppc/safe-syscall.inc.S
-new file mode 100644
-index 0000000..e69de29
-diff --git a/common-user/safe-syscall-error.c b/common-user/safe-syscall-error.c
-index cf74b50..a36132c 100644
---- a/common-user/safe-syscall-error.c
-+++ b/common-user/safe-syscall-error.c
-@@ -12,6 +12,7 @@
- #include "qemu/osdep.h"
- #include "user/safe-syscall.h"
- 
-+#if !defined(__powerpc__) || defined(__powerpc64__)
- /*
-  * This is intended to be invoked via tail-call on the error path
-  * from the assembly in host/arch/safe-syscall.inc.S.  This takes
-@@ -23,3 +24,4 @@ long safe_syscall_set_errno_tail(int value)
-     errno = value;
-     return -1;
- }
-+#endif
-diff --git a/include/user/safe-syscall.h b/include/user/safe-syscall.h
-index 61a04e2..793fe84 100644
---- a/include/user/safe-syscall.h
-+++ b/include/user/safe-syscall.h
-@@ -125,6 +125,8 @@
-  * kinds of restartability.
-  */
- 
-+#if !defined(__powerpc__) || defined(__powerpc64__)
-+
- /* The core part of this function is implemented in assembly */
- extern long safe_syscall_base(int *pending, long number, ...);
- extern long safe_syscall_set_errno_tail(int value);
-@@ -137,4 +139,10 @@ extern char safe_syscall_end[];
-     safe_syscall_base(&((TaskState *)thread_cpu->opaque)->signal_pending, \
-                       __VA_ARGS__)
- 
-+#else
-+
-+#define safe_syscall syscall
-+
-+#endif
-+
- #endif
-diff --git a/linux-user/include/host/ppc/host-signal.h b/linux-user/include/host/ppc/host-signal.h
-new file mode 100644
-index 0000000..b80384d
---- /dev/null
-+++ b/linux-user/include/host/ppc/host-signal.h
-@@ -0,0 +1,38 @@
-+/*
-+ * host-signal.h: signal info dependent on the host architecture
-+ *
-+ * Copyright (c) 2003-2005 Fabrice Bellard
-+ * Copyright (c) 2021 Linaro Limited
-+ *
-+ * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
-+ * See the COPYING file in the top-level directory.
-+ */
-+
-+#ifndef PPC_HOST_SIGNAL_H
-+#define PPC_HOST_SIGNAL_H
-+
-+/* The third argument to a SA_SIGINFO handler is ucontext_t. */
-+typedef ucontext_t host_sigcontext;
-+
-+static inline uintptr_t host_signal_pc(host_sigcontext *uc)
-+{
-+    return uc->uc_mcontext.regs->nip;
-+}
-+
-+static inline void host_signal_set_pc(host_sigcontext *uc, uintptr_t pc)
-+{
-+    uc->uc_mcontext.regs->nip = pc;
-+}
-+
-+static inline void *host_signal_mask(host_sigcontext *uc)
-+{
-+    return &uc->uc_sigmask;
-+}
-+
-+static inline bool host_signal_write(siginfo_t *info, host_sigcontext *uc)
-+{
-+    return uc->uc_mcontext.regs->trap != 0x400
-+        && (uc->uc_mcontext.regs->dsisr & 0x02000000);
-+}
-+
-+#endif
-diff --git a/linux-user/signal.c b/linux-user/signal.c
-index 092e70b..b8dfa8a 100644
---- a/linux-user/signal.c
-+++ b/linux-user/signal.c
-@@ -800,6 +800,7 @@ void queue_signal(CPUArchState *env, int sig, int si_type,
- /* Adjust the signal context to rewind out of safe-syscall if we're in it */
- static inline void rewind_if_in_safe_syscall(void *puc)
- {
-+#if !defined(__powerpc__) || defined(__powerpc64__)
-     host_sigcontext *uc = (host_sigcontext *)puc;
-     uintptr_t pcreg = host_signal_pc(uc);
- 
-@@ -807,6 +808,7 @@ static inline void rewind_if_in_safe_syscall(void *puc)
-         && pcreg < (uintptr_t)safe_syscall_end) {
-         host_signal_set_pc(uc, (uintptr_t)safe_syscall_start);
-     }
-+#endif
- }
- 
- static void host_signal_handler(int host_sig, siginfo_t *info, void *puc)
diff --git a/srcpkgs/qemu/patches/fix-softfloat-fesetround.patch b/srcpkgs/qemu/patches/fix-softfloat-fesetround.patch
deleted file mode 100644
index ecdd049f7921..000000000000
--- a/srcpkgs/qemu/patches/fix-softfloat-fesetround.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-Source: @pullmoll
-Upstream: no
-Reason: Target architectures with soft float do not define these constants.
-
---- a/tests/fp/fp-bench.c	2020-12-08 17:59:44.000000000 +0100
-+++ b/tests/fp/fp-bench.c	2020-12-12 20:38:40.702235420 +0100
-@@ -485,16 +485,32 @@
- 
-     switch (rounding) {
-     case ROUND_EVEN:
-+#if defined(FE_TONEAREST)
-         rhost = FE_TONEAREST;
-+#else
-+	return;
-+#endif
-         break;
-     case ROUND_ZERO:
-+#if defined(FE_TOWARDZERO)
-         rhost = FE_TOWARDZERO;
-+#else
-+	return;
-+#endif
-         break;
-     case ROUND_DOWN:
-+#if defined(FE_DOWNWARD)
-         rhost = FE_DOWNWARD;
-+#else
-+	return;
-+#endif
-         break;
-     case ROUND_UP:
-+#if defined(FE_UPWARD)
-         rhost = FE_UPWARD;
-+#else
-+	return;
-+#endif
-         break;
-     case ROUND_TIEAWAY:
-         die_host_rounding(rounding);
diff --git a/srcpkgs/qemu/patches/gcc12.patch b/srcpkgs/qemu/patches/gcc12.patch
deleted file mode 100644
index 2a4b2bd03609..000000000000
--- a/srcpkgs/qemu/patches/gcc12.patch
+++ /dev/null
@@ -1,72 +0,0 @@
-From 5cb993ff131fca2abef3ce074a20258fd6fce557 Mon Sep 17 00:00:00 2001
-From: Bernhard Beschow <shentey@gmail.com>
-Date: Sat, 18 Mar 2023 19:59:31 +0100
-Subject: [PATCH] qemu/osdep: Switch position of "extern" and "G_NORETURN"
-
-Fixes the Windows build under msys2 using GCC 12 which fails with the following
-error:
-
-  [184/579] Compiling C++ object qga/vss-win32/qga-vss.dll.p/install.cpp.obj
-  FAILED: qga/vss-win32/qga-vss.dll.p/install.cpp.obj
-  "c++" "-m64" "-mcx16" "-Iqga/vss-win32/qga-vss.dll.p" "-Iqga/vss-win32" "-I../src/qga/vss-win32" "-I." "-Iqapi" "-Itrace" "-Iui" "-Iui/shader" "-IC:/msys64/mingw64/include/glib-2.0" "-IC:/msys64/mingw64/lib/glib-2.0/include" "-fdiagnostics-color=auto" "-Wall" "-Winvalid-pch" "-Wnon-virtual-dtor" "-Werror" "-std=gnu++11" "-g" "-iquote" "." "-iquote" "C:/msys64/home/shentey/Projects/qemu/src" "-iquote" "C:/msys64/home/shentey/Projects/qemu/src/include" "-iquote" "C:/msys64/home/shentey/Projects/qemu/src/tcg/i386" "-D__STDC_LIMIT_MACROS" "-D__STDC_CONSTANT_MACROS" "-D__STDC_FORMAT_MACROS" "-fno-pie" "-no-pie" "-D_GNU_SOURCE" "-D_FILE_OFFSET_BITS=64" "-D_LARGEFILE_SOURCE" "-fno-strict-aliasing" "-fno-common" "-fwrapv" "-Wundef" "-Wwrite-strings" "-Wtype-limits" "-Wformat-security" "-Wformat-y2k" "-Winit-self" "-Wignored-qualifiers" "-Wempty-body" "-Wendif-labels" "-Wexpansion-to-defined" "-Wimplicit-fallthrough=2" "-Wmissing-format-attribute" "-Wno-missing-include-dirs" "-Wno-shift-negative-value" "-Wno-psabi" "-fstack-protector-strong" "-Wno-unknown-pragmas" "-Wno-delete-non-virtual-dtor" "-Wno-non-virtual-dtor" -MD -MQ qga/vss-win32/qga-vss.dll.p/install.cpp.obj -MF "qga/vss-win32/qga-vss.dll.p/install.cpp.obj.d" -o qga/vss-win32/qga-vss.dll.p/install.cpp.obj "-c" ../src/qga/vss-win32/install.cpp
-  In file included from C:/msys64/mingw64/lib/glib-2.0/include/glibconfig.h:9,
-              from C:/msys64/mingw64/include/glib-2.0/glib/gtypes.h:34,
-              from C:/msys64/mingw64/include/glib-2.0/glib/galloca.h:34,
-              from C:/msys64/mingw64/include/glib-2.0/glib.h:32,
-              from C:/msys64/home/shentey/Projects/qemu/src/include/glib-compat.h:32,
-              from C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:144,
-              from ../src/qga/vss-win32/install.cpp:13:
-  C:/msys64/mingw64/include/glib-2.0/glib/gmacros.h:1075:21: error: standard attributes in middle of decl-specifiers
-  1075 | # define G_NORETURN [[noreturn]]
-        |                     ^
-  C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:240:8: note: in expansion of macro 'G_NORETURN'
-  240 | extern G_NORETURN
-        |        ^~~~~~~~~~
-  C:/msys64/mingw64/include/glib-2.0/glib/gmacros.h:1075:21: note: standard attributes must precede the decl-specifiers to apply to the declaration, or follow them to apply to the type
-  1075 | # define G_NORETURN [[noreturn]]
-        |                     ^
-  C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:240:8: note: in expansion of macro 'G_NORETURN'
-  240 | extern G_NORETURN
-        |        ^~~~~~~~~~
-  C:/msys64/mingw64/include/glib-2.0/glib/gmacros.h:1075:21: error: attribute ignored [-Werror=attributes]
-  1075 | # define G_NORETURN [[noreturn]]
-        |                     ^
-  C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:240:8: note: in expansion of macro 'G_NORETURN'
-  240 | extern G_NORETURN
-        |        ^~~~~~~~~~
-  C:/msys64/mingw64/include/glib-2.0/glib/gmacros.h:1075:21: note: an attribute that appertains to a type-specifier is ignored
-  1075 | # define G_NORETURN [[noreturn]]
-        |                     ^
-  C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:240:8: note: in expansion of macro 'G_NORETURN'
-  240 | extern G_NORETURN
-        |        ^~~~~~~~~~
-  cc1plus.exe: all warnings being treated as errors
-
-Apparently it also fixes the compilation with Clang 15 (see
-https://gitlab.com/qemu-project/qemu/-/issues/1541 ).
-
-Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1541
-Signed-off-by: Bernhard Beschow <shentey@gmail.com>
-Message-Id: <20230318185931.181659-1-shentey@gmail.com>
-Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
-Signed-off-by: Thomas Huth <thuth@redhat.com>
----
- include/qemu/osdep.h | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
-index f68b5d8708c..9eff0be95bd 100644
---- a/include/qemu/osdep.h
-+++ b/include/qemu/osdep.h
-@@ -237,7 +237,7 @@ extern "C" {
-  * supports QEMU_ERROR, this will be reported at compile time; otherwise
-  * this will be reported at link time due to the missing symbol.
-  */
--extern G_NORETURN
-+G_NORETURN extern
- void QEMU_ERROR("code path is reachable")
-     qemu_build_not_reached_always(void);
- #if defined(__OPTIMIZE__) && !defined(__NO_INLINE__)
--- 
-GitLab
-
diff --git a/srcpkgs/qemu/patches/lfs64.patch b/srcpkgs/qemu/patches/lfs64.patch
new file mode 100644
index 000000000000..aa9701d73f6c
--- /dev/null
+++ b/srcpkgs/qemu/patches/lfs64.patch
@@ -0,0 +1,208 @@
+source: https://git.alpinelinux.org/aports/plain/community/qemu/lfs64.patch
+--
+
+diff --git a/linux-user/syscall.c b/linux-user/syscall.c
+index bbba2a6..38fa09a 100644
+--- a/linux-user/syscall.c
++++ b/linux-user/syscall.c
+@@ -6812,13 +6812,13 @@ static int target_to_host_fcntl_cmd(int cmd)
+         ret = cmd;
+         break;
+     case TARGET_F_GETLK:
+-        ret = F_GETLK64;
++        ret = F_GETLK;
+         break;
+     case TARGET_F_SETLK:
+-        ret = F_SETLK64;
++        ret = F_SETLK;
+         break;
+     case TARGET_F_SETLKW:
+-        ret = F_SETLKW64;
++        ret = F_SETLKW;
+         break;
+     case TARGET_F_GETOWN:
+         ret = F_GETOWN;
+@@ -6834,13 +6834,13 @@ static int target_to_host_fcntl_cmd(int cmd)
+         break;
+ #if TARGET_ABI_BITS == 32
+     case TARGET_F_GETLK64:
+-        ret = F_GETLK64;
++        ret = F_GETLK;
+         break;
+     case TARGET_F_SETLK64:
+-        ret = F_SETLK64;
++        ret = F_SETLK;
+         break;
+     case TARGET_F_SETLKW64:
+-        ret = F_SETLKW64;
++        ret = F_SETLKW;
+         break;
+ #endif
+     case TARGET_F_SETLEASE:
+@@ -6894,8 +6894,8 @@ static int target_to_host_fcntl_cmd(int cmd)
+      * them to 5, 6 and 7 before making the syscall(). Since we make the
+      * syscall directly, adjust to what is supported by the kernel.
+      */
+-    if (ret >= F_GETLK64 && ret <= F_SETLKW64) {
+-        ret -= F_GETLK64 - 5;
++    if (ret >= F_GETLK && ret <= F_SETLKW) {
++        ret -= F_GETLK - 5;
+     }
+ #endif
+ 
+@@ -6928,7 +6928,7 @@ static int host_to_target_flock(int type)
+     return type;
+ }
+ 
+-static inline abi_long copy_from_user_flock(struct flock64 *fl,
++static inline abi_long copy_from_user_flock(struct flock *fl,
+                                             abi_ulong target_flock_addr)
+ {
+     struct target_flock *target_fl;
+@@ -6953,7 +6953,7 @@ static inline abi_long copy_from_user_flock(struct flock64 *fl,
+ }
+ 
+ static inline abi_long copy_to_user_flock(abi_ulong target_flock_addr,
+-                                          const struct flock64 *fl)
++                                          const struct flock *fl)
+ {
+     struct target_flock *target_fl;
+     short l_type;
+@@ -6972,8 +6972,8 @@ static inline abi_long copy_to_user_flock(abi_ulong target_flock_addr,
+     return 0;
+ }
+ 
+-typedef abi_long from_flock64_fn(struct flock64 *fl, abi_ulong target_addr);
+-typedef abi_long to_flock64_fn(abi_ulong target_addr, const struct flock64 *fl);
++typedef abi_long from_flock64_fn(struct flock *fl, abi_ulong target_addr);
++typedef abi_long to_flock64_fn(abi_ulong target_addr, const struct flock *fl);
+ 
+ #if defined(TARGET_ARM) && TARGET_ABI_BITS == 32
+ struct target_oabi_flock64 {
+@@ -6984,7 +6984,7 @@ struct target_oabi_flock64 {
+     abi_int   l_pid;
+ } QEMU_PACKED;
+ 
+-static inline abi_long copy_from_user_oabi_flock64(struct flock64 *fl,
++static inline abi_long copy_from_user_oabi_flock64(struct flock *fl,
+                                                    abi_ulong target_flock_addr)
+ {
+     struct target_oabi_flock64 *target_fl;
+@@ -7009,7 +7009,7 @@ static inline abi_long copy_from_user_oabi_flock64(struct flock64 *fl,
+ }
+ 
+ static inline abi_long copy_to_user_oabi_flock64(abi_ulong target_flock_addr,
+-                                                 const struct flock64 *fl)
++                                                 const struct flock *fl)
+ {
+     struct target_oabi_flock64 *target_fl;
+     short l_type;
+@@ -7029,7 +7029,7 @@ static inline abi_long copy_to_user_oabi_flock64(abi_ulong target_flock_addr,
+ }
+ #endif
+ 
+-static inline abi_long copy_from_user_flock64(struct flock64 *fl,
++static inline abi_long copy_from_user_flock64(struct flock *fl,
+                                               abi_ulong target_flock_addr)
+ {
+     struct target_flock64 *target_fl;
+@@ -7054,7 +7054,7 @@ static inline abi_long copy_from_user_flock64(struct flock64 *fl,
+ }
+ 
+ static inline abi_long copy_to_user_flock64(abi_ulong target_flock_addr,
+-                                            const struct flock64 *fl)
++                                            const struct flock *fl)
+ {
+     struct target_flock64 *target_fl;
+     short l_type;
+@@ -7075,7 +7075,7 @@ static inline abi_long copy_to_user_flock64(abi_ulong target_flock_addr,
+ 
+ static abi_long do_fcntl(int fd, int cmd, abi_ulong arg)
+ {
+-    struct flock64 fl64;
++    struct flock fl64;
+ #ifdef F_GETOWN_EX
+     struct f_owner_ex fox;
+     struct target_f_owner_ex *target_fox;
+@@ -7347,7 +7347,7 @@ static inline abi_long target_truncate64(CPUArchState *cpu_env, const char *arg1
+         arg2 = arg3;
+         arg3 = arg4;
+     }
+-    return get_errno(truncate64(arg1, target_offset64(arg2, arg3)));
++    return get_errno(truncate(arg1, target_offset64(arg2, arg3)));
+ }
+ #endif
+ 
+@@ -7361,7 +7361,7 @@ static inline abi_long target_ftruncate64(CPUArchState *cpu_env, abi_long arg1,
+         arg2 = arg3;
+         arg3 = arg4;
+     }
+-    return get_errno(ftruncate64(arg1, target_offset64(arg2, arg3)));
++    return get_errno(ftruncate(arg1, target_offset64(arg2, arg3)));
+ }
+ #endif
+ 
+@@ -8597,7 +8597,7 @@ static int do_getdents(abi_long dirfd, abi_long arg2, abi_long count)
+     void *tdirp;
+     int hlen, hoff, toff;
+     int hreclen, treclen;
+-    off64_t prev_diroff = 0;
++    off_t prev_diroff = 0;
+ 
+     hdirp = g_try_malloc(count);
+     if (!hdirp) {
+@@ -8650,7 +8650,7 @@ static int do_getdents(abi_long dirfd, abi_long arg2, abi_long count)
+              * Return what we have, resetting the file pointer to the
+              * location of the first record not returned.
+              */
+-            lseek64(dirfd, prev_diroff, SEEK_SET);
++            lseek(dirfd, prev_diroff, SEEK_SET);
+             break;
+         }
+ 
+@@ -8684,7 +8684,7 @@ static int do_getdents64(abi_long dirfd, abi_long arg2, abi_long count)
+     void *tdirp;
+     int hlen, hoff, toff;
+     int hreclen, treclen;
+-    off64_t prev_diroff = 0;
++    off_t prev_diroff = 0;
+ 
+     hdirp = g_try_malloc(count);
+     if (!hdirp) {
+@@ -8726,7 +8726,7 @@ static int do_getdents64(abi_long dirfd, abi_long arg2, abi_long count)
+              * Return what we have, resetting the file pointer to the
+              * location of the first record not returned.
+              */
+-            lseek64(dirfd, prev_diroff, SEEK_SET);
++            lseek(dirfd, prev_diroff, SEEK_SET);
+             break;
+         }
+ 
+@@ -11157,7 +11157,7 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,
+                 return -TARGET_EFAULT;
+             }
+         }
+-        ret = get_errno(pread64(arg1, p, arg3, target_offset64(arg4, arg5)));
++        ret = get_errno(pread(arg1, p, arg3, target_offset64(arg4, arg5)));
+         unlock_user(p, arg2, ret);
+         return ret;
+     case TARGET_NR_pwrite64:
+@@ -11174,7 +11174,7 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,
+                 return -TARGET_EFAULT;
+             }
+         }
+-        ret = get_errno(pwrite64(arg1, p, arg3, target_offset64(arg4, arg5)));
++        ret = get_errno(pwrite(arg1, p, arg3, target_offset64(arg4, arg5)));
+         unlock_user(p, arg2, 0);
+         return ret;
+ #endif
+@@ -12034,7 +12034,7 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,
+     case TARGET_NR_fcntl64:
+     {
+         int cmd;
+-        struct flock64 fl;
++        struct flock fl;
+         from_flock64_fn *copyfrom = copy_from_user_flock64;
+         to_flock64_fn *copyto = copy_to_user_flock64;
+ 
+
diff --git a/srcpkgs/qemu/patches/mmap-mremap-efault.patch b/srcpkgs/qemu/patches/mmap-mremap-efault.patch
deleted file mode 100644
index 5a70e9658b30..000000000000
--- a/srcpkgs/qemu/patches/mmap-mremap-efault.patch
+++ /dev/null
@@ -1,42 +0,0 @@
-Source: @pullmoll
-Upstream: no
-Reason: errno=EFAULT when the address passed to mremap(2) is not valid
-
-See Rich Felker's comment at https://www.openwall.com/lists/musl/2017/06/21/2 for
-why we need to return errno as described in man mremap(2) from qemu-user-static.
-Also speed up the loop when checking for increasing the mappings size to go
-in steps of TARGET_PAGE_SIZE and OR-in a check for the very last byte of the range.
-diff --git linux-user/mmap.c linux-user/mmap.c
-index 7e3b245..1e8d0f1 100644
---- a/linux-user/mmap.c
-+++ b/linux-user/mmap.c
-@@ -738,7 +738,7 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size,
-          !guest_range_valid_untagged(new_addr, new_size)) ||
-         ((flags & MREMAP_MAYMOVE) == 0 &&
-          !guest_range_valid_untagged(old_addr, new_size))) {
--        errno = ENOMEM;
-+        errno = EFAULT;
-         return -1;
-     }
- 
-@@ -775,9 +775,10 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size,
-             abi_ulong addr;
-             for (addr = old_addr + old_size;
-                  addr < old_addr + new_size;
--                 addr++) {
-+                 addr += TARGET_PAGE_SIZE) {
-                 prot |= page_get_flags(addr);
-             }
-+				prot |= page_get_flags(old_addr + new_size - 1);
-         }
-         if (prot == 0) {
-             host_addr = mremap(g2h_untagged(old_addr),
-@@ -796,7 +797,7 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size,
-                 }
-             }
-         } else {
--            errno = ENOMEM;
-+            errno = EFAULT;
-             host_addr = MAP_FAILED;
-         }
-     }
diff --git a/srcpkgs/qemu/patches/musl-initialize-msghdr.patch b/srcpkgs/qemu/patches/musl-initialize-msghdr.patch
index 6d96b3511daf..a88547354c1e 100644
--- a/srcpkgs/qemu/patches/musl-initialize-msghdr.patch
+++ b/srcpkgs/qemu/patches/musl-initialize-msghdr.patch
@@ -1,10 +1,10 @@
 Source: https://github.com/void-linux/void-packages/issues/23557
 
-diff --git linux-user/syscall.c linux-user/syscall.c
-index 945fc25..8d8b68a 100644
+diff --git a/linux-user/syscall.c b/linux-user/syscall.c
+index 14fdebd..de280af 100644
 --- a/linux-user/syscall.c
 +++ b/linux-user/syscall.c
-@@ -3071,7 +3071,7 @@ static abi_long do_sendrecvmsg_locked(int fd, struct target_msghdr *msgp,
+@@ -3229,7 +3229,7 @@ static abi_long do_sendrecvmsg_locked(int fd, struct target_msghdr *msgp,
                                        int flags, int send)
  {
      abi_long ret, len;
diff --git a/srcpkgs/qemu/patches/musl-ppc.patch b/srcpkgs/qemu/patches/musl-ppc.patch
deleted file mode 100644
index 0b77aa8fc63d..000000000000
--- a/srcpkgs/qemu/patches/musl-ppc.patch
+++ /dev/null
@@ -1,25 +0,0 @@
---- a/linux-user/signal.c
-+++ b/linux-user/signal.c
-@@ -21,5 +21,9 @@
- #include "exec/gdbstub.h"
- #include "hw/core/tcg-cpu-ops.h"
- 
-+#if defined(_ARCH_PPC64) && !defined(__GLIBC__) /* musl */
-+#include <asm/ptrace.h>
-+#endif
-+
- #include <sys/ucontext.h>
- #include <sys/resource.h>
---- a/util/mmap-alloc.c
-+++ b/util/mmap-alloc.c
-@@ -25,6 +25,10 @@
- 
- #ifdef CONFIG_LINUX
- #include <sys/vfs.h>
-+/* musl undefs this on ppc and mips */
-+#ifndef MAP_SYNC
-+#define MAP_SYNC 0x80000
-+#endif
- #endif
- 
- size_t qemu_fd_getpagesize(int fd)
diff --git a/srcpkgs/qemu/patches/musl-rlimit-rttime.patch b/srcpkgs/qemu/patches/musl-rlimit-rttime.patch
deleted file mode 100644
index 0cbf9be36a8f..000000000000
--- a/srcpkgs/qemu/patches/musl-rlimit-rttime.patch
+++ /dev/null
@@ -1,13 +0,0 @@
---- a/linux-user/syscall.c
-+++ b/linux-user/syscall.c
-@@ -141,6 +141,10 @@
- #include "fd-trans.h"
- #include "tcg/tcg.h"
- 
-+#ifndef RLIMIT_RTTIME
-+#define RLIMIT_RTTIME 15
-+#endif
-+
- #ifndef CLONE_IO
- #define CLONE_IO                0x80000000      /* Clone io context */
- #endif
diff --git a/srcpkgs/qemu/patches/xxx-ppcle.patch b/srcpkgs/qemu/patches/xxx-ppcle.patch
deleted file mode 100644
index 90b32b5e07cd..000000000000
--- a/srcpkgs/qemu/patches/xxx-ppcle.patch
+++ /dev/null
@@ -1,113 +0,0 @@
-From 7ece08d7902d5a8c007deeb0b75cb533a41dd882 Mon Sep 17 00:00:00 2001
-From: Daniel Kolesa <daniel@octaforge.org>
-Date: Sun, 7 Mar 2021 01:47:42 +0100
-Subject: [PATCH] support ppcle architecture
-
----
- configure                            | 14 ++++++++++++--
- configs/targets/ppcle-linux-user.mak |  4 ++++
- linux-user/ppc/target_syscall.h      |  4 ++++
- scripts/qemu-binfmt-conf.sh          |  6 +++++-
- tests/tcg/configure.sh               |  2 ++
- 5 files changed, 27 insertions(+), 3 deletions(-)
- create mode 100644 configs/targets/ppcle-linux-user.mak
-
-diff --git a/configure b/configure
-index 18c26e0..03d3e18 100755
---- a/configure
-+++ b/configure
-@@ -653,7 +653,11 @@ elif check_define _ARCH_PPC ; then
-       cpu="ppc64"
-     fi
-   else
--    cpu="ppc"
-+    if check_define _LITTLE_ENDIAN ; then
-+      cpu="ppcle"
-+    else
-+      cpu="ppc"
-+    fi
-   fi
- elif check_define __mips__ ; then
-   cpu="mips"
-@@ -638,6 +642,9 @@
- 
-   ppc)
-     CPU_CFLAGS="-m32" ;;
-+  ppcle)
-+    cpu="ppc"
-+    CPU_CFLAGS="-m32 -mlittle-endian" ;;
-   ppc64)
-     CPU_CFLAGS="-m64 -mbig-endian" ;;
-   ppc64le)
-diff --git a/configs/targets/ppcle-linux-user.mak b/configs/targets/ppcle-linux-user.mak
-new file mode 100644
-index 0000000..2259243
---- /dev/null
-+++ b/configs/targets/ppcle-linux-user.mak
-@@ -0,0 +1,4 @@
-+TARGET_ARCH=ppc
-+TARGET_SYSTBL_ABI=common,nospu,32
-+TARGET_SYSTBL=syscall.tbl
-+TARGET_XML_FILES= gdb-xml/power-core.xml gdb-xml/power-fpu.xml gdb-xml/power-altivec.xml gdb-xml/power-spe.xml
-diff --git a/linux-user/ppc/target_syscall.h b/linux-user/ppc/target_syscall.h
-index b9c4b81..cf26497 100644
---- a/linux-user/ppc/target_syscall.h
-+++ b/linux-user/ppc/target_syscall.h
-@@ -65,7 +65,11 @@ struct target_revectored_struct {
- #define UNAME_MACHINE "ppc64le"
- #endif
- #else
-+#if TARGET_BIG_ENDIAN
- #define UNAME_MACHINE "ppc"
-+#else
-+#define UNAME_MACHINE "ppcle"
-+#endif
- #endif
- #define UNAME_MINIMUM_RELEASE "2.6.32"
- 
-diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh
-index 9f1580a..393943f 100755
---- a/scripts/qemu-binfmt-conf.sh
-+++ b/scripts/qemu-binfmt-conf.sh
-@@ -46,6 +46,10 @@ ppc_magic='\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x
- ppc_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
- ppc_family=ppc
- 
-+ppcle_magic='\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x14\x00'
-+ppcle_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\x00'
-+ppc_family=ppcle
-+
- ppc64_magic='\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x15'
- ppc64_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
- ppc64_family=ppc
-@@ -148,7 +152,7 @@ qemu_get_family() {
-     "Power Macintosh"|ppc64|powerpc|ppc)
-         echo "ppc"
-         ;;
--    ppc64el|ppc64le)
-+    ppc64el|ppc64le|ppcel|ppcle)
-         echo "ppcle"
-         ;;
-     arm|armel|armhf|arm64|armv[4-9]*l|aarch64)
-diff --git a/configure b/configure
-index 72ab03f11a..0691929d76 100755
---- a/configure
-+++ b/configure
-@@ -1866,6 +1866,7 @@ fi
- : ${cross_prefix_mips="mips-linux-gnu-"}
- : ${cross_prefix_nios2="nios2-linux-gnu-"}
- : ${cross_prefix_ppc="powerpc-linux-gnu-"}
-+: ${cross_prefix_ppcle="powerpcle-linux-gnu-"}
- : ${cross_prefix_ppc64="powerpc64-linux-gnu-"}
- : ${cross_prefix_ppc64le="$cross_prefix_ppc64"}
- : ${cross_prefix_riscv64="riscv64-linux-gnu-"}
-@@ -1883,6 +1884,7 @@ fi
- : ${cross_cc_cflags_hexagon="-mv67 -O2 -static"}
- : ${cross_cc_cflags_i386="-m32"}
- : ${cross_cc_cflags_ppc="-m32 -mbig-endian"}
-+: ${cross_cc_cflags_ppcle="-m32"}
- : ${cross_cc_cflags_ppc64="-m64 -mbig-endian"}
- : ${cross_cc_ppc64le="$cross_cc_ppc64"}
- : ${cross_cc_cflags_ppc64le="-m64 -mlittle-endian"}
-2.30.1
-
diff --git a/srcpkgs/qemu/template b/srcpkgs/qemu/template
index 48ab199e5686..c64664055bf9 100644
--- a/srcpkgs/qemu/template
+++ b/srcpkgs/qemu/template
@@ -1,8 +1,8 @@
 # Template file for 'qemu'
 # This package should be updated together with qemu-user-static
 pkgname=qemu
-version=7.1.0
-revision=2
+version=8.0.3
+revision=1
 build_style=configure
 configure_args="--prefix=/usr --sysconfdir=/etc --libexecdir=/usr/libexec --localstatedir=/var
  --disable-glusterfs --disable-xen --enable-docs --enable-kvm --enable-libusb --enable-pie
@@ -10,10 +10,10 @@ configure_args="--prefix=/usr --sysconfdir=/etc --libexecdir=/usr/libexec --loca
  --audio-drv-list=alsa$(vopt_if sdl2 ,sdl)$(vopt_if jack ,jack)$(vopt_if pulseaudio ,pa)
  $(vopt_enable opengl) $(vopt_enable pulseaudio pa) $(vopt_enable sdl2 sdl) $(vopt_enable smartcard)
  $(vopt_enable spice) $(vopt_enable virgl virglrenderer) $(vopt_if gtk3 '--enable-gtk')"
-hostmakedepends="gettext pkg-config perl python3 python3-Sphinx python3-sphinx_rtd_theme ninja"
+hostmakedepends="flex gettext glib-devel pkg-config perl python3 python3-Sphinx python3-sphinx_rtd_theme ninja"
 makedepends="capstone-devel dtc-devel libpng-devel libjpeg-turbo-devel pixman-devel
- snappy-devel libuuid-devel libX11-devel alsa-lib-devel libaio-devel gnutls-devel
- libsasl-devel libglib-devel ncurses-devel libseccomp-devel nss-devel
+ snappy-devel libuuid-devel libX11-devel alsa-lib-devel libaio-devel
+ gnutls-devel libsasl-devel ncurses-devel libseccomp-devel nss-devel
  libcurl-devel xfsprogs-devel libcap-ng-devel vde2-devel usbredir-devel
  libbluetooth-devel libssh2-devel libusb-devel libnfs-devel libslirp-devel
  libxkbcommon-devel libzstd-devel $(vopt_if sdl2 'SDL2-devel SDL2_image-devel')
@@ -25,17 +25,17 @@ makedepends="capstone-devel dtc-devel libpng-devel libjpeg-turbo-devel pixman-de
  $(vopt_if jack 'jack-devel') $(vopt_if pulseaudio 'pulseaudio-devel')"
 short_desc="Open Source Processor Emulator"
 maintainer="Orphaned <orphan@voidlinux.org>"
-license="GPL-2.0-or-later, LGPL-2.1-or-later"
+license="GPL-2.0-only, LGPL-2.1-only"
 homepage="https://www.qemu.org"
 distfiles="https://wiki.qemu.org/download/qemu-${version}.tar.bz2"
-checksum=f7ac2b85b3f1831e6810b140306e30af91556e15784864b209f3942858947fd0
+checksum=bb7113cd3761927621df11ec7f7ad438f868e1815f46f5dddf46a14ceb77e8e6
 ignore_elf_dirs="/usr/share/qemu"
 nostrip_files="hppa-firmware.img openbios-ppc openbios-sparc32 openbios-sparc64
  palcode-clipper s390-ccw.img s390-netboot.img u-boot.e500 opensbi-riscv32-generic-fw_dynamic.elf
  opensbi-riscv64-generic-fw_dynamic.elf"
 
-build_options="gtk3 opengl sdl2 spice virgl smartcard numa iscsi jack pulseaudio"
-build_options_default="opengl gtk3 virgl sdl2 numa iscsi jack pulseaudio"
+build_options="gtk3 iscsi jack numa opengl pulseaudio sdl2 smartcard spice virgl"
+build_options_default="gtk3 iscsi jack numa opengl pulseaudio sdl2 smartcard spice virgl"
 desc_option_sdl2="Enable SDL (2.x) video output"
 desc_option_spice="Enable support for SPICE"
 desc_option_virgl="Enable support for VirGL (A Virtual 3D GPU renderer)"
@@ -43,37 +43,10 @@ desc_option_smartcard="Enable smartcard support"
 desc_option_numa="Enable support for host NUMA"
 desc_option_iscsi="Enable support for iSCSI"
 
-case "$XBPS_TARGET_MACHINE" in
-	aarch64-musl) CFLAGS="-D_LINUX_SYSINFO_H";;
-esac
-
-if [ "$XBPS_TARGET_ENDIAN" = "le" ]; then
-	build_options_default+=" spice"
-fi
-
 if [ "$CROSS_BUILD" ]; then
-	configure_args+=" --cross-prefix=${XBPS_CROSS_TRIPLET}-"
-else
-	build_options_default+=" smartcard"
-fi
-
-if [ "$XBPS_CHECK_PKGS" != full ]; then
-	make_check_target=check-unit
+	configure_args+=" --cross-prefix=${XBPS_CROSS_TRIPLET}"
 fi
 
-post_extract() {
-	if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
-		grep -rl 'Input/output error' tests/qemu-iotests |
-			xargs -n1 sed -i -e 's;Input/output error;I/O error;g'
-		grep -rl 'Operation not supported' tests/qemu-iotests |
-			xargs -n1 sed -i -e 's;Operation not supported;Not supported;g'
-	fi
-}
-
-pre_configure() {
-	unset CPP
-}
-
 post_install() {
 	vdoc "${FILESDIR}/README.voidlinux"
 

From 2b8794f75865ce0e8cd737bd848671fe5ad988fe Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Cerqueira?= <acerqueira021@gmail.com>
Date: Mon, 3 Jul 2023 18:41:30 +0100
Subject: [PATCH 2/2] qemu-user-static: update to 8.0.3.

---
 srcpkgs/qemu-user-static/template | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/srcpkgs/qemu-user-static/template b/srcpkgs/qemu-user-static/template
index 2a8da9b53f2d..ed2734e9aebd 100644
--- a/srcpkgs/qemu-user-static/template
+++ b/srcpkgs/qemu-user-static/template
@@ -1,20 +1,20 @@
 # Template file for 'qemu-user-static'
 # This package should be updated together with qemu
 pkgname=qemu-user-static
-version=7.1.0
-revision=3
+version=8.0.3
+revision=1
 build_style=configure
 configure_args="--prefix=/usr --sysconfdir=/etc --libexecdir=/usr/libexec
  --disable-kvm --disable-png --disable-virtfs --disable-fdt --disable-seccomp
  --enable-linux-user --disable-system --static --disable-pie"
-hostmakedepends="pkg-config perl python3 ninja"
+hostmakedepends="flex glib-devel pkg-config perl python3 ninja"
 makedepends="dtc-devel libglib-devel pixman-devel libuuid-devel"
 short_desc="QEMU User-mode emulators (statically compiled)"
 maintainer="Orphaned <orphan@voidlinux.org>"
-license="GPL-2.0-or-later, LGPL-2.1-or-later"
+license="GPL-2.0-only, LGPL-2.1-only"
 homepage="https://www.qemu.org"
 distfiles="https://wiki.qemu.org/download/qemu-${version}.tar.bz2"
-checksum=f7ac2b85b3f1831e6810b140306e30af91556e15784864b209f3942858947fd0
+checksum=bb7113cd3761927621df11ec7f7ad438f868e1815f46f5dddf46a14ceb77e8e6
 
 _fmts="aarch64 aarch64_be alpha arm armeb cris hppa i386 m68k microblaze
  microblazeel mips mipsel mips64 mips64el mipsn32 mipsn32el or1k
@@ -111,10 +111,6 @@ done
 
 binfmts="${binfmts%?}"
 
-pre_configure() {
-	unset CPP
-}
-
 post_install() {
 	# Remove unneeded stuff.
 	rm -rf ${DESTDIR}/etc ${DESTDIR}/usr/share ${DESTDIR}/usr/libexec

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: qemu: update to 8.0.3.
  2023-07-03 17:50 [PR PATCH] qemu: update to 8.0.2 motorto
                   ` (16 preceding siblings ...)
  2023-07-18 14:17 ` [PR PATCH] [Updated] " motorto
@ 2023-07-18 14:23 ` motorto
  2023-07-19 14:49 ` JamiKettunen
                   ` (20 subsequent siblings)
  38 siblings, 0 replies; 40+ messages in thread
From: motorto @ 2023-07-18 14:23 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 899 bytes --]

New comment by motorto on void-packages repository

https://github.com/void-linux/void-packages/pull/44822#issuecomment-1640328145

Comment:
> ~Looks like something might've happened upstream fixing this even on the old musl 1.1, will bisect https://gitlab.com/qemu-project/qemu/-/compare/887cba8...361d539 for the commit we could include until a new tag.~
> 
> ~https://gitlab.com/qemu-project/qemu/-/commit/d28b3c9 (`linux-user: Make sure initial brk(0) is page-aligned`) stuck out to me just looking at it and that looks to fix the issue :)~
> 
> it's already getting superseded by https://patchwork.kernel.org/project/qemu-devel/cover/20230717213545.142598-1-deller@gmx.de/

> This issue has been fixed in master already and even in 8.0.3 stable release
(I haven't checked which commit did that, though).

Updated this PR to 8.0.3 could you check if qemu-user-static works properly now

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: qemu: update to 8.0.3.
  2023-07-03 17:50 [PR PATCH] qemu: update to 8.0.2 motorto
                   ` (17 preceding siblings ...)
  2023-07-18 14:23 ` qemu: update to 8.0.3 motorto
@ 2023-07-19 14:49 ` JamiKettunen
  2023-07-19 17:02 ` motorto
                   ` (19 subsequent siblings)
  38 siblings, 0 replies; 40+ messages in thread
From: JamiKettunen @ 2023-07-19 14:49 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 470 bytes --]

New comment by JamiKettunen on void-packages repository

https://github.com/void-linux/void-packages/pull/44822#issuecomment-1642236312

Comment:
Seems to work now for https://repo-default.voidlinux.org/live/current/void-aarch64-musl-ROOTFS-20230628.tar.xz, the patch I mentioned and later strikethrough'd actually was correct as per https://patchwork.kernel.org/project/qemu-devel/patch/20230717213545.142598-2-deller@gmx.de/#25429464, so it's fine to add it here imo.

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: qemu: update to 8.0.3.
  2023-07-03 17:50 [PR PATCH] qemu: update to 8.0.2 motorto
                   ` (18 preceding siblings ...)
  2023-07-19 14:49 ` JamiKettunen
@ 2023-07-19 17:02 ` motorto
  2023-07-19 17:04 ` [PR PATCH] [Updated] " motorto
                   ` (18 subsequent siblings)
  38 siblings, 0 replies; 40+ messages in thread
From: motorto @ 2023-07-19 17:02 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 179 bytes --]

New comment by motorto on void-packages repository

https://github.com/void-linux/void-packages/pull/44822#issuecomment-1642445591

Comment:
That line is already in 8.0.3 release

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [PR PATCH] [Updated] qemu: update to 8.0.3.
  2023-07-03 17:50 [PR PATCH] qemu: update to 8.0.2 motorto
                   ` (19 preceding siblings ...)
  2023-07-19 17:02 ` motorto
@ 2023-07-19 17:04 ` motorto
  2023-07-19 17:13 ` JamiKettunen
                   ` (17 subsequent siblings)
  38 siblings, 0 replies; 40+ messages in thread
From: motorto @ 2023-07-19 17:04 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1827 bytes --]

There is an updated pull request by motorto against master on the void-packages repository

https://github.com/motorto/void-packages qemu-8.0.2
https://github.com/void-linux/void-packages/pull/44822

qemu: update to 8.0.3.
<!-- Uncomment relevant sections and delete options which are not applicable -->
[ci-skip] 

Draft because of: https://github.com/void-linux/void-packages/pull/44822#issuecomment-1633611714


#### Testing the changes
- I tested the changes in this PR: **YES**, runned a Windows vm machine and it worked fine.

Removed a bunch of patches that in my research are no longer needed:

- Removed all ppc related patches since that arch isn't no longer supported.
- gcc12.patch: because it builds fine now in this version
- fix-softfloat-fesetround.patch: don't have a system to try it, but alpine doesn't have any patch related to this)
- mmap-mremap-efaul: not sure about if we should keep this one

Kept this patches:

- musl-initialize-msghdr.patch: just update in order to apply.

Added this ones:

- ~~CVE-2023-2861.patch~~
- ~~keymap.patch: xkeyboard-config 2.39 removed the legacy alias of ar -> ara~~
- fix-brk0.patch: make sure that initial brk(0) is page-aligned
- lfs64.patch: Builds defines -D_FILE_OFFSET_BITS=64 which makes the original functions
anf macros behave same as their 64 suffixed counterparts. This also
helps in compiling with latest musl C library, where these macros and
functions are no more available under _GNU_SOURCE feature macro

#### Local build testing
- I built this PR locally for my native architecture, x86-64-glibc
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl (cross)
  - x86_64-musl



A patch file from https://github.com/void-linux/void-packages/pull/44822.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-qemu-8.0.2-44822.patch --]
[-- Type: text/x-diff, Size: 34157 bytes --]

From 8528da351c2d425c76729063c0ed409bc26f3c5a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Cerqueira?= <acerqueira021@gmail.com>
Date: Mon, 3 Jul 2023 18:41:12 +0100
Subject: [PATCH 1/2] qemu: update to 8.0.3.

---
 .../qemu/patches/fix-linux-user-ppc32.patch   | 117 ----------
 .../patches/fix-softfloat-fesetround.patch    |  39 ----
 srcpkgs/qemu/patches/gcc12.patch              |  72 ------
 srcpkgs/qemu/patches/lfs64.patch              | 213 ++++++++++++++++++
 srcpkgs/qemu/patches/mmap-mremap-efault.patch |  42 ----
 .../qemu/patches/musl-initialize-msghdr.patch |   6 +-
 srcpkgs/qemu/patches/musl-ppc.patch           |  25 --
 srcpkgs/qemu/patches/musl-rlimit-rttime.patch |  13 --
 srcpkgs/qemu/patches/xxx-ppcle.patch          | 113 ----------
 srcpkgs/qemu/template                         |  47 +---
 10 files changed, 226 insertions(+), 461 deletions(-)
 delete mode 100644 srcpkgs/qemu/patches/fix-linux-user-ppc32.patch
 delete mode 100644 srcpkgs/qemu/patches/fix-softfloat-fesetround.patch
 delete mode 100644 srcpkgs/qemu/patches/gcc12.patch
 create mode 100644 srcpkgs/qemu/patches/lfs64.patch
 delete mode 100644 srcpkgs/qemu/patches/mmap-mremap-efault.patch
 delete mode 100644 srcpkgs/qemu/patches/musl-ppc.patch
 delete mode 100644 srcpkgs/qemu/patches/musl-rlimit-rttime.patch
 delete mode 100644 srcpkgs/qemu/patches/xxx-ppcle.patch

diff --git a/srcpkgs/qemu/patches/fix-linux-user-ppc32.patch b/srcpkgs/qemu/patches/fix-linux-user-ppc32.patch
deleted file mode 100644
index cd47435d5aa9..000000000000
--- a/srcpkgs/qemu/patches/fix-linux-user-ppc32.patch
+++ /dev/null
@@ -1,117 +0,0 @@
-commit 37814f62c2cc7aba2eea073014d6c53dcd5bf42c
-Author: q66 <daniel@octaforge.org>
-Date:   Fri Jul 1 16:53:55 2022 +0200
-
-    fix linux-user build on 32-bit ppc
-    
-    Partial revert https://gitlab.com/qemu-project/qemu/-/commit/9d1401b79463e74adbfac69d836789d4e103fb61
-    and https://gitlab.com/qemu-project/qemu/-/commit/0a7e01904d407baa73c1baddbdfc9ccf2ace8356
-
-diff --git a/common-user/host/ppc/safe-syscall.inc.S b/common-user/host/ppc/safe-syscall.inc.S
-new file mode 100644
-index 0000000..e69de29
-diff --git a/common-user/safe-syscall-error.c b/common-user/safe-syscall-error.c
-index cf74b50..a36132c 100644
---- a/common-user/safe-syscall-error.c
-+++ b/common-user/safe-syscall-error.c
-@@ -12,6 +12,7 @@
- #include "qemu/osdep.h"
- #include "user/safe-syscall.h"
- 
-+#if !defined(__powerpc__) || defined(__powerpc64__)
- /*
-  * This is intended to be invoked via tail-call on the error path
-  * from the assembly in host/arch/safe-syscall.inc.S.  This takes
-@@ -23,3 +24,4 @@ long safe_syscall_set_errno_tail(int value)
-     errno = value;
-     return -1;
- }
-+#endif
-diff --git a/include/user/safe-syscall.h b/include/user/safe-syscall.h
-index 61a04e2..793fe84 100644
---- a/include/user/safe-syscall.h
-+++ b/include/user/safe-syscall.h
-@@ -125,6 +125,8 @@
-  * kinds of restartability.
-  */
- 
-+#if !defined(__powerpc__) || defined(__powerpc64__)
-+
- /* The core part of this function is implemented in assembly */
- extern long safe_syscall_base(int *pending, long number, ...);
- extern long safe_syscall_set_errno_tail(int value);
-@@ -137,4 +139,10 @@ extern char safe_syscall_end[];
-     safe_syscall_base(&((TaskState *)thread_cpu->opaque)->signal_pending, \
-                       __VA_ARGS__)
- 
-+#else
-+
-+#define safe_syscall syscall
-+
-+#endif
-+
- #endif
-diff --git a/linux-user/include/host/ppc/host-signal.h b/linux-user/include/host/ppc/host-signal.h
-new file mode 100644
-index 0000000..b80384d
---- /dev/null
-+++ b/linux-user/include/host/ppc/host-signal.h
-@@ -0,0 +1,38 @@
-+/*
-+ * host-signal.h: signal info dependent on the host architecture
-+ *
-+ * Copyright (c) 2003-2005 Fabrice Bellard
-+ * Copyright (c) 2021 Linaro Limited
-+ *
-+ * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
-+ * See the COPYING file in the top-level directory.
-+ */
-+
-+#ifndef PPC_HOST_SIGNAL_H
-+#define PPC_HOST_SIGNAL_H
-+
-+/* The third argument to a SA_SIGINFO handler is ucontext_t. */
-+typedef ucontext_t host_sigcontext;
-+
-+static inline uintptr_t host_signal_pc(host_sigcontext *uc)
-+{
-+    return uc->uc_mcontext.regs->nip;
-+}
-+
-+static inline void host_signal_set_pc(host_sigcontext *uc, uintptr_t pc)
-+{
-+    uc->uc_mcontext.regs->nip = pc;
-+}
-+
-+static inline void *host_signal_mask(host_sigcontext *uc)
-+{
-+    return &uc->uc_sigmask;
-+}
-+
-+static inline bool host_signal_write(siginfo_t *info, host_sigcontext *uc)
-+{
-+    return uc->uc_mcontext.regs->trap != 0x400
-+        && (uc->uc_mcontext.regs->dsisr & 0x02000000);
-+}
-+
-+#endif
-diff --git a/linux-user/signal.c b/linux-user/signal.c
-index 092e70b..b8dfa8a 100644
---- a/linux-user/signal.c
-+++ b/linux-user/signal.c
-@@ -800,6 +800,7 @@ void queue_signal(CPUArchState *env, int sig, int si_type,
- /* Adjust the signal context to rewind out of safe-syscall if we're in it */
- static inline void rewind_if_in_safe_syscall(void *puc)
- {
-+#if !defined(__powerpc__) || defined(__powerpc64__)
-     host_sigcontext *uc = (host_sigcontext *)puc;
-     uintptr_t pcreg = host_signal_pc(uc);
- 
-@@ -807,6 +808,7 @@ static inline void rewind_if_in_safe_syscall(void *puc)
-         && pcreg < (uintptr_t)safe_syscall_end) {
-         host_signal_set_pc(uc, (uintptr_t)safe_syscall_start);
-     }
-+#endif
- }
- 
- static void host_signal_handler(int host_sig, siginfo_t *info, void *puc)
diff --git a/srcpkgs/qemu/patches/fix-softfloat-fesetround.patch b/srcpkgs/qemu/patches/fix-softfloat-fesetround.patch
deleted file mode 100644
index ecdd049f7921..000000000000
--- a/srcpkgs/qemu/patches/fix-softfloat-fesetround.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-Source: @pullmoll
-Upstream: no
-Reason: Target architectures with soft float do not define these constants.
-
---- a/tests/fp/fp-bench.c	2020-12-08 17:59:44.000000000 +0100
-+++ b/tests/fp/fp-bench.c	2020-12-12 20:38:40.702235420 +0100
-@@ -485,16 +485,32 @@
- 
-     switch (rounding) {
-     case ROUND_EVEN:
-+#if defined(FE_TONEAREST)
-         rhost = FE_TONEAREST;
-+#else
-+	return;
-+#endif
-         break;
-     case ROUND_ZERO:
-+#if defined(FE_TOWARDZERO)
-         rhost = FE_TOWARDZERO;
-+#else
-+	return;
-+#endif
-         break;
-     case ROUND_DOWN:
-+#if defined(FE_DOWNWARD)
-         rhost = FE_DOWNWARD;
-+#else
-+	return;
-+#endif
-         break;
-     case ROUND_UP:
-+#if defined(FE_UPWARD)
-         rhost = FE_UPWARD;
-+#else
-+	return;
-+#endif
-         break;
-     case ROUND_TIEAWAY:
-         die_host_rounding(rounding);
diff --git a/srcpkgs/qemu/patches/gcc12.patch b/srcpkgs/qemu/patches/gcc12.patch
deleted file mode 100644
index 2a4b2bd03609..000000000000
--- a/srcpkgs/qemu/patches/gcc12.patch
+++ /dev/null
@@ -1,72 +0,0 @@
-From 5cb993ff131fca2abef3ce074a20258fd6fce557 Mon Sep 17 00:00:00 2001
-From: Bernhard Beschow <shentey@gmail.com>
-Date: Sat, 18 Mar 2023 19:59:31 +0100
-Subject: [PATCH] qemu/osdep: Switch position of "extern" and "G_NORETURN"
-
-Fixes the Windows build under msys2 using GCC 12 which fails with the following
-error:
-
-  [184/579] Compiling C++ object qga/vss-win32/qga-vss.dll.p/install.cpp.obj
-  FAILED: qga/vss-win32/qga-vss.dll.p/install.cpp.obj
-  "c++" "-m64" "-mcx16" "-Iqga/vss-win32/qga-vss.dll.p" "-Iqga/vss-win32" "-I../src/qga/vss-win32" "-I." "-Iqapi" "-Itrace" "-Iui" "-Iui/shader" "-IC:/msys64/mingw64/include/glib-2.0" "-IC:/msys64/mingw64/lib/glib-2.0/include" "-fdiagnostics-color=auto" "-Wall" "-Winvalid-pch" "-Wnon-virtual-dtor" "-Werror" "-std=gnu++11" "-g" "-iquote" "." "-iquote" "C:/msys64/home/shentey/Projects/qemu/src" "-iquote" "C:/msys64/home/shentey/Projects/qemu/src/include" "-iquote" "C:/msys64/home/shentey/Projects/qemu/src/tcg/i386" "-D__STDC_LIMIT_MACROS" "-D__STDC_CONSTANT_MACROS" "-D__STDC_FORMAT_MACROS" "-fno-pie" "-no-pie" "-D_GNU_SOURCE" "-D_FILE_OFFSET_BITS=64" "-D_LARGEFILE_SOURCE" "-fno-strict-aliasing" "-fno-common" "-fwrapv" "-Wundef" "-Wwrite-strings" "-Wtype-limits" "-Wformat-security" "-Wformat-y2k" "-Winit-self" "-Wignored-qualifiers" "-Wempty-body" "-Wendif-labels" "-Wexpansion-to-defined" "-Wimplicit-fallthrough=2" "-Wmissing-format-attribute" "-Wno-missing-include-dirs" "-Wno-shift-negative-value" "-Wno-psabi" "-fstack-protector-strong" "-Wno-unknown-pragmas" "-Wno-delete-non-virtual-dtor" "-Wno-non-virtual-dtor" -MD -MQ qga/vss-win32/qga-vss.dll.p/install.cpp.obj -MF "qga/vss-win32/qga-vss.dll.p/install.cpp.obj.d" -o qga/vss-win32/qga-vss.dll.p/install.cpp.obj "-c" ../src/qga/vss-win32/install.cpp
-  In file included from C:/msys64/mingw64/lib/glib-2.0/include/glibconfig.h:9,
-              from C:/msys64/mingw64/include/glib-2.0/glib/gtypes.h:34,
-              from C:/msys64/mingw64/include/glib-2.0/glib/galloca.h:34,
-              from C:/msys64/mingw64/include/glib-2.0/glib.h:32,
-              from C:/msys64/home/shentey/Projects/qemu/src/include/glib-compat.h:32,
-              from C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:144,
-              from ../src/qga/vss-win32/install.cpp:13:
-  C:/msys64/mingw64/include/glib-2.0/glib/gmacros.h:1075:21: error: standard attributes in middle of decl-specifiers
-  1075 | # define G_NORETURN [[noreturn]]
-        |                     ^
-  C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:240:8: note: in expansion of macro 'G_NORETURN'
-  240 | extern G_NORETURN
-        |        ^~~~~~~~~~
-  C:/msys64/mingw64/include/glib-2.0/glib/gmacros.h:1075:21: note: standard attributes must precede the decl-specifiers to apply to the declaration, or follow them to apply to the type
-  1075 | # define G_NORETURN [[noreturn]]
-        |                     ^
-  C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:240:8: note: in expansion of macro 'G_NORETURN'
-  240 | extern G_NORETURN
-        |        ^~~~~~~~~~
-  C:/msys64/mingw64/include/glib-2.0/glib/gmacros.h:1075:21: error: attribute ignored [-Werror=attributes]
-  1075 | # define G_NORETURN [[noreturn]]
-        |                     ^
-  C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:240:8: note: in expansion of macro 'G_NORETURN'
-  240 | extern G_NORETURN
-        |        ^~~~~~~~~~
-  C:/msys64/mingw64/include/glib-2.0/glib/gmacros.h:1075:21: note: an attribute that appertains to a type-specifier is ignored
-  1075 | # define G_NORETURN [[noreturn]]
-        |                     ^
-  C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:240:8: note: in expansion of macro 'G_NORETURN'
-  240 | extern G_NORETURN
-        |        ^~~~~~~~~~
-  cc1plus.exe: all warnings being treated as errors
-
-Apparently it also fixes the compilation with Clang 15 (see
-https://gitlab.com/qemu-project/qemu/-/issues/1541 ).
-
-Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1541
-Signed-off-by: Bernhard Beschow <shentey@gmail.com>
-Message-Id: <20230318185931.181659-1-shentey@gmail.com>
-Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
-Signed-off-by: Thomas Huth <thuth@redhat.com>
----
- include/qemu/osdep.h | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
-index f68b5d8708c..9eff0be95bd 100644
---- a/include/qemu/osdep.h
-+++ b/include/qemu/osdep.h
-@@ -237,7 +237,7 @@ extern "C" {
-  * supports QEMU_ERROR, this will be reported at compile time; otherwise
-  * this will be reported at link time due to the missing symbol.
-  */
--extern G_NORETURN
-+G_NORETURN extern
- void QEMU_ERROR("code path is reachable")
-     qemu_build_not_reached_always(void);
- #if defined(__OPTIMIZE__) && !defined(__NO_INLINE__)
--- 
-GitLab
-
diff --git a/srcpkgs/qemu/patches/lfs64.patch b/srcpkgs/qemu/patches/lfs64.patch
new file mode 100644
index 000000000000..35d09ef028df
--- /dev/null
+++ b/srcpkgs/qemu/patches/lfs64.patch
@@ -0,0 +1,213 @@
+Builds defines -D_FILE_OFFSET_BITS=64 which makes the original functions
+anf macros behave same as their 64 suffixed counterparts. This also
+helps in compiling with latest musl C library, where these macros and
+functions are no more available under _GNU_SOURCE feature macro
+
+source: https://git.alpinelinux.org/aports/plain/community/qemu/lfs64.patch
+--
+
+diff --git a/linux-user/syscall.c b/linux-user/syscall.c
+index bbba2a6..38fa09a 100644
+--- a/linux-user/syscall.c
++++ b/linux-user/syscall.c
+@@ -6812,13 +6812,13 @@ static int target_to_host_fcntl_cmd(int cmd)
+         ret = cmd;
+         break;
+     case TARGET_F_GETLK:
+-        ret = F_GETLK64;
++        ret = F_GETLK;
+         break;
+     case TARGET_F_SETLK:
+-        ret = F_SETLK64;
++        ret = F_SETLK;
+         break;
+     case TARGET_F_SETLKW:
+-        ret = F_SETLKW64;
++        ret = F_SETLKW;
+         break;
+     case TARGET_F_GETOWN:
+         ret = F_GETOWN;
+@@ -6834,13 +6834,13 @@ static int target_to_host_fcntl_cmd(int cmd)
+         break;
+ #if TARGET_ABI_BITS == 32
+     case TARGET_F_GETLK64:
+-        ret = F_GETLK64;
++        ret = F_GETLK;
+         break;
+     case TARGET_F_SETLK64:
+-        ret = F_SETLK64;
++        ret = F_SETLK;
+         break;
+     case TARGET_F_SETLKW64:
+-        ret = F_SETLKW64;
++        ret = F_SETLKW;
+         break;
+ #endif
+     case TARGET_F_SETLEASE:
+@@ -6894,8 +6894,8 @@ static int target_to_host_fcntl_cmd(int cmd)
+      * them to 5, 6 and 7 before making the syscall(). Since we make the
+      * syscall directly, adjust to what is supported by the kernel.
+      */
+-    if (ret >= F_GETLK64 && ret <= F_SETLKW64) {
+-        ret -= F_GETLK64 - 5;
++    if (ret >= F_GETLK && ret <= F_SETLKW) {
++        ret -= F_GETLK - 5;
+     }
+ #endif
+ 
+@@ -6928,7 +6928,7 @@ static int host_to_target_flock(int type)
+     return type;
+ }
+ 
+-static inline abi_long copy_from_user_flock(struct flock64 *fl,
++static inline abi_long copy_from_user_flock(struct flock *fl,
+                                             abi_ulong target_flock_addr)
+ {
+     struct target_flock *target_fl;
+@@ -6953,7 +6953,7 @@ static inline abi_long copy_from_user_flock(struct flock64 *fl,
+ }
+ 
+ static inline abi_long copy_to_user_flock(abi_ulong target_flock_addr,
+-                                          const struct flock64 *fl)
++                                          const struct flock *fl)
+ {
+     struct target_flock *target_fl;
+     short l_type;
+@@ -6972,8 +6972,8 @@ static inline abi_long copy_to_user_flock(abi_ulong target_flock_addr,
+     return 0;
+ }
+ 
+-typedef abi_long from_flock64_fn(struct flock64 *fl, abi_ulong target_addr);
+-typedef abi_long to_flock64_fn(abi_ulong target_addr, const struct flock64 *fl);
++typedef abi_long from_flock64_fn(struct flock *fl, abi_ulong target_addr);
++typedef abi_long to_flock64_fn(abi_ulong target_addr, const struct flock *fl);
+ 
+ #if defined(TARGET_ARM) && TARGET_ABI_BITS == 32
+ struct target_oabi_flock64 {
+@@ -6984,7 +6984,7 @@ struct target_oabi_flock64 {
+     abi_int   l_pid;
+ } QEMU_PACKED;
+ 
+-static inline abi_long copy_from_user_oabi_flock64(struct flock64 *fl,
++static inline abi_long copy_from_user_oabi_flock64(struct flock *fl,
+                                                    abi_ulong target_flock_addr)
+ {
+     struct target_oabi_flock64 *target_fl;
+@@ -7009,7 +7009,7 @@ static inline abi_long copy_from_user_oabi_flock64(struct flock64 *fl,
+ }
+ 
+ static inline abi_long copy_to_user_oabi_flock64(abi_ulong target_flock_addr,
+-                                                 const struct flock64 *fl)
++                                                 const struct flock *fl)
+ {
+     struct target_oabi_flock64 *target_fl;
+     short l_type;
+@@ -7029,7 +7029,7 @@ static inline abi_long copy_to_user_oabi_flock64(abi_ulong target_flock_addr,
+ }
+ #endif
+ 
+-static inline abi_long copy_from_user_flock64(struct flock64 *fl,
++static inline abi_long copy_from_user_flock64(struct flock *fl,
+                                               abi_ulong target_flock_addr)
+ {
+     struct target_flock64 *target_fl;
+@@ -7054,7 +7054,7 @@ static inline abi_long copy_from_user_flock64(struct flock64 *fl,
+ }
+ 
+ static inline abi_long copy_to_user_flock64(abi_ulong target_flock_addr,
+-                                            const struct flock64 *fl)
++                                            const struct flock *fl)
+ {
+     struct target_flock64 *target_fl;
+     short l_type;
+@@ -7075,7 +7075,7 @@ static inline abi_long copy_to_user_flock64(abi_ulong target_flock_addr,
+ 
+ static abi_long do_fcntl(int fd, int cmd, abi_ulong arg)
+ {
+-    struct flock64 fl64;
++    struct flock fl64;
+ #ifdef F_GETOWN_EX
+     struct f_owner_ex fox;
+     struct target_f_owner_ex *target_fox;
+@@ -7347,7 +7347,7 @@ static inline abi_long target_truncate64(CPUArchState *cpu_env, const char *arg1
+         arg2 = arg3;
+         arg3 = arg4;
+     }
+-    return get_errno(truncate64(arg1, target_offset64(arg2, arg3)));
++    return get_errno(truncate(arg1, target_offset64(arg2, arg3)));
+ }
+ #endif
+ 
+@@ -7361,7 +7361,7 @@ static inline abi_long target_ftruncate64(CPUArchState *cpu_env, abi_long arg1,
+         arg2 = arg3;
+         arg3 = arg4;
+     }
+-    return get_errno(ftruncate64(arg1, target_offset64(arg2, arg3)));
++    return get_errno(ftruncate(arg1, target_offset64(arg2, arg3)));
+ }
+ #endif
+ 
+@@ -8597,7 +8597,7 @@ static int do_getdents(abi_long dirfd, abi_long arg2, abi_long count)
+     void *tdirp;
+     int hlen, hoff, toff;
+     int hreclen, treclen;
+-    off64_t prev_diroff = 0;
++    off_t prev_diroff = 0;
+ 
+     hdirp = g_try_malloc(count);
+     if (!hdirp) {
+@@ -8650,7 +8650,7 @@ static int do_getdents(abi_long dirfd, abi_long arg2, abi_long count)
+              * Return what we have, resetting the file pointer to the
+              * location of the first record not returned.
+              */
+-            lseek64(dirfd, prev_diroff, SEEK_SET);
++            lseek(dirfd, prev_diroff, SEEK_SET);
+             break;
+         }
+ 
+@@ -8684,7 +8684,7 @@ static int do_getdents64(abi_long dirfd, abi_long arg2, abi_long count)
+     void *tdirp;
+     int hlen, hoff, toff;
+     int hreclen, treclen;
+-    off64_t prev_diroff = 0;
++    off_t prev_diroff = 0;
+ 
+     hdirp = g_try_malloc(count);
+     if (!hdirp) {
+@@ -8726,7 +8726,7 @@ static int do_getdents64(abi_long dirfd, abi_long arg2, abi_long count)
+              * Return what we have, resetting the file pointer to the
+              * location of the first record not returned.
+              */
+-            lseek64(dirfd, prev_diroff, SEEK_SET);
++            lseek(dirfd, prev_diroff, SEEK_SET);
+             break;
+         }
+ 
+@@ -11157,7 +11157,7 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,
+                 return -TARGET_EFAULT;
+             }
+         }
+-        ret = get_errno(pread64(arg1, p, arg3, target_offset64(arg4, arg5)));
++        ret = get_errno(pread(arg1, p, arg3, target_offset64(arg4, arg5)));
+         unlock_user(p, arg2, ret);
+         return ret;
+     case TARGET_NR_pwrite64:
+@@ -11174,7 +11174,7 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,
+                 return -TARGET_EFAULT;
+             }
+         }
+-        ret = get_errno(pwrite64(arg1, p, arg3, target_offset64(arg4, arg5)));
++        ret = get_errno(pwrite(arg1, p, arg3, target_offset64(arg4, arg5)));
+         unlock_user(p, arg2, 0);
+         return ret;
+ #endif
+@@ -12034,7 +12034,7 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,
+     case TARGET_NR_fcntl64:
+     {
+         int cmd;
+-        struct flock64 fl;
++        struct flock fl;
+         from_flock64_fn *copyfrom = copy_from_user_flock64;
+         to_flock64_fn *copyto = copy_to_user_flock64;
+ 
+
diff --git a/srcpkgs/qemu/patches/mmap-mremap-efault.patch b/srcpkgs/qemu/patches/mmap-mremap-efault.patch
deleted file mode 100644
index 5a70e9658b30..000000000000
--- a/srcpkgs/qemu/patches/mmap-mremap-efault.patch
+++ /dev/null
@@ -1,42 +0,0 @@
-Source: @pullmoll
-Upstream: no
-Reason: errno=EFAULT when the address passed to mremap(2) is not valid
-
-See Rich Felker's comment at https://www.openwall.com/lists/musl/2017/06/21/2 for
-why we need to return errno as described in man mremap(2) from qemu-user-static.
-Also speed up the loop when checking for increasing the mappings size to go
-in steps of TARGET_PAGE_SIZE and OR-in a check for the very last byte of the range.
-diff --git linux-user/mmap.c linux-user/mmap.c
-index 7e3b245..1e8d0f1 100644
---- a/linux-user/mmap.c
-+++ b/linux-user/mmap.c
-@@ -738,7 +738,7 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size,
-          !guest_range_valid_untagged(new_addr, new_size)) ||
-         ((flags & MREMAP_MAYMOVE) == 0 &&
-          !guest_range_valid_untagged(old_addr, new_size))) {
--        errno = ENOMEM;
-+        errno = EFAULT;
-         return -1;
-     }
- 
-@@ -775,9 +775,10 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size,
-             abi_ulong addr;
-             for (addr = old_addr + old_size;
-                  addr < old_addr + new_size;
--                 addr++) {
-+                 addr += TARGET_PAGE_SIZE) {
-                 prot |= page_get_flags(addr);
-             }
-+				prot |= page_get_flags(old_addr + new_size - 1);
-         }
-         if (prot == 0) {
-             host_addr = mremap(g2h_untagged(old_addr),
-@@ -796,7 +797,7 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size,
-                 }
-             }
-         } else {
--            errno = ENOMEM;
-+            errno = EFAULT;
-             host_addr = MAP_FAILED;
-         }
-     }
diff --git a/srcpkgs/qemu/patches/musl-initialize-msghdr.patch b/srcpkgs/qemu/patches/musl-initialize-msghdr.patch
index 6d96b3511daf..a88547354c1e 100644
--- a/srcpkgs/qemu/patches/musl-initialize-msghdr.patch
+++ b/srcpkgs/qemu/patches/musl-initialize-msghdr.patch
@@ -1,10 +1,10 @@
 Source: https://github.com/void-linux/void-packages/issues/23557
 
-diff --git linux-user/syscall.c linux-user/syscall.c
-index 945fc25..8d8b68a 100644
+diff --git a/linux-user/syscall.c b/linux-user/syscall.c
+index 14fdebd..de280af 100644
 --- a/linux-user/syscall.c
 +++ b/linux-user/syscall.c
-@@ -3071,7 +3071,7 @@ static abi_long do_sendrecvmsg_locked(int fd, struct target_msghdr *msgp,
+@@ -3229,7 +3229,7 @@ static abi_long do_sendrecvmsg_locked(int fd, struct target_msghdr *msgp,
                                        int flags, int send)
  {
      abi_long ret, len;
diff --git a/srcpkgs/qemu/patches/musl-ppc.patch b/srcpkgs/qemu/patches/musl-ppc.patch
deleted file mode 100644
index 0b77aa8fc63d..000000000000
--- a/srcpkgs/qemu/patches/musl-ppc.patch
+++ /dev/null
@@ -1,25 +0,0 @@
---- a/linux-user/signal.c
-+++ b/linux-user/signal.c
-@@ -21,5 +21,9 @@
- #include "exec/gdbstub.h"
- #include "hw/core/tcg-cpu-ops.h"
- 
-+#if defined(_ARCH_PPC64) && !defined(__GLIBC__) /* musl */
-+#include <asm/ptrace.h>
-+#endif
-+
- #include <sys/ucontext.h>
- #include <sys/resource.h>
---- a/util/mmap-alloc.c
-+++ b/util/mmap-alloc.c
-@@ -25,6 +25,10 @@
- 
- #ifdef CONFIG_LINUX
- #include <sys/vfs.h>
-+/* musl undefs this on ppc and mips */
-+#ifndef MAP_SYNC
-+#define MAP_SYNC 0x80000
-+#endif
- #endif
- 
- size_t qemu_fd_getpagesize(int fd)
diff --git a/srcpkgs/qemu/patches/musl-rlimit-rttime.patch b/srcpkgs/qemu/patches/musl-rlimit-rttime.patch
deleted file mode 100644
index 0cbf9be36a8f..000000000000
--- a/srcpkgs/qemu/patches/musl-rlimit-rttime.patch
+++ /dev/null
@@ -1,13 +0,0 @@
---- a/linux-user/syscall.c
-+++ b/linux-user/syscall.c
-@@ -141,6 +141,10 @@
- #include "fd-trans.h"
- #include "tcg/tcg.h"
- 
-+#ifndef RLIMIT_RTTIME
-+#define RLIMIT_RTTIME 15
-+#endif
-+
- #ifndef CLONE_IO
- #define CLONE_IO                0x80000000      /* Clone io context */
- #endif
diff --git a/srcpkgs/qemu/patches/xxx-ppcle.patch b/srcpkgs/qemu/patches/xxx-ppcle.patch
deleted file mode 100644
index 90b32b5e07cd..000000000000
--- a/srcpkgs/qemu/patches/xxx-ppcle.patch
+++ /dev/null
@@ -1,113 +0,0 @@
-From 7ece08d7902d5a8c007deeb0b75cb533a41dd882 Mon Sep 17 00:00:00 2001
-From: Daniel Kolesa <daniel@octaforge.org>
-Date: Sun, 7 Mar 2021 01:47:42 +0100
-Subject: [PATCH] support ppcle architecture
-
----
- configure                            | 14 ++++++++++++--
- configs/targets/ppcle-linux-user.mak |  4 ++++
- linux-user/ppc/target_syscall.h      |  4 ++++
- scripts/qemu-binfmt-conf.sh          |  6 +++++-
- tests/tcg/configure.sh               |  2 ++
- 5 files changed, 27 insertions(+), 3 deletions(-)
- create mode 100644 configs/targets/ppcle-linux-user.mak
-
-diff --git a/configure b/configure
-index 18c26e0..03d3e18 100755
---- a/configure
-+++ b/configure
-@@ -653,7 +653,11 @@ elif check_define _ARCH_PPC ; then
-       cpu="ppc64"
-     fi
-   else
--    cpu="ppc"
-+    if check_define _LITTLE_ENDIAN ; then
-+      cpu="ppcle"
-+    else
-+      cpu="ppc"
-+    fi
-   fi
- elif check_define __mips__ ; then
-   cpu="mips"
-@@ -638,6 +642,9 @@
- 
-   ppc)
-     CPU_CFLAGS="-m32" ;;
-+  ppcle)
-+    cpu="ppc"
-+    CPU_CFLAGS="-m32 -mlittle-endian" ;;
-   ppc64)
-     CPU_CFLAGS="-m64 -mbig-endian" ;;
-   ppc64le)
-diff --git a/configs/targets/ppcle-linux-user.mak b/configs/targets/ppcle-linux-user.mak
-new file mode 100644
-index 0000000..2259243
---- /dev/null
-+++ b/configs/targets/ppcle-linux-user.mak
-@@ -0,0 +1,4 @@
-+TARGET_ARCH=ppc
-+TARGET_SYSTBL_ABI=common,nospu,32
-+TARGET_SYSTBL=syscall.tbl
-+TARGET_XML_FILES= gdb-xml/power-core.xml gdb-xml/power-fpu.xml gdb-xml/power-altivec.xml gdb-xml/power-spe.xml
-diff --git a/linux-user/ppc/target_syscall.h b/linux-user/ppc/target_syscall.h
-index b9c4b81..cf26497 100644
---- a/linux-user/ppc/target_syscall.h
-+++ b/linux-user/ppc/target_syscall.h
-@@ -65,7 +65,11 @@ struct target_revectored_struct {
- #define UNAME_MACHINE "ppc64le"
- #endif
- #else
-+#if TARGET_BIG_ENDIAN
- #define UNAME_MACHINE "ppc"
-+#else
-+#define UNAME_MACHINE "ppcle"
-+#endif
- #endif
- #define UNAME_MINIMUM_RELEASE "2.6.32"
- 
-diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh
-index 9f1580a..393943f 100755
---- a/scripts/qemu-binfmt-conf.sh
-+++ b/scripts/qemu-binfmt-conf.sh
-@@ -46,6 +46,10 @@ ppc_magic='\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x
- ppc_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
- ppc_family=ppc
- 
-+ppcle_magic='\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x14\x00'
-+ppcle_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\x00'
-+ppc_family=ppcle
-+
- ppc64_magic='\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x15'
- ppc64_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
- ppc64_family=ppc
-@@ -148,7 +152,7 @@ qemu_get_family() {
-     "Power Macintosh"|ppc64|powerpc|ppc)
-         echo "ppc"
-         ;;
--    ppc64el|ppc64le)
-+    ppc64el|ppc64le|ppcel|ppcle)
-         echo "ppcle"
-         ;;
-     arm|armel|armhf|arm64|armv[4-9]*l|aarch64)
-diff --git a/configure b/configure
-index 72ab03f11a..0691929d76 100755
---- a/configure
-+++ b/configure
-@@ -1866,6 +1866,7 @@ fi
- : ${cross_prefix_mips="mips-linux-gnu-"}
- : ${cross_prefix_nios2="nios2-linux-gnu-"}
- : ${cross_prefix_ppc="powerpc-linux-gnu-"}
-+: ${cross_prefix_ppcle="powerpcle-linux-gnu-"}
- : ${cross_prefix_ppc64="powerpc64-linux-gnu-"}
- : ${cross_prefix_ppc64le="$cross_prefix_ppc64"}
- : ${cross_prefix_riscv64="riscv64-linux-gnu-"}
-@@ -1883,6 +1884,7 @@ fi
- : ${cross_cc_cflags_hexagon="-mv67 -O2 -static"}
- : ${cross_cc_cflags_i386="-m32"}
- : ${cross_cc_cflags_ppc="-m32 -mbig-endian"}
-+: ${cross_cc_cflags_ppcle="-m32"}
- : ${cross_cc_cflags_ppc64="-m64 -mbig-endian"}
- : ${cross_cc_ppc64le="$cross_cc_ppc64"}
- : ${cross_cc_cflags_ppc64le="-m64 -mlittle-endian"}
-2.30.1
-
diff --git a/srcpkgs/qemu/template b/srcpkgs/qemu/template
index 48ab199e5686..c64664055bf9 100644
--- a/srcpkgs/qemu/template
+++ b/srcpkgs/qemu/template
@@ -1,8 +1,8 @@
 # Template file for 'qemu'
 # This package should be updated together with qemu-user-static
 pkgname=qemu
-version=7.1.0
-revision=2
+version=8.0.3
+revision=1
 build_style=configure
 configure_args="--prefix=/usr --sysconfdir=/etc --libexecdir=/usr/libexec --localstatedir=/var
  --disable-glusterfs --disable-xen --enable-docs --enable-kvm --enable-libusb --enable-pie
@@ -10,10 +10,10 @@ configure_args="--prefix=/usr --sysconfdir=/etc --libexecdir=/usr/libexec --loca
  --audio-drv-list=alsa$(vopt_if sdl2 ,sdl)$(vopt_if jack ,jack)$(vopt_if pulseaudio ,pa)
  $(vopt_enable opengl) $(vopt_enable pulseaudio pa) $(vopt_enable sdl2 sdl) $(vopt_enable smartcard)
  $(vopt_enable spice) $(vopt_enable virgl virglrenderer) $(vopt_if gtk3 '--enable-gtk')"
-hostmakedepends="gettext pkg-config perl python3 python3-Sphinx python3-sphinx_rtd_theme ninja"
+hostmakedepends="flex gettext glib-devel pkg-config perl python3 python3-Sphinx python3-sphinx_rtd_theme ninja"
 makedepends="capstone-devel dtc-devel libpng-devel libjpeg-turbo-devel pixman-devel
- snappy-devel libuuid-devel libX11-devel alsa-lib-devel libaio-devel gnutls-devel
- libsasl-devel libglib-devel ncurses-devel libseccomp-devel nss-devel
+ snappy-devel libuuid-devel libX11-devel alsa-lib-devel libaio-devel
+ gnutls-devel libsasl-devel ncurses-devel libseccomp-devel nss-devel
  libcurl-devel xfsprogs-devel libcap-ng-devel vde2-devel usbredir-devel
  libbluetooth-devel libssh2-devel libusb-devel libnfs-devel libslirp-devel
  libxkbcommon-devel libzstd-devel $(vopt_if sdl2 'SDL2-devel SDL2_image-devel')
@@ -25,17 +25,17 @@ makedepends="capstone-devel dtc-devel libpng-devel libjpeg-turbo-devel pixman-de
  $(vopt_if jack 'jack-devel') $(vopt_if pulseaudio 'pulseaudio-devel')"
 short_desc="Open Source Processor Emulator"
 maintainer="Orphaned <orphan@voidlinux.org>"
-license="GPL-2.0-or-later, LGPL-2.1-or-later"
+license="GPL-2.0-only, LGPL-2.1-only"
 homepage="https://www.qemu.org"
 distfiles="https://wiki.qemu.org/download/qemu-${version}.tar.bz2"
-checksum=f7ac2b85b3f1831e6810b140306e30af91556e15784864b209f3942858947fd0
+checksum=bb7113cd3761927621df11ec7f7ad438f868e1815f46f5dddf46a14ceb77e8e6
 ignore_elf_dirs="/usr/share/qemu"
 nostrip_files="hppa-firmware.img openbios-ppc openbios-sparc32 openbios-sparc64
  palcode-clipper s390-ccw.img s390-netboot.img u-boot.e500 opensbi-riscv32-generic-fw_dynamic.elf
  opensbi-riscv64-generic-fw_dynamic.elf"
 
-build_options="gtk3 opengl sdl2 spice virgl smartcard numa iscsi jack pulseaudio"
-build_options_default="opengl gtk3 virgl sdl2 numa iscsi jack pulseaudio"
+build_options="gtk3 iscsi jack numa opengl pulseaudio sdl2 smartcard spice virgl"
+build_options_default="gtk3 iscsi jack numa opengl pulseaudio sdl2 smartcard spice virgl"
 desc_option_sdl2="Enable SDL (2.x) video output"
 desc_option_spice="Enable support for SPICE"
 desc_option_virgl="Enable support for VirGL (A Virtual 3D GPU renderer)"
@@ -43,37 +43,10 @@ desc_option_smartcard="Enable smartcard support"
 desc_option_numa="Enable support for host NUMA"
 desc_option_iscsi="Enable support for iSCSI"
 
-case "$XBPS_TARGET_MACHINE" in
-	aarch64-musl) CFLAGS="-D_LINUX_SYSINFO_H";;
-esac
-
-if [ "$XBPS_TARGET_ENDIAN" = "le" ]; then
-	build_options_default+=" spice"
-fi
-
 if [ "$CROSS_BUILD" ]; then
-	configure_args+=" --cross-prefix=${XBPS_CROSS_TRIPLET}-"
-else
-	build_options_default+=" smartcard"
-fi
-
-if [ "$XBPS_CHECK_PKGS" != full ]; then
-	make_check_target=check-unit
+	configure_args+=" --cross-prefix=${XBPS_CROSS_TRIPLET}"
 fi
 
-post_extract() {
-	if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
-		grep -rl 'Input/output error' tests/qemu-iotests |
-			xargs -n1 sed -i -e 's;Input/output error;I/O error;g'
-		grep -rl 'Operation not supported' tests/qemu-iotests |
-			xargs -n1 sed -i -e 's;Operation not supported;Not supported;g'
-	fi
-}
-
-pre_configure() {
-	unset CPP
-}
-
 post_install() {
 	vdoc "${FILESDIR}/README.voidlinux"
 

From 8af60fcbab7e4d07c37f62bfda42d8c6fcd80c0c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Cerqueira?= <acerqueira021@gmail.com>
Date: Mon, 3 Jul 2023 18:41:30 +0100
Subject: [PATCH 2/2] qemu-user-static: update to 8.0.3.

---
 srcpkgs/qemu-user-static/template | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/srcpkgs/qemu-user-static/template b/srcpkgs/qemu-user-static/template
index 2a8da9b53f2d..ed2734e9aebd 100644
--- a/srcpkgs/qemu-user-static/template
+++ b/srcpkgs/qemu-user-static/template
@@ -1,20 +1,20 @@
 # Template file for 'qemu-user-static'
 # This package should be updated together with qemu
 pkgname=qemu-user-static
-version=7.1.0
-revision=3
+version=8.0.3
+revision=1
 build_style=configure
 configure_args="--prefix=/usr --sysconfdir=/etc --libexecdir=/usr/libexec
  --disable-kvm --disable-png --disable-virtfs --disable-fdt --disable-seccomp
  --enable-linux-user --disable-system --static --disable-pie"
-hostmakedepends="pkg-config perl python3 ninja"
+hostmakedepends="flex glib-devel pkg-config perl python3 ninja"
 makedepends="dtc-devel libglib-devel pixman-devel libuuid-devel"
 short_desc="QEMU User-mode emulators (statically compiled)"
 maintainer="Orphaned <orphan@voidlinux.org>"
-license="GPL-2.0-or-later, LGPL-2.1-or-later"
+license="GPL-2.0-only, LGPL-2.1-only"
 homepage="https://www.qemu.org"
 distfiles="https://wiki.qemu.org/download/qemu-${version}.tar.bz2"
-checksum=f7ac2b85b3f1831e6810b140306e30af91556e15784864b209f3942858947fd0
+checksum=bb7113cd3761927621df11ec7f7ad438f868e1815f46f5dddf46a14ceb77e8e6
 
 _fmts="aarch64 aarch64_be alpha arm armeb cris hppa i386 m68k microblaze
  microblazeel mips mipsel mips64 mips64el mipsn32 mipsn32el or1k
@@ -111,10 +111,6 @@ done
 
 binfmts="${binfmts%?}"
 
-pre_configure() {
-	unset CPP
-}
-
 post_install() {
 	# Remove unneeded stuff.
 	rm -rf ${DESTDIR}/etc ${DESTDIR}/usr/share ${DESTDIR}/usr/libexec

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: qemu: update to 8.0.3.
  2023-07-03 17:50 [PR PATCH] qemu: update to 8.0.2 motorto
                   ` (20 preceding siblings ...)
  2023-07-19 17:04 ` [PR PATCH] [Updated] " motorto
@ 2023-07-19 17:13 ` JamiKettunen
  2023-07-19 17:15 ` JamiKettunen
                   ` (16 subsequent siblings)
  38 siblings, 0 replies; 40+ messages in thread
From: JamiKettunen @ 2023-07-19 17:13 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 664 bytes --]

New comment by JamiKettunen on void-packages repository

https://github.com/void-linux/void-packages/pull/44822#issuecomment-1642459162

Comment:
Great now there's a misunderstanding due to the revert blunder on the mailing list and the patches only being in `master` branch, it **NEEDS** to be page aligned, the proposed revert was wrong on the latest thing I linked and was dropped on v2 of the "further fixes" series (https://patchwork.kernel.org/project/qemu-devel/cover/20230718185241.11433-1-deller@gmx.de/).

Basically, we **want** https://gitlab.com/qemu-project/qemu/-/commit/d28b3c9 downstream or wait until v8.0.4 / v8.1 which both should contain it.

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: qemu: update to 8.0.3.
  2023-07-03 17:50 [PR PATCH] qemu: update to 8.0.2 motorto
                   ` (21 preceding siblings ...)
  2023-07-19 17:13 ` JamiKettunen
@ 2023-07-19 17:15 ` JamiKettunen
  2023-07-19 17:16 ` JamiKettunen
                   ` (15 subsequent siblings)
  38 siblings, 0 replies; 40+ messages in thread
From: JamiKettunen @ 2023-07-19 17:15 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 443 bytes --]

New comment by JamiKettunen on void-packages repository

https://github.com/void-linux/void-packages/pull/44822#issuecomment-1642462144

Comment:
It's trivial to test if `qemu-aarch64-static` is broken:
```
wget https://repo-default.voidlinux.org/live/current/void-aarch64-musl-ROOTFS-20230628.tar.xz
mkdir rootfs && tar xf void-aarch64-musl-ROOTFS-20230628.tar.xz -C rootfs && sudo chroot rootfs /bin/ls
```
If it segfaults it's broken.

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: qemu: update to 8.0.3.
  2023-07-03 17:50 [PR PATCH] qemu: update to 8.0.2 motorto
                   ` (22 preceding siblings ...)
  2023-07-19 17:15 ` JamiKettunen
@ 2023-07-19 17:16 ` JamiKettunen
  2023-07-19 17:17 ` JamiKettunen
                   ` (14 subsequent siblings)
  38 siblings, 0 replies; 40+ messages in thread
From: JamiKettunen @ 2023-07-19 17:16 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 743 bytes --]

New comment by JamiKettunen on void-packages repository

https://github.com/void-linux/void-packages/pull/44822#issuecomment-1642459162

Comment:
Great now there's a misunderstanding due to the revert blunder on the mailing list and the patches only being in `master` branch, it **NEEDS** to be page aligned, the proposed revert was wrong on the latest thing I linked (which is what I was trying to show by linking to comments mentioning as such) and was dropped on v2 of the "further fixes" series (https://patchwork.kernel.org/project/qemu-devel/cover/20230718185241.11433-1-deller@gmx.de/).

Basically, we **want** https://gitlab.com/qemu-project/qemu/-/commit/d28b3c9 downstream or wait until v8.0.4 / v8.1 which both should contain it.

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: qemu: update to 8.0.3.
  2023-07-03 17:50 [PR PATCH] qemu: update to 8.0.2 motorto
                   ` (23 preceding siblings ...)
  2023-07-19 17:16 ` JamiKettunen
@ 2023-07-19 17:17 ` JamiKettunen
  2023-07-19 17:21 ` [PR PATCH] [Updated] " motorto
                   ` (13 subsequent siblings)
  38 siblings, 0 replies; 40+ messages in thread
From: JamiKettunen @ 2023-07-19 17:17 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 513 bytes --]

New comment by JamiKettunen on void-packages repository

https://github.com/void-linux/void-packages/pull/44822#issuecomment-1642462144

Comment:
It's trivial to test if `qemu-aarch64-static` is broken (assuming an `x86_64` host for example, not native `aarch64` machine):
```
wget https://repo-default.voidlinux.org/live/current/void-aarch64-musl-ROOTFS-20230628.tar.xz
mkdir rootfs && tar xf void-aarch64-musl-ROOTFS-20230628.tar.xz -C rootfs && sudo chroot rootfs /bin/ls
```
If it segfaults it's broken.

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [PR PATCH] [Updated] qemu: update to 8.0.3.
  2023-07-03 17:50 [PR PATCH] qemu: update to 8.0.2 motorto
                   ` (24 preceding siblings ...)
  2023-07-19 17:17 ` JamiKettunen
@ 2023-07-19 17:21 ` motorto
  2023-07-19 17:22 ` motorto
                   ` (12 subsequent siblings)
  38 siblings, 0 replies; 40+ messages in thread
From: motorto @ 2023-07-19 17:21 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1827 bytes --]

There is an updated pull request by motorto against master on the void-packages repository

https://github.com/motorto/void-packages qemu-8.0.2
https://github.com/void-linux/void-packages/pull/44822

qemu: update to 8.0.3.
<!-- Uncomment relevant sections and delete options which are not applicable -->
[ci-skip] 

Draft because of: https://github.com/void-linux/void-packages/pull/44822#issuecomment-1633611714


#### Testing the changes
- I tested the changes in this PR: **YES**, runned a Windows vm machine and it worked fine.

Removed a bunch of patches that in my research are no longer needed:

- Removed all ppc related patches since that arch isn't no longer supported.
- gcc12.patch: because it builds fine now in this version
- fix-softfloat-fesetround.patch: don't have a system to try it, but alpine doesn't have any patch related to this)
- mmap-mremap-efaul: not sure about if we should keep this one

Kept this patches:

- musl-initialize-msghdr.patch: just update in order to apply.

Added this ones:

- ~~CVE-2023-2861.patch~~
- ~~keymap.patch: xkeyboard-config 2.39 removed the legacy alias of ar -> ara~~
- fix-brk0.patch: make sure that initial brk(0) is page-aligned
- lfs64.patch: Builds defines -D_FILE_OFFSET_BITS=64 which makes the original functions
anf macros behave same as their 64 suffixed counterparts. This also
helps in compiling with latest musl C library, where these macros and
functions are no more available under _GNU_SOURCE feature macro

#### Local build testing
- I built this PR locally for my native architecture, x86-64-glibc
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl (cross)
  - x86_64-musl



A patch file from https://github.com/void-linux/void-packages/pull/44822.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-qemu-8.0.2-44822.patch --]
[-- Type: text/x-diff, Size: 34918 bytes --]

From 665921d19a2ecdf711ecfe808a28512ef8c54d54 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Cerqueira?= <acerqueira021@gmail.com>
Date: Mon, 3 Jul 2023 18:41:12 +0100
Subject: [PATCH 1/2] qemu: update to 8.0.3.

---
 srcpkgs/qemu/patches/fix-brk0.patch           |  13 ++
 .../qemu/patches/fix-linux-user-ppc32.patch   | 117 ----------
 .../patches/fix-softfloat-fesetround.patch    |  39 ----
 srcpkgs/qemu/patches/gcc12.patch              |  72 ------
 srcpkgs/qemu/patches/lfs64.patch              | 213 ++++++++++++++++++
 srcpkgs/qemu/patches/mmap-mremap-efault.patch |  42 ----
 .../qemu/patches/musl-initialize-msghdr.patch |   6 +-
 srcpkgs/qemu/patches/musl-ppc.patch           |  25 --
 srcpkgs/qemu/patches/musl-rlimit-rttime.patch |  13 --
 srcpkgs/qemu/patches/xxx-ppcle.patch          | 113 ----------
 srcpkgs/qemu/template                         |  47 +---
 11 files changed, 239 insertions(+), 461 deletions(-)
 create mode 100644 srcpkgs/qemu/patches/fix-brk0.patch
 delete mode 100644 srcpkgs/qemu/patches/fix-linux-user-ppc32.patch
 delete mode 100644 srcpkgs/qemu/patches/fix-softfloat-fesetround.patch
 delete mode 100644 srcpkgs/qemu/patches/gcc12.patch
 create mode 100644 srcpkgs/qemu/patches/lfs64.patch
 delete mode 100644 srcpkgs/qemu/patches/mmap-mremap-efault.patch
 delete mode 100644 srcpkgs/qemu/patches/musl-ppc.patch
 delete mode 100644 srcpkgs/qemu/patches/musl-rlimit-rttime.patch
 delete mode 100644 srcpkgs/qemu/patches/xxx-ppcle.patch

diff --git a/srcpkgs/qemu/patches/fix-brk0.patch b/srcpkgs/qemu/patches/fix-brk0.patch
new file mode 100644
index 000000000000..0252e3f1e830
--- /dev/null
+++ b/srcpkgs/qemu/patches/fix-brk0.patch
@@ -0,0 +1,13 @@
+diff --git a/linux-user/syscall.c b/linux-user/syscall.c
+index b78eb686d8bc29e8541be29532bdea020504e11d..02d3b6c90a2488bb42ad306fa0dd28da1d02a455 100644
+--- a/linux-user/syscall.c
++++ b/linux-user/syscall.c
+@@ -806,7 +806,7 @@ static abi_ulong brk_page;
+ 
+ void target_set_brk(abi_ulong new_brk)
+ {
+-    target_brk = new_brk;
++    target_brk = TARGET_PAGE_ALIGN(new_brk);
+     brk_page = HOST_PAGE_ALIGN(target_brk);
+ }
+ 
diff --git a/srcpkgs/qemu/patches/fix-linux-user-ppc32.patch b/srcpkgs/qemu/patches/fix-linux-user-ppc32.patch
deleted file mode 100644
index cd47435d5aa9..000000000000
--- a/srcpkgs/qemu/patches/fix-linux-user-ppc32.patch
+++ /dev/null
@@ -1,117 +0,0 @@
-commit 37814f62c2cc7aba2eea073014d6c53dcd5bf42c
-Author: q66 <daniel@octaforge.org>
-Date:   Fri Jul 1 16:53:55 2022 +0200
-
-    fix linux-user build on 32-bit ppc
-    
-    Partial revert https://gitlab.com/qemu-project/qemu/-/commit/9d1401b79463e74adbfac69d836789d4e103fb61
-    and https://gitlab.com/qemu-project/qemu/-/commit/0a7e01904d407baa73c1baddbdfc9ccf2ace8356
-
-diff --git a/common-user/host/ppc/safe-syscall.inc.S b/common-user/host/ppc/safe-syscall.inc.S
-new file mode 100644
-index 0000000..e69de29
-diff --git a/common-user/safe-syscall-error.c b/common-user/safe-syscall-error.c
-index cf74b50..a36132c 100644
---- a/common-user/safe-syscall-error.c
-+++ b/common-user/safe-syscall-error.c
-@@ -12,6 +12,7 @@
- #include "qemu/osdep.h"
- #include "user/safe-syscall.h"
- 
-+#if !defined(__powerpc__) || defined(__powerpc64__)
- /*
-  * This is intended to be invoked via tail-call on the error path
-  * from the assembly in host/arch/safe-syscall.inc.S.  This takes
-@@ -23,3 +24,4 @@ long safe_syscall_set_errno_tail(int value)
-     errno = value;
-     return -1;
- }
-+#endif
-diff --git a/include/user/safe-syscall.h b/include/user/safe-syscall.h
-index 61a04e2..793fe84 100644
---- a/include/user/safe-syscall.h
-+++ b/include/user/safe-syscall.h
-@@ -125,6 +125,8 @@
-  * kinds of restartability.
-  */
- 
-+#if !defined(__powerpc__) || defined(__powerpc64__)
-+
- /* The core part of this function is implemented in assembly */
- extern long safe_syscall_base(int *pending, long number, ...);
- extern long safe_syscall_set_errno_tail(int value);
-@@ -137,4 +139,10 @@ extern char safe_syscall_end[];
-     safe_syscall_base(&((TaskState *)thread_cpu->opaque)->signal_pending, \
-                       __VA_ARGS__)
- 
-+#else
-+
-+#define safe_syscall syscall
-+
-+#endif
-+
- #endif
-diff --git a/linux-user/include/host/ppc/host-signal.h b/linux-user/include/host/ppc/host-signal.h
-new file mode 100644
-index 0000000..b80384d
---- /dev/null
-+++ b/linux-user/include/host/ppc/host-signal.h
-@@ -0,0 +1,38 @@
-+/*
-+ * host-signal.h: signal info dependent on the host architecture
-+ *
-+ * Copyright (c) 2003-2005 Fabrice Bellard
-+ * Copyright (c) 2021 Linaro Limited
-+ *
-+ * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
-+ * See the COPYING file in the top-level directory.
-+ */
-+
-+#ifndef PPC_HOST_SIGNAL_H
-+#define PPC_HOST_SIGNAL_H
-+
-+/* The third argument to a SA_SIGINFO handler is ucontext_t. */
-+typedef ucontext_t host_sigcontext;
-+
-+static inline uintptr_t host_signal_pc(host_sigcontext *uc)
-+{
-+    return uc->uc_mcontext.regs->nip;
-+}
-+
-+static inline void host_signal_set_pc(host_sigcontext *uc, uintptr_t pc)
-+{
-+    uc->uc_mcontext.regs->nip = pc;
-+}
-+
-+static inline void *host_signal_mask(host_sigcontext *uc)
-+{
-+    return &uc->uc_sigmask;
-+}
-+
-+static inline bool host_signal_write(siginfo_t *info, host_sigcontext *uc)
-+{
-+    return uc->uc_mcontext.regs->trap != 0x400
-+        && (uc->uc_mcontext.regs->dsisr & 0x02000000);
-+}
-+
-+#endif
-diff --git a/linux-user/signal.c b/linux-user/signal.c
-index 092e70b..b8dfa8a 100644
---- a/linux-user/signal.c
-+++ b/linux-user/signal.c
-@@ -800,6 +800,7 @@ void queue_signal(CPUArchState *env, int sig, int si_type,
- /* Adjust the signal context to rewind out of safe-syscall if we're in it */
- static inline void rewind_if_in_safe_syscall(void *puc)
- {
-+#if !defined(__powerpc__) || defined(__powerpc64__)
-     host_sigcontext *uc = (host_sigcontext *)puc;
-     uintptr_t pcreg = host_signal_pc(uc);
- 
-@@ -807,6 +808,7 @@ static inline void rewind_if_in_safe_syscall(void *puc)
-         && pcreg < (uintptr_t)safe_syscall_end) {
-         host_signal_set_pc(uc, (uintptr_t)safe_syscall_start);
-     }
-+#endif
- }
- 
- static void host_signal_handler(int host_sig, siginfo_t *info, void *puc)
diff --git a/srcpkgs/qemu/patches/fix-softfloat-fesetround.patch b/srcpkgs/qemu/patches/fix-softfloat-fesetround.patch
deleted file mode 100644
index ecdd049f7921..000000000000
--- a/srcpkgs/qemu/patches/fix-softfloat-fesetround.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-Source: @pullmoll
-Upstream: no
-Reason: Target architectures with soft float do not define these constants.
-
---- a/tests/fp/fp-bench.c	2020-12-08 17:59:44.000000000 +0100
-+++ b/tests/fp/fp-bench.c	2020-12-12 20:38:40.702235420 +0100
-@@ -485,16 +485,32 @@
- 
-     switch (rounding) {
-     case ROUND_EVEN:
-+#if defined(FE_TONEAREST)
-         rhost = FE_TONEAREST;
-+#else
-+	return;
-+#endif
-         break;
-     case ROUND_ZERO:
-+#if defined(FE_TOWARDZERO)
-         rhost = FE_TOWARDZERO;
-+#else
-+	return;
-+#endif
-         break;
-     case ROUND_DOWN:
-+#if defined(FE_DOWNWARD)
-         rhost = FE_DOWNWARD;
-+#else
-+	return;
-+#endif
-         break;
-     case ROUND_UP:
-+#if defined(FE_UPWARD)
-         rhost = FE_UPWARD;
-+#else
-+	return;
-+#endif
-         break;
-     case ROUND_TIEAWAY:
-         die_host_rounding(rounding);
diff --git a/srcpkgs/qemu/patches/gcc12.patch b/srcpkgs/qemu/patches/gcc12.patch
deleted file mode 100644
index 2a4b2bd03609..000000000000
--- a/srcpkgs/qemu/patches/gcc12.patch
+++ /dev/null
@@ -1,72 +0,0 @@
-From 5cb993ff131fca2abef3ce074a20258fd6fce557 Mon Sep 17 00:00:00 2001
-From: Bernhard Beschow <shentey@gmail.com>
-Date: Sat, 18 Mar 2023 19:59:31 +0100
-Subject: [PATCH] qemu/osdep: Switch position of "extern" and "G_NORETURN"
-
-Fixes the Windows build under msys2 using GCC 12 which fails with the following
-error:
-
-  [184/579] Compiling C++ object qga/vss-win32/qga-vss.dll.p/install.cpp.obj
-  FAILED: qga/vss-win32/qga-vss.dll.p/install.cpp.obj
-  "c++" "-m64" "-mcx16" "-Iqga/vss-win32/qga-vss.dll.p" "-Iqga/vss-win32" "-I../src/qga/vss-win32" "-I." "-Iqapi" "-Itrace" "-Iui" "-Iui/shader" "-IC:/msys64/mingw64/include/glib-2.0" "-IC:/msys64/mingw64/lib/glib-2.0/include" "-fdiagnostics-color=auto" "-Wall" "-Winvalid-pch" "-Wnon-virtual-dtor" "-Werror" "-std=gnu++11" "-g" "-iquote" "." "-iquote" "C:/msys64/home/shentey/Projects/qemu/src" "-iquote" "C:/msys64/home/shentey/Projects/qemu/src/include" "-iquote" "C:/msys64/home/shentey/Projects/qemu/src/tcg/i386" "-D__STDC_LIMIT_MACROS" "-D__STDC_CONSTANT_MACROS" "-D__STDC_FORMAT_MACROS" "-fno-pie" "-no-pie" "-D_GNU_SOURCE" "-D_FILE_OFFSET_BITS=64" "-D_LARGEFILE_SOURCE" "-fno-strict-aliasing" "-fno-common" "-fwrapv" "-Wundef" "-Wwrite-strings" "-Wtype-limits" "-Wformat-security" "-Wformat-y2k" "-Winit-self" "-Wignored-qualifiers" "-Wempty-body" "-Wendif-labels" "-Wexpansion-to-defined" "-Wimplicit-fallthrough=2" "-Wmissing-format-attribute" "-Wno-missing-include-dirs" "-Wno-shift-negative-value" "-Wno-psabi" "-fstack-protector-strong" "-Wno-unknown-pragmas" "-Wno-delete-non-virtual-dtor" "-Wno-non-virtual-dtor" -MD -MQ qga/vss-win32/qga-vss.dll.p/install.cpp.obj -MF "qga/vss-win32/qga-vss.dll.p/install.cpp.obj.d" -o qga/vss-win32/qga-vss.dll.p/install.cpp.obj "-c" ../src/qga/vss-win32/install.cpp
-  In file included from C:/msys64/mingw64/lib/glib-2.0/include/glibconfig.h:9,
-              from C:/msys64/mingw64/include/glib-2.0/glib/gtypes.h:34,
-              from C:/msys64/mingw64/include/glib-2.0/glib/galloca.h:34,
-              from C:/msys64/mingw64/include/glib-2.0/glib.h:32,
-              from C:/msys64/home/shentey/Projects/qemu/src/include/glib-compat.h:32,
-              from C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:144,
-              from ../src/qga/vss-win32/install.cpp:13:
-  C:/msys64/mingw64/include/glib-2.0/glib/gmacros.h:1075:21: error: standard attributes in middle of decl-specifiers
-  1075 | # define G_NORETURN [[noreturn]]
-        |                     ^
-  C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:240:8: note: in expansion of macro 'G_NORETURN'
-  240 | extern G_NORETURN
-        |        ^~~~~~~~~~
-  C:/msys64/mingw64/include/glib-2.0/glib/gmacros.h:1075:21: note: standard attributes must precede the decl-specifiers to apply to the declaration, or follow them to apply to the type
-  1075 | # define G_NORETURN [[noreturn]]
-        |                     ^
-  C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:240:8: note: in expansion of macro 'G_NORETURN'
-  240 | extern G_NORETURN
-        |        ^~~~~~~~~~
-  C:/msys64/mingw64/include/glib-2.0/glib/gmacros.h:1075:21: error: attribute ignored [-Werror=attributes]
-  1075 | # define G_NORETURN [[noreturn]]
-        |                     ^
-  C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:240:8: note: in expansion of macro 'G_NORETURN'
-  240 | extern G_NORETURN
-        |        ^~~~~~~~~~
-  C:/msys64/mingw64/include/glib-2.0/glib/gmacros.h:1075:21: note: an attribute that appertains to a type-specifier is ignored
-  1075 | # define G_NORETURN [[noreturn]]
-        |                     ^
-  C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:240:8: note: in expansion of macro 'G_NORETURN'
-  240 | extern G_NORETURN
-        |        ^~~~~~~~~~
-  cc1plus.exe: all warnings being treated as errors
-
-Apparently it also fixes the compilation with Clang 15 (see
-https://gitlab.com/qemu-project/qemu/-/issues/1541 ).
-
-Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1541
-Signed-off-by: Bernhard Beschow <shentey@gmail.com>
-Message-Id: <20230318185931.181659-1-shentey@gmail.com>
-Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
-Signed-off-by: Thomas Huth <thuth@redhat.com>
----
- include/qemu/osdep.h | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
-index f68b5d8708c..9eff0be95bd 100644
---- a/include/qemu/osdep.h
-+++ b/include/qemu/osdep.h
-@@ -237,7 +237,7 @@ extern "C" {
-  * supports QEMU_ERROR, this will be reported at compile time; otherwise
-  * this will be reported at link time due to the missing symbol.
-  */
--extern G_NORETURN
-+G_NORETURN extern
- void QEMU_ERROR("code path is reachable")
-     qemu_build_not_reached_always(void);
- #if defined(__OPTIMIZE__) && !defined(__NO_INLINE__)
--- 
-GitLab
-
diff --git a/srcpkgs/qemu/patches/lfs64.patch b/srcpkgs/qemu/patches/lfs64.patch
new file mode 100644
index 000000000000..35d09ef028df
--- /dev/null
+++ b/srcpkgs/qemu/patches/lfs64.patch
@@ -0,0 +1,213 @@
+Builds defines -D_FILE_OFFSET_BITS=64 which makes the original functions
+anf macros behave same as their 64 suffixed counterparts. This also
+helps in compiling with latest musl C library, where these macros and
+functions are no more available under _GNU_SOURCE feature macro
+
+source: https://git.alpinelinux.org/aports/plain/community/qemu/lfs64.patch
+--
+
+diff --git a/linux-user/syscall.c b/linux-user/syscall.c
+index bbba2a6..38fa09a 100644
+--- a/linux-user/syscall.c
++++ b/linux-user/syscall.c
+@@ -6812,13 +6812,13 @@ static int target_to_host_fcntl_cmd(int cmd)
+         ret = cmd;
+         break;
+     case TARGET_F_GETLK:
+-        ret = F_GETLK64;
++        ret = F_GETLK;
+         break;
+     case TARGET_F_SETLK:
+-        ret = F_SETLK64;
++        ret = F_SETLK;
+         break;
+     case TARGET_F_SETLKW:
+-        ret = F_SETLKW64;
++        ret = F_SETLKW;
+         break;
+     case TARGET_F_GETOWN:
+         ret = F_GETOWN;
+@@ -6834,13 +6834,13 @@ static int target_to_host_fcntl_cmd(int cmd)
+         break;
+ #if TARGET_ABI_BITS == 32
+     case TARGET_F_GETLK64:
+-        ret = F_GETLK64;
++        ret = F_GETLK;
+         break;
+     case TARGET_F_SETLK64:
+-        ret = F_SETLK64;
++        ret = F_SETLK;
+         break;
+     case TARGET_F_SETLKW64:
+-        ret = F_SETLKW64;
++        ret = F_SETLKW;
+         break;
+ #endif
+     case TARGET_F_SETLEASE:
+@@ -6894,8 +6894,8 @@ static int target_to_host_fcntl_cmd(int cmd)
+      * them to 5, 6 and 7 before making the syscall(). Since we make the
+      * syscall directly, adjust to what is supported by the kernel.
+      */
+-    if (ret >= F_GETLK64 && ret <= F_SETLKW64) {
+-        ret -= F_GETLK64 - 5;
++    if (ret >= F_GETLK && ret <= F_SETLKW) {
++        ret -= F_GETLK - 5;
+     }
+ #endif
+ 
+@@ -6928,7 +6928,7 @@ static int host_to_target_flock(int type)
+     return type;
+ }
+ 
+-static inline abi_long copy_from_user_flock(struct flock64 *fl,
++static inline abi_long copy_from_user_flock(struct flock *fl,
+                                             abi_ulong target_flock_addr)
+ {
+     struct target_flock *target_fl;
+@@ -6953,7 +6953,7 @@ static inline abi_long copy_from_user_flock(struct flock64 *fl,
+ }
+ 
+ static inline abi_long copy_to_user_flock(abi_ulong target_flock_addr,
+-                                          const struct flock64 *fl)
++                                          const struct flock *fl)
+ {
+     struct target_flock *target_fl;
+     short l_type;
+@@ -6972,8 +6972,8 @@ static inline abi_long copy_to_user_flock(abi_ulong target_flock_addr,
+     return 0;
+ }
+ 
+-typedef abi_long from_flock64_fn(struct flock64 *fl, abi_ulong target_addr);
+-typedef abi_long to_flock64_fn(abi_ulong target_addr, const struct flock64 *fl);
++typedef abi_long from_flock64_fn(struct flock *fl, abi_ulong target_addr);
++typedef abi_long to_flock64_fn(abi_ulong target_addr, const struct flock *fl);
+ 
+ #if defined(TARGET_ARM) && TARGET_ABI_BITS == 32
+ struct target_oabi_flock64 {
+@@ -6984,7 +6984,7 @@ struct target_oabi_flock64 {
+     abi_int   l_pid;
+ } QEMU_PACKED;
+ 
+-static inline abi_long copy_from_user_oabi_flock64(struct flock64 *fl,
++static inline abi_long copy_from_user_oabi_flock64(struct flock *fl,
+                                                    abi_ulong target_flock_addr)
+ {
+     struct target_oabi_flock64 *target_fl;
+@@ -7009,7 +7009,7 @@ static inline abi_long copy_from_user_oabi_flock64(struct flock64 *fl,
+ }
+ 
+ static inline abi_long copy_to_user_oabi_flock64(abi_ulong target_flock_addr,
+-                                                 const struct flock64 *fl)
++                                                 const struct flock *fl)
+ {
+     struct target_oabi_flock64 *target_fl;
+     short l_type;
+@@ -7029,7 +7029,7 @@ static inline abi_long copy_to_user_oabi_flock64(abi_ulong target_flock_addr,
+ }
+ #endif
+ 
+-static inline abi_long copy_from_user_flock64(struct flock64 *fl,
++static inline abi_long copy_from_user_flock64(struct flock *fl,
+                                               abi_ulong target_flock_addr)
+ {
+     struct target_flock64 *target_fl;
+@@ -7054,7 +7054,7 @@ static inline abi_long copy_from_user_flock64(struct flock64 *fl,
+ }
+ 
+ static inline abi_long copy_to_user_flock64(abi_ulong target_flock_addr,
+-                                            const struct flock64 *fl)
++                                            const struct flock *fl)
+ {
+     struct target_flock64 *target_fl;
+     short l_type;
+@@ -7075,7 +7075,7 @@ static inline abi_long copy_to_user_flock64(abi_ulong target_flock_addr,
+ 
+ static abi_long do_fcntl(int fd, int cmd, abi_ulong arg)
+ {
+-    struct flock64 fl64;
++    struct flock fl64;
+ #ifdef F_GETOWN_EX
+     struct f_owner_ex fox;
+     struct target_f_owner_ex *target_fox;
+@@ -7347,7 +7347,7 @@ static inline abi_long target_truncate64(CPUArchState *cpu_env, const char *arg1
+         arg2 = arg3;
+         arg3 = arg4;
+     }
+-    return get_errno(truncate64(arg1, target_offset64(arg2, arg3)));
++    return get_errno(truncate(arg1, target_offset64(arg2, arg3)));
+ }
+ #endif
+ 
+@@ -7361,7 +7361,7 @@ static inline abi_long target_ftruncate64(CPUArchState *cpu_env, abi_long arg1,
+         arg2 = arg3;
+         arg3 = arg4;
+     }
+-    return get_errno(ftruncate64(arg1, target_offset64(arg2, arg3)));
++    return get_errno(ftruncate(arg1, target_offset64(arg2, arg3)));
+ }
+ #endif
+ 
+@@ -8597,7 +8597,7 @@ static int do_getdents(abi_long dirfd, abi_long arg2, abi_long count)
+     void *tdirp;
+     int hlen, hoff, toff;
+     int hreclen, treclen;
+-    off64_t prev_diroff = 0;
++    off_t prev_diroff = 0;
+ 
+     hdirp = g_try_malloc(count);
+     if (!hdirp) {
+@@ -8650,7 +8650,7 @@ static int do_getdents(abi_long dirfd, abi_long arg2, abi_long count)
+              * Return what we have, resetting the file pointer to the
+              * location of the first record not returned.
+              */
+-            lseek64(dirfd, prev_diroff, SEEK_SET);
++            lseek(dirfd, prev_diroff, SEEK_SET);
+             break;
+         }
+ 
+@@ -8684,7 +8684,7 @@ static int do_getdents64(abi_long dirfd, abi_long arg2, abi_long count)
+     void *tdirp;
+     int hlen, hoff, toff;
+     int hreclen, treclen;
+-    off64_t prev_diroff = 0;
++    off_t prev_diroff = 0;
+ 
+     hdirp = g_try_malloc(count);
+     if (!hdirp) {
+@@ -8726,7 +8726,7 @@ static int do_getdents64(abi_long dirfd, abi_long arg2, abi_long count)
+              * Return what we have, resetting the file pointer to the
+              * location of the first record not returned.
+              */
+-            lseek64(dirfd, prev_diroff, SEEK_SET);
++            lseek(dirfd, prev_diroff, SEEK_SET);
+             break;
+         }
+ 
+@@ -11157,7 +11157,7 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,
+                 return -TARGET_EFAULT;
+             }
+         }
+-        ret = get_errno(pread64(arg1, p, arg3, target_offset64(arg4, arg5)));
++        ret = get_errno(pread(arg1, p, arg3, target_offset64(arg4, arg5)));
+         unlock_user(p, arg2, ret);
+         return ret;
+     case TARGET_NR_pwrite64:
+@@ -11174,7 +11174,7 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,
+                 return -TARGET_EFAULT;
+             }
+         }
+-        ret = get_errno(pwrite64(arg1, p, arg3, target_offset64(arg4, arg5)));
++        ret = get_errno(pwrite(arg1, p, arg3, target_offset64(arg4, arg5)));
+         unlock_user(p, arg2, 0);
+         return ret;
+ #endif
+@@ -12034,7 +12034,7 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,
+     case TARGET_NR_fcntl64:
+     {
+         int cmd;
+-        struct flock64 fl;
++        struct flock fl;
+         from_flock64_fn *copyfrom = copy_from_user_flock64;
+         to_flock64_fn *copyto = copy_to_user_flock64;
+ 
+
diff --git a/srcpkgs/qemu/patches/mmap-mremap-efault.patch b/srcpkgs/qemu/patches/mmap-mremap-efault.patch
deleted file mode 100644
index 5a70e9658b30..000000000000
--- a/srcpkgs/qemu/patches/mmap-mremap-efault.patch
+++ /dev/null
@@ -1,42 +0,0 @@
-Source: @pullmoll
-Upstream: no
-Reason: errno=EFAULT when the address passed to mremap(2) is not valid
-
-See Rich Felker's comment at https://www.openwall.com/lists/musl/2017/06/21/2 for
-why we need to return errno as described in man mremap(2) from qemu-user-static.
-Also speed up the loop when checking for increasing the mappings size to go
-in steps of TARGET_PAGE_SIZE and OR-in a check for the very last byte of the range.
-diff --git linux-user/mmap.c linux-user/mmap.c
-index 7e3b245..1e8d0f1 100644
---- a/linux-user/mmap.c
-+++ b/linux-user/mmap.c
-@@ -738,7 +738,7 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size,
-          !guest_range_valid_untagged(new_addr, new_size)) ||
-         ((flags & MREMAP_MAYMOVE) == 0 &&
-          !guest_range_valid_untagged(old_addr, new_size))) {
--        errno = ENOMEM;
-+        errno = EFAULT;
-         return -1;
-     }
- 
-@@ -775,9 +775,10 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size,
-             abi_ulong addr;
-             for (addr = old_addr + old_size;
-                  addr < old_addr + new_size;
--                 addr++) {
-+                 addr += TARGET_PAGE_SIZE) {
-                 prot |= page_get_flags(addr);
-             }
-+				prot |= page_get_flags(old_addr + new_size - 1);
-         }
-         if (prot == 0) {
-             host_addr = mremap(g2h_untagged(old_addr),
-@@ -796,7 +797,7 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size,
-                 }
-             }
-         } else {
--            errno = ENOMEM;
-+            errno = EFAULT;
-             host_addr = MAP_FAILED;
-         }
-     }
diff --git a/srcpkgs/qemu/patches/musl-initialize-msghdr.patch b/srcpkgs/qemu/patches/musl-initialize-msghdr.patch
index 6d96b3511daf..a88547354c1e 100644
--- a/srcpkgs/qemu/patches/musl-initialize-msghdr.patch
+++ b/srcpkgs/qemu/patches/musl-initialize-msghdr.patch
@@ -1,10 +1,10 @@
 Source: https://github.com/void-linux/void-packages/issues/23557
 
-diff --git linux-user/syscall.c linux-user/syscall.c
-index 945fc25..8d8b68a 100644
+diff --git a/linux-user/syscall.c b/linux-user/syscall.c
+index 14fdebd..de280af 100644
 --- a/linux-user/syscall.c
 +++ b/linux-user/syscall.c
-@@ -3071,7 +3071,7 @@ static abi_long do_sendrecvmsg_locked(int fd, struct target_msghdr *msgp,
+@@ -3229,7 +3229,7 @@ static abi_long do_sendrecvmsg_locked(int fd, struct target_msghdr *msgp,
                                        int flags, int send)
  {
      abi_long ret, len;
diff --git a/srcpkgs/qemu/patches/musl-ppc.patch b/srcpkgs/qemu/patches/musl-ppc.patch
deleted file mode 100644
index 0b77aa8fc63d..000000000000
--- a/srcpkgs/qemu/patches/musl-ppc.patch
+++ /dev/null
@@ -1,25 +0,0 @@
---- a/linux-user/signal.c
-+++ b/linux-user/signal.c
-@@ -21,5 +21,9 @@
- #include "exec/gdbstub.h"
- #include "hw/core/tcg-cpu-ops.h"
- 
-+#if defined(_ARCH_PPC64) && !defined(__GLIBC__) /* musl */
-+#include <asm/ptrace.h>
-+#endif
-+
- #include <sys/ucontext.h>
- #include <sys/resource.h>
---- a/util/mmap-alloc.c
-+++ b/util/mmap-alloc.c
-@@ -25,6 +25,10 @@
- 
- #ifdef CONFIG_LINUX
- #include <sys/vfs.h>
-+/* musl undefs this on ppc and mips */
-+#ifndef MAP_SYNC
-+#define MAP_SYNC 0x80000
-+#endif
- #endif
- 
- size_t qemu_fd_getpagesize(int fd)
diff --git a/srcpkgs/qemu/patches/musl-rlimit-rttime.patch b/srcpkgs/qemu/patches/musl-rlimit-rttime.patch
deleted file mode 100644
index 0cbf9be36a8f..000000000000
--- a/srcpkgs/qemu/patches/musl-rlimit-rttime.patch
+++ /dev/null
@@ -1,13 +0,0 @@
---- a/linux-user/syscall.c
-+++ b/linux-user/syscall.c
-@@ -141,6 +141,10 @@
- #include "fd-trans.h"
- #include "tcg/tcg.h"
- 
-+#ifndef RLIMIT_RTTIME
-+#define RLIMIT_RTTIME 15
-+#endif
-+
- #ifndef CLONE_IO
- #define CLONE_IO                0x80000000      /* Clone io context */
- #endif
diff --git a/srcpkgs/qemu/patches/xxx-ppcle.patch b/srcpkgs/qemu/patches/xxx-ppcle.patch
deleted file mode 100644
index 90b32b5e07cd..000000000000
--- a/srcpkgs/qemu/patches/xxx-ppcle.patch
+++ /dev/null
@@ -1,113 +0,0 @@
-From 7ece08d7902d5a8c007deeb0b75cb533a41dd882 Mon Sep 17 00:00:00 2001
-From: Daniel Kolesa <daniel@octaforge.org>
-Date: Sun, 7 Mar 2021 01:47:42 +0100
-Subject: [PATCH] support ppcle architecture
-
----
- configure                            | 14 ++++++++++++--
- configs/targets/ppcle-linux-user.mak |  4 ++++
- linux-user/ppc/target_syscall.h      |  4 ++++
- scripts/qemu-binfmt-conf.sh          |  6 +++++-
- tests/tcg/configure.sh               |  2 ++
- 5 files changed, 27 insertions(+), 3 deletions(-)
- create mode 100644 configs/targets/ppcle-linux-user.mak
-
-diff --git a/configure b/configure
-index 18c26e0..03d3e18 100755
---- a/configure
-+++ b/configure
-@@ -653,7 +653,11 @@ elif check_define _ARCH_PPC ; then
-       cpu="ppc64"
-     fi
-   else
--    cpu="ppc"
-+    if check_define _LITTLE_ENDIAN ; then
-+      cpu="ppcle"
-+    else
-+      cpu="ppc"
-+    fi
-   fi
- elif check_define __mips__ ; then
-   cpu="mips"
-@@ -638,6 +642,9 @@
- 
-   ppc)
-     CPU_CFLAGS="-m32" ;;
-+  ppcle)
-+    cpu="ppc"
-+    CPU_CFLAGS="-m32 -mlittle-endian" ;;
-   ppc64)
-     CPU_CFLAGS="-m64 -mbig-endian" ;;
-   ppc64le)
-diff --git a/configs/targets/ppcle-linux-user.mak b/configs/targets/ppcle-linux-user.mak
-new file mode 100644
-index 0000000..2259243
---- /dev/null
-+++ b/configs/targets/ppcle-linux-user.mak
-@@ -0,0 +1,4 @@
-+TARGET_ARCH=ppc
-+TARGET_SYSTBL_ABI=common,nospu,32
-+TARGET_SYSTBL=syscall.tbl
-+TARGET_XML_FILES= gdb-xml/power-core.xml gdb-xml/power-fpu.xml gdb-xml/power-altivec.xml gdb-xml/power-spe.xml
-diff --git a/linux-user/ppc/target_syscall.h b/linux-user/ppc/target_syscall.h
-index b9c4b81..cf26497 100644
---- a/linux-user/ppc/target_syscall.h
-+++ b/linux-user/ppc/target_syscall.h
-@@ -65,7 +65,11 @@ struct target_revectored_struct {
- #define UNAME_MACHINE "ppc64le"
- #endif
- #else
-+#if TARGET_BIG_ENDIAN
- #define UNAME_MACHINE "ppc"
-+#else
-+#define UNAME_MACHINE "ppcle"
-+#endif
- #endif
- #define UNAME_MINIMUM_RELEASE "2.6.32"
- 
-diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh
-index 9f1580a..393943f 100755
---- a/scripts/qemu-binfmt-conf.sh
-+++ b/scripts/qemu-binfmt-conf.sh
-@@ -46,6 +46,10 @@ ppc_magic='\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x
- ppc_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
- ppc_family=ppc
- 
-+ppcle_magic='\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x14\x00'
-+ppcle_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\x00'
-+ppc_family=ppcle
-+
- ppc64_magic='\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x15'
- ppc64_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
- ppc64_family=ppc
-@@ -148,7 +152,7 @@ qemu_get_family() {
-     "Power Macintosh"|ppc64|powerpc|ppc)
-         echo "ppc"
-         ;;
--    ppc64el|ppc64le)
-+    ppc64el|ppc64le|ppcel|ppcle)
-         echo "ppcle"
-         ;;
-     arm|armel|armhf|arm64|armv[4-9]*l|aarch64)
-diff --git a/configure b/configure
-index 72ab03f11a..0691929d76 100755
---- a/configure
-+++ b/configure
-@@ -1866,6 +1866,7 @@ fi
- : ${cross_prefix_mips="mips-linux-gnu-"}
- : ${cross_prefix_nios2="nios2-linux-gnu-"}
- : ${cross_prefix_ppc="powerpc-linux-gnu-"}
-+: ${cross_prefix_ppcle="powerpcle-linux-gnu-"}
- : ${cross_prefix_ppc64="powerpc64-linux-gnu-"}
- : ${cross_prefix_ppc64le="$cross_prefix_ppc64"}
- : ${cross_prefix_riscv64="riscv64-linux-gnu-"}
-@@ -1883,6 +1884,7 @@ fi
- : ${cross_cc_cflags_hexagon="-mv67 -O2 -static"}
- : ${cross_cc_cflags_i386="-m32"}
- : ${cross_cc_cflags_ppc="-m32 -mbig-endian"}
-+: ${cross_cc_cflags_ppcle="-m32"}
- : ${cross_cc_cflags_ppc64="-m64 -mbig-endian"}
- : ${cross_cc_ppc64le="$cross_cc_ppc64"}
- : ${cross_cc_cflags_ppc64le="-m64 -mlittle-endian"}
-2.30.1
-
diff --git a/srcpkgs/qemu/template b/srcpkgs/qemu/template
index 48ab199e5686..c64664055bf9 100644
--- a/srcpkgs/qemu/template
+++ b/srcpkgs/qemu/template
@@ -1,8 +1,8 @@
 # Template file for 'qemu'
 # This package should be updated together with qemu-user-static
 pkgname=qemu
-version=7.1.0
-revision=2
+version=8.0.3
+revision=1
 build_style=configure
 configure_args="--prefix=/usr --sysconfdir=/etc --libexecdir=/usr/libexec --localstatedir=/var
  --disable-glusterfs --disable-xen --enable-docs --enable-kvm --enable-libusb --enable-pie
@@ -10,10 +10,10 @@ configure_args="--prefix=/usr --sysconfdir=/etc --libexecdir=/usr/libexec --loca
  --audio-drv-list=alsa$(vopt_if sdl2 ,sdl)$(vopt_if jack ,jack)$(vopt_if pulseaudio ,pa)
  $(vopt_enable opengl) $(vopt_enable pulseaudio pa) $(vopt_enable sdl2 sdl) $(vopt_enable smartcard)
  $(vopt_enable spice) $(vopt_enable virgl virglrenderer) $(vopt_if gtk3 '--enable-gtk')"
-hostmakedepends="gettext pkg-config perl python3 python3-Sphinx python3-sphinx_rtd_theme ninja"
+hostmakedepends="flex gettext glib-devel pkg-config perl python3 python3-Sphinx python3-sphinx_rtd_theme ninja"
 makedepends="capstone-devel dtc-devel libpng-devel libjpeg-turbo-devel pixman-devel
- snappy-devel libuuid-devel libX11-devel alsa-lib-devel libaio-devel gnutls-devel
- libsasl-devel libglib-devel ncurses-devel libseccomp-devel nss-devel
+ snappy-devel libuuid-devel libX11-devel alsa-lib-devel libaio-devel
+ gnutls-devel libsasl-devel ncurses-devel libseccomp-devel nss-devel
  libcurl-devel xfsprogs-devel libcap-ng-devel vde2-devel usbredir-devel
  libbluetooth-devel libssh2-devel libusb-devel libnfs-devel libslirp-devel
  libxkbcommon-devel libzstd-devel $(vopt_if sdl2 'SDL2-devel SDL2_image-devel')
@@ -25,17 +25,17 @@ makedepends="capstone-devel dtc-devel libpng-devel libjpeg-turbo-devel pixman-de
  $(vopt_if jack 'jack-devel') $(vopt_if pulseaudio 'pulseaudio-devel')"
 short_desc="Open Source Processor Emulator"
 maintainer="Orphaned <orphan@voidlinux.org>"
-license="GPL-2.0-or-later, LGPL-2.1-or-later"
+license="GPL-2.0-only, LGPL-2.1-only"
 homepage="https://www.qemu.org"
 distfiles="https://wiki.qemu.org/download/qemu-${version}.tar.bz2"
-checksum=f7ac2b85b3f1831e6810b140306e30af91556e15784864b209f3942858947fd0
+checksum=bb7113cd3761927621df11ec7f7ad438f868e1815f46f5dddf46a14ceb77e8e6
 ignore_elf_dirs="/usr/share/qemu"
 nostrip_files="hppa-firmware.img openbios-ppc openbios-sparc32 openbios-sparc64
  palcode-clipper s390-ccw.img s390-netboot.img u-boot.e500 opensbi-riscv32-generic-fw_dynamic.elf
  opensbi-riscv64-generic-fw_dynamic.elf"
 
-build_options="gtk3 opengl sdl2 spice virgl smartcard numa iscsi jack pulseaudio"
-build_options_default="opengl gtk3 virgl sdl2 numa iscsi jack pulseaudio"
+build_options="gtk3 iscsi jack numa opengl pulseaudio sdl2 smartcard spice virgl"
+build_options_default="gtk3 iscsi jack numa opengl pulseaudio sdl2 smartcard spice virgl"
 desc_option_sdl2="Enable SDL (2.x) video output"
 desc_option_spice="Enable support for SPICE"
 desc_option_virgl="Enable support for VirGL (A Virtual 3D GPU renderer)"
@@ -43,37 +43,10 @@ desc_option_smartcard="Enable smartcard support"
 desc_option_numa="Enable support for host NUMA"
 desc_option_iscsi="Enable support for iSCSI"
 
-case "$XBPS_TARGET_MACHINE" in
-	aarch64-musl) CFLAGS="-D_LINUX_SYSINFO_H";;
-esac
-
-if [ "$XBPS_TARGET_ENDIAN" = "le" ]; then
-	build_options_default+=" spice"
-fi
-
 if [ "$CROSS_BUILD" ]; then
-	configure_args+=" --cross-prefix=${XBPS_CROSS_TRIPLET}-"
-else
-	build_options_default+=" smartcard"
-fi
-
-if [ "$XBPS_CHECK_PKGS" != full ]; then
-	make_check_target=check-unit
+	configure_args+=" --cross-prefix=${XBPS_CROSS_TRIPLET}"
 fi
 
-post_extract() {
-	if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
-		grep -rl 'Input/output error' tests/qemu-iotests |
-			xargs -n1 sed -i -e 's;Input/output error;I/O error;g'
-		grep -rl 'Operation not supported' tests/qemu-iotests |
-			xargs -n1 sed -i -e 's;Operation not supported;Not supported;g'
-	fi
-}
-
-pre_configure() {
-	unset CPP
-}
-
 post_install() {
 	vdoc "${FILESDIR}/README.voidlinux"
 

From 7b1e2b9ae5102edddc9acb76ff9babb04e3dcdd0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Cerqueira?= <acerqueira021@gmail.com>
Date: Mon, 3 Jul 2023 18:41:30 +0100
Subject: [PATCH 2/2] qemu-user-static: update to 8.0.3.

---
 srcpkgs/qemu-user-static/template | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/srcpkgs/qemu-user-static/template b/srcpkgs/qemu-user-static/template
index 2a8da9b53f2d..ed2734e9aebd 100644
--- a/srcpkgs/qemu-user-static/template
+++ b/srcpkgs/qemu-user-static/template
@@ -1,20 +1,20 @@
 # Template file for 'qemu-user-static'
 # This package should be updated together with qemu
 pkgname=qemu-user-static
-version=7.1.0
-revision=3
+version=8.0.3
+revision=1
 build_style=configure
 configure_args="--prefix=/usr --sysconfdir=/etc --libexecdir=/usr/libexec
  --disable-kvm --disable-png --disable-virtfs --disable-fdt --disable-seccomp
  --enable-linux-user --disable-system --static --disable-pie"
-hostmakedepends="pkg-config perl python3 ninja"
+hostmakedepends="flex glib-devel pkg-config perl python3 ninja"
 makedepends="dtc-devel libglib-devel pixman-devel libuuid-devel"
 short_desc="QEMU User-mode emulators (statically compiled)"
 maintainer="Orphaned <orphan@voidlinux.org>"
-license="GPL-2.0-or-later, LGPL-2.1-or-later"
+license="GPL-2.0-only, LGPL-2.1-only"
 homepage="https://www.qemu.org"
 distfiles="https://wiki.qemu.org/download/qemu-${version}.tar.bz2"
-checksum=f7ac2b85b3f1831e6810b140306e30af91556e15784864b209f3942858947fd0
+checksum=bb7113cd3761927621df11ec7f7ad438f868e1815f46f5dddf46a14ceb77e8e6
 
 _fmts="aarch64 aarch64_be alpha arm armeb cris hppa i386 m68k microblaze
  microblazeel mips mipsel mips64 mips64el mipsn32 mipsn32el or1k
@@ -111,10 +111,6 @@ done
 
 binfmts="${binfmts%?}"
 
-pre_configure() {
-	unset CPP
-}
-
 post_install() {
 	# Remove unneeded stuff.
 	rm -rf ${DESTDIR}/etc ${DESTDIR}/usr/share ${DESTDIR}/usr/libexec

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [PR PATCH] [Updated] qemu: update to 8.0.3.
  2023-07-03 17:50 [PR PATCH] qemu: update to 8.0.2 motorto
                   ` (25 preceding siblings ...)
  2023-07-19 17:21 ` [PR PATCH] [Updated] " motorto
@ 2023-07-19 17:22 ` motorto
  2023-07-19 17:22 ` motorto
                   ` (11 subsequent siblings)
  38 siblings, 0 replies; 40+ messages in thread
From: motorto @ 2023-07-19 17:22 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1827 bytes --]

There is an updated pull request by motorto against master on the void-packages repository

https://github.com/motorto/void-packages qemu-8.0.2
https://github.com/void-linux/void-packages/pull/44822

qemu: update to 8.0.3.
<!-- Uncomment relevant sections and delete options which are not applicable -->
[ci-skip] 

Draft because of: https://github.com/void-linux/void-packages/pull/44822#issuecomment-1633611714


#### Testing the changes
- I tested the changes in this PR: **YES**, runned a Windows vm machine and it worked fine.

Removed a bunch of patches that in my research are no longer needed:

- Removed all ppc related patches since that arch isn't no longer supported.
- gcc12.patch: because it builds fine now in this version
- fix-softfloat-fesetround.patch: don't have a system to try it, but alpine doesn't have any patch related to this)
- mmap-mremap-efaul: not sure about if we should keep this one

Kept this patches:

- musl-initialize-msghdr.patch: just update in order to apply.

Added this ones:

- ~~CVE-2023-2861.patch~~
- ~~keymap.patch: xkeyboard-config 2.39 removed the legacy alias of ar -> ara~~
- fix-brk0.patch: make sure that initial brk(0) is page-aligned
- lfs64.patch: Builds defines -D_FILE_OFFSET_BITS=64 which makes the original functions
anf macros behave same as their 64 suffixed counterparts. This also
helps in compiling with latest musl C library, where these macros and
functions are no more available under _GNU_SOURCE feature macro

#### Local build testing
- I built this PR locally for my native architecture, x86-64-glibc
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl (cross)
  - x86_64-musl



A patch file from https://github.com/void-linux/void-packages/pull/44822.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-qemu-8.0.2-44822.patch --]
[-- Type: text/x-diff, Size: 35458 bytes --]

From c8479ce424e219da814cdbbb2d09bccb00e029d4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Cerqueira?= <acerqueira021@gmail.com>
Date: Mon, 3 Jul 2023 18:41:12 +0100
Subject: [PATCH 1/2] qemu: update to 8.0.3.

---
 srcpkgs/qemu/patches/fix-brk0.patch           |  30 +++
 .../qemu/patches/fix-linux-user-ppc32.patch   | 117 ----------
 .../patches/fix-softfloat-fesetround.patch    |  39 ----
 srcpkgs/qemu/patches/gcc12.patch              |  72 ------
 srcpkgs/qemu/patches/lfs64.patch              | 213 ++++++++++++++++++
 srcpkgs/qemu/patches/mmap-mremap-efault.patch |  42 ----
 .../qemu/patches/musl-initialize-msghdr.patch |   6 +-
 srcpkgs/qemu/patches/musl-ppc.patch           |  25 --
 srcpkgs/qemu/patches/musl-rlimit-rttime.patch |  13 --
 srcpkgs/qemu/patches/xxx-ppcle.patch          | 113 ----------
 srcpkgs/qemu/template                         |  47 +---
 11 files changed, 256 insertions(+), 461 deletions(-)
 create mode 100644 srcpkgs/qemu/patches/fix-brk0.patch
 delete mode 100644 srcpkgs/qemu/patches/fix-linux-user-ppc32.patch
 delete mode 100644 srcpkgs/qemu/patches/fix-softfloat-fesetround.patch
 delete mode 100644 srcpkgs/qemu/patches/gcc12.patch
 create mode 100644 srcpkgs/qemu/patches/lfs64.patch
 delete mode 100644 srcpkgs/qemu/patches/mmap-mremap-efault.patch
 delete mode 100644 srcpkgs/qemu/patches/musl-ppc.patch
 delete mode 100644 srcpkgs/qemu/patches/musl-rlimit-rttime.patch
 delete mode 100644 srcpkgs/qemu/patches/xxx-ppcle.patch

diff --git a/srcpkgs/qemu/patches/fix-brk0.patch b/srcpkgs/qemu/patches/fix-brk0.patch
new file mode 100644
index 000000000000..0ec31a1ff3bc
--- /dev/null
+++ b/srcpkgs/qemu/patches/fix-brk0.patch
@@ -0,0 +1,30 @@
+From d28b3c90cfad1a7e211ae2bce36ecb9071086129 Mon Sep 17 00:00:00 2001
+From: Andreas Schwab <schwab@suse.de>
+Date: Thu, 6 Jul 2023 13:34:19 +0200
+Subject: [PATCH] linux-user: Make sure initial brk(0) is page-aligned
+
+Fixes: 86f04735ac ("linux-user: Fix brk() to release pages")
+Signed-off-by: Andreas Schwab <schwab@suse.de>
+Message-Id: <mvmpm55qnno.fsf@suse.de>
+Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
+Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
+---
+ linux-user/syscall.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/linux-user/syscall.c b/linux-user/syscall.c
+index b78eb686d8..02d3b6c90a 100644
+--- a/linux-user/syscall.c
++++ b/linux-user/syscall.c
+@@ -806,7 +806,7 @@ static abi_ulong brk_page;
+ 
+ void target_set_brk(abi_ulong new_brk)
+ {
+-    target_brk = new_brk;
++    target_brk = TARGET_PAGE_ALIGN(new_brk);
+     brk_page = HOST_PAGE_ALIGN(target_brk);
+ }
+ 
+-- 
+GitLab
+
diff --git a/srcpkgs/qemu/patches/fix-linux-user-ppc32.patch b/srcpkgs/qemu/patches/fix-linux-user-ppc32.patch
deleted file mode 100644
index cd47435d5aa9..000000000000
--- a/srcpkgs/qemu/patches/fix-linux-user-ppc32.patch
+++ /dev/null
@@ -1,117 +0,0 @@
-commit 37814f62c2cc7aba2eea073014d6c53dcd5bf42c
-Author: q66 <daniel@octaforge.org>
-Date:   Fri Jul 1 16:53:55 2022 +0200
-
-    fix linux-user build on 32-bit ppc
-    
-    Partial revert https://gitlab.com/qemu-project/qemu/-/commit/9d1401b79463e74adbfac69d836789d4e103fb61
-    and https://gitlab.com/qemu-project/qemu/-/commit/0a7e01904d407baa73c1baddbdfc9ccf2ace8356
-
-diff --git a/common-user/host/ppc/safe-syscall.inc.S b/common-user/host/ppc/safe-syscall.inc.S
-new file mode 100644
-index 0000000..e69de29
-diff --git a/common-user/safe-syscall-error.c b/common-user/safe-syscall-error.c
-index cf74b50..a36132c 100644
---- a/common-user/safe-syscall-error.c
-+++ b/common-user/safe-syscall-error.c
-@@ -12,6 +12,7 @@
- #include "qemu/osdep.h"
- #include "user/safe-syscall.h"
- 
-+#if !defined(__powerpc__) || defined(__powerpc64__)
- /*
-  * This is intended to be invoked via tail-call on the error path
-  * from the assembly in host/arch/safe-syscall.inc.S.  This takes
-@@ -23,3 +24,4 @@ long safe_syscall_set_errno_tail(int value)
-     errno = value;
-     return -1;
- }
-+#endif
-diff --git a/include/user/safe-syscall.h b/include/user/safe-syscall.h
-index 61a04e2..793fe84 100644
---- a/include/user/safe-syscall.h
-+++ b/include/user/safe-syscall.h
-@@ -125,6 +125,8 @@
-  * kinds of restartability.
-  */
- 
-+#if !defined(__powerpc__) || defined(__powerpc64__)
-+
- /* The core part of this function is implemented in assembly */
- extern long safe_syscall_base(int *pending, long number, ...);
- extern long safe_syscall_set_errno_tail(int value);
-@@ -137,4 +139,10 @@ extern char safe_syscall_end[];
-     safe_syscall_base(&((TaskState *)thread_cpu->opaque)->signal_pending, \
-                       __VA_ARGS__)
- 
-+#else
-+
-+#define safe_syscall syscall
-+
-+#endif
-+
- #endif
-diff --git a/linux-user/include/host/ppc/host-signal.h b/linux-user/include/host/ppc/host-signal.h
-new file mode 100644
-index 0000000..b80384d
---- /dev/null
-+++ b/linux-user/include/host/ppc/host-signal.h
-@@ -0,0 +1,38 @@
-+/*
-+ * host-signal.h: signal info dependent on the host architecture
-+ *
-+ * Copyright (c) 2003-2005 Fabrice Bellard
-+ * Copyright (c) 2021 Linaro Limited
-+ *
-+ * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
-+ * See the COPYING file in the top-level directory.
-+ */
-+
-+#ifndef PPC_HOST_SIGNAL_H
-+#define PPC_HOST_SIGNAL_H
-+
-+/* The third argument to a SA_SIGINFO handler is ucontext_t. */
-+typedef ucontext_t host_sigcontext;
-+
-+static inline uintptr_t host_signal_pc(host_sigcontext *uc)
-+{
-+    return uc->uc_mcontext.regs->nip;
-+}
-+
-+static inline void host_signal_set_pc(host_sigcontext *uc, uintptr_t pc)
-+{
-+    uc->uc_mcontext.regs->nip = pc;
-+}
-+
-+static inline void *host_signal_mask(host_sigcontext *uc)
-+{
-+    return &uc->uc_sigmask;
-+}
-+
-+static inline bool host_signal_write(siginfo_t *info, host_sigcontext *uc)
-+{
-+    return uc->uc_mcontext.regs->trap != 0x400
-+        && (uc->uc_mcontext.regs->dsisr & 0x02000000);
-+}
-+
-+#endif
-diff --git a/linux-user/signal.c b/linux-user/signal.c
-index 092e70b..b8dfa8a 100644
---- a/linux-user/signal.c
-+++ b/linux-user/signal.c
-@@ -800,6 +800,7 @@ void queue_signal(CPUArchState *env, int sig, int si_type,
- /* Adjust the signal context to rewind out of safe-syscall if we're in it */
- static inline void rewind_if_in_safe_syscall(void *puc)
- {
-+#if !defined(__powerpc__) || defined(__powerpc64__)
-     host_sigcontext *uc = (host_sigcontext *)puc;
-     uintptr_t pcreg = host_signal_pc(uc);
- 
-@@ -807,6 +808,7 @@ static inline void rewind_if_in_safe_syscall(void *puc)
-         && pcreg < (uintptr_t)safe_syscall_end) {
-         host_signal_set_pc(uc, (uintptr_t)safe_syscall_start);
-     }
-+#endif
- }
- 
- static void host_signal_handler(int host_sig, siginfo_t *info, void *puc)
diff --git a/srcpkgs/qemu/patches/fix-softfloat-fesetround.patch b/srcpkgs/qemu/patches/fix-softfloat-fesetround.patch
deleted file mode 100644
index ecdd049f7921..000000000000
--- a/srcpkgs/qemu/patches/fix-softfloat-fesetround.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-Source: @pullmoll
-Upstream: no
-Reason: Target architectures with soft float do not define these constants.
-
---- a/tests/fp/fp-bench.c	2020-12-08 17:59:44.000000000 +0100
-+++ b/tests/fp/fp-bench.c	2020-12-12 20:38:40.702235420 +0100
-@@ -485,16 +485,32 @@
- 
-     switch (rounding) {
-     case ROUND_EVEN:
-+#if defined(FE_TONEAREST)
-         rhost = FE_TONEAREST;
-+#else
-+	return;
-+#endif
-         break;
-     case ROUND_ZERO:
-+#if defined(FE_TOWARDZERO)
-         rhost = FE_TOWARDZERO;
-+#else
-+	return;
-+#endif
-         break;
-     case ROUND_DOWN:
-+#if defined(FE_DOWNWARD)
-         rhost = FE_DOWNWARD;
-+#else
-+	return;
-+#endif
-         break;
-     case ROUND_UP:
-+#if defined(FE_UPWARD)
-         rhost = FE_UPWARD;
-+#else
-+	return;
-+#endif
-         break;
-     case ROUND_TIEAWAY:
-         die_host_rounding(rounding);
diff --git a/srcpkgs/qemu/patches/gcc12.patch b/srcpkgs/qemu/patches/gcc12.patch
deleted file mode 100644
index 2a4b2bd03609..000000000000
--- a/srcpkgs/qemu/patches/gcc12.patch
+++ /dev/null
@@ -1,72 +0,0 @@
-From 5cb993ff131fca2abef3ce074a20258fd6fce557 Mon Sep 17 00:00:00 2001
-From: Bernhard Beschow <shentey@gmail.com>
-Date: Sat, 18 Mar 2023 19:59:31 +0100
-Subject: [PATCH] qemu/osdep: Switch position of "extern" and "G_NORETURN"
-
-Fixes the Windows build under msys2 using GCC 12 which fails with the following
-error:
-
-  [184/579] Compiling C++ object qga/vss-win32/qga-vss.dll.p/install.cpp.obj
-  FAILED: qga/vss-win32/qga-vss.dll.p/install.cpp.obj
-  "c++" "-m64" "-mcx16" "-Iqga/vss-win32/qga-vss.dll.p" "-Iqga/vss-win32" "-I../src/qga/vss-win32" "-I." "-Iqapi" "-Itrace" "-Iui" "-Iui/shader" "-IC:/msys64/mingw64/include/glib-2.0" "-IC:/msys64/mingw64/lib/glib-2.0/include" "-fdiagnostics-color=auto" "-Wall" "-Winvalid-pch" "-Wnon-virtual-dtor" "-Werror" "-std=gnu++11" "-g" "-iquote" "." "-iquote" "C:/msys64/home/shentey/Projects/qemu/src" "-iquote" "C:/msys64/home/shentey/Projects/qemu/src/include" "-iquote" "C:/msys64/home/shentey/Projects/qemu/src/tcg/i386" "-D__STDC_LIMIT_MACROS" "-D__STDC_CONSTANT_MACROS" "-D__STDC_FORMAT_MACROS" "-fno-pie" "-no-pie" "-D_GNU_SOURCE" "-D_FILE_OFFSET_BITS=64" "-D_LARGEFILE_SOURCE" "-fno-strict-aliasing" "-fno-common" "-fwrapv" "-Wundef" "-Wwrite-strings" "-Wtype-limits" "-Wformat-security" "-Wformat-y2k" "-Winit-self" "-Wignored-qualifiers" "-Wempty-body" "-Wendif-labels" "-Wexpansion-to-defined" "-Wimplicit-fallthrough=2" "-Wmissing-format-attribute" "-Wno-missing-include-dirs" "-Wno-shift-negative-value" "-Wno-psabi" "-fstack-protector-strong" "-Wno-unknown-pragmas" "-Wno-delete-non-virtual-dtor" "-Wno-non-virtual-dtor" -MD -MQ qga/vss-win32/qga-vss.dll.p/install.cpp.obj -MF "qga/vss-win32/qga-vss.dll.p/install.cpp.obj.d" -o qga/vss-win32/qga-vss.dll.p/install.cpp.obj "-c" ../src/qga/vss-win32/install.cpp
-  In file included from C:/msys64/mingw64/lib/glib-2.0/include/glibconfig.h:9,
-              from C:/msys64/mingw64/include/glib-2.0/glib/gtypes.h:34,
-              from C:/msys64/mingw64/include/glib-2.0/glib/galloca.h:34,
-              from C:/msys64/mingw64/include/glib-2.0/glib.h:32,
-              from C:/msys64/home/shentey/Projects/qemu/src/include/glib-compat.h:32,
-              from C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:144,
-              from ../src/qga/vss-win32/install.cpp:13:
-  C:/msys64/mingw64/include/glib-2.0/glib/gmacros.h:1075:21: error: standard attributes in middle of decl-specifiers
-  1075 | # define G_NORETURN [[noreturn]]
-        |                     ^
-  C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:240:8: note: in expansion of macro 'G_NORETURN'
-  240 | extern G_NORETURN
-        |        ^~~~~~~~~~
-  C:/msys64/mingw64/include/glib-2.0/glib/gmacros.h:1075:21: note: standard attributes must precede the decl-specifiers to apply to the declaration, or follow them to apply to the type
-  1075 | # define G_NORETURN [[noreturn]]
-        |                     ^
-  C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:240:8: note: in expansion of macro 'G_NORETURN'
-  240 | extern G_NORETURN
-        |        ^~~~~~~~~~
-  C:/msys64/mingw64/include/glib-2.0/glib/gmacros.h:1075:21: error: attribute ignored [-Werror=attributes]
-  1075 | # define G_NORETURN [[noreturn]]
-        |                     ^
-  C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:240:8: note: in expansion of macro 'G_NORETURN'
-  240 | extern G_NORETURN
-        |        ^~~~~~~~~~
-  C:/msys64/mingw64/include/glib-2.0/glib/gmacros.h:1075:21: note: an attribute that appertains to a type-specifier is ignored
-  1075 | # define G_NORETURN [[noreturn]]
-        |                     ^
-  C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:240:8: note: in expansion of macro 'G_NORETURN'
-  240 | extern G_NORETURN
-        |        ^~~~~~~~~~
-  cc1plus.exe: all warnings being treated as errors
-
-Apparently it also fixes the compilation with Clang 15 (see
-https://gitlab.com/qemu-project/qemu/-/issues/1541 ).
-
-Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1541
-Signed-off-by: Bernhard Beschow <shentey@gmail.com>
-Message-Id: <20230318185931.181659-1-shentey@gmail.com>
-Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
-Signed-off-by: Thomas Huth <thuth@redhat.com>
----
- include/qemu/osdep.h | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
-index f68b5d8708c..9eff0be95bd 100644
---- a/include/qemu/osdep.h
-+++ b/include/qemu/osdep.h
-@@ -237,7 +237,7 @@ extern "C" {
-  * supports QEMU_ERROR, this will be reported at compile time; otherwise
-  * this will be reported at link time due to the missing symbol.
-  */
--extern G_NORETURN
-+G_NORETURN extern
- void QEMU_ERROR("code path is reachable")
-     qemu_build_not_reached_always(void);
- #if defined(__OPTIMIZE__) && !defined(__NO_INLINE__)
--- 
-GitLab
-
diff --git a/srcpkgs/qemu/patches/lfs64.patch b/srcpkgs/qemu/patches/lfs64.patch
new file mode 100644
index 000000000000..35d09ef028df
--- /dev/null
+++ b/srcpkgs/qemu/patches/lfs64.patch
@@ -0,0 +1,213 @@
+Builds defines -D_FILE_OFFSET_BITS=64 which makes the original functions
+anf macros behave same as their 64 suffixed counterparts. This also
+helps in compiling with latest musl C library, where these macros and
+functions are no more available under _GNU_SOURCE feature macro
+
+source: https://git.alpinelinux.org/aports/plain/community/qemu/lfs64.patch
+--
+
+diff --git a/linux-user/syscall.c b/linux-user/syscall.c
+index bbba2a6..38fa09a 100644
+--- a/linux-user/syscall.c
++++ b/linux-user/syscall.c
+@@ -6812,13 +6812,13 @@ static int target_to_host_fcntl_cmd(int cmd)
+         ret = cmd;
+         break;
+     case TARGET_F_GETLK:
+-        ret = F_GETLK64;
++        ret = F_GETLK;
+         break;
+     case TARGET_F_SETLK:
+-        ret = F_SETLK64;
++        ret = F_SETLK;
+         break;
+     case TARGET_F_SETLKW:
+-        ret = F_SETLKW64;
++        ret = F_SETLKW;
+         break;
+     case TARGET_F_GETOWN:
+         ret = F_GETOWN;
+@@ -6834,13 +6834,13 @@ static int target_to_host_fcntl_cmd(int cmd)
+         break;
+ #if TARGET_ABI_BITS == 32
+     case TARGET_F_GETLK64:
+-        ret = F_GETLK64;
++        ret = F_GETLK;
+         break;
+     case TARGET_F_SETLK64:
+-        ret = F_SETLK64;
++        ret = F_SETLK;
+         break;
+     case TARGET_F_SETLKW64:
+-        ret = F_SETLKW64;
++        ret = F_SETLKW;
+         break;
+ #endif
+     case TARGET_F_SETLEASE:
+@@ -6894,8 +6894,8 @@ static int target_to_host_fcntl_cmd(int cmd)
+      * them to 5, 6 and 7 before making the syscall(). Since we make the
+      * syscall directly, adjust to what is supported by the kernel.
+      */
+-    if (ret >= F_GETLK64 && ret <= F_SETLKW64) {
+-        ret -= F_GETLK64 - 5;
++    if (ret >= F_GETLK && ret <= F_SETLKW) {
++        ret -= F_GETLK - 5;
+     }
+ #endif
+ 
+@@ -6928,7 +6928,7 @@ static int host_to_target_flock(int type)
+     return type;
+ }
+ 
+-static inline abi_long copy_from_user_flock(struct flock64 *fl,
++static inline abi_long copy_from_user_flock(struct flock *fl,
+                                             abi_ulong target_flock_addr)
+ {
+     struct target_flock *target_fl;
+@@ -6953,7 +6953,7 @@ static inline abi_long copy_from_user_flock(struct flock64 *fl,
+ }
+ 
+ static inline abi_long copy_to_user_flock(abi_ulong target_flock_addr,
+-                                          const struct flock64 *fl)
++                                          const struct flock *fl)
+ {
+     struct target_flock *target_fl;
+     short l_type;
+@@ -6972,8 +6972,8 @@ static inline abi_long copy_to_user_flock(abi_ulong target_flock_addr,
+     return 0;
+ }
+ 
+-typedef abi_long from_flock64_fn(struct flock64 *fl, abi_ulong target_addr);
+-typedef abi_long to_flock64_fn(abi_ulong target_addr, const struct flock64 *fl);
++typedef abi_long from_flock64_fn(struct flock *fl, abi_ulong target_addr);
++typedef abi_long to_flock64_fn(abi_ulong target_addr, const struct flock *fl);
+ 
+ #if defined(TARGET_ARM) && TARGET_ABI_BITS == 32
+ struct target_oabi_flock64 {
+@@ -6984,7 +6984,7 @@ struct target_oabi_flock64 {
+     abi_int   l_pid;
+ } QEMU_PACKED;
+ 
+-static inline abi_long copy_from_user_oabi_flock64(struct flock64 *fl,
++static inline abi_long copy_from_user_oabi_flock64(struct flock *fl,
+                                                    abi_ulong target_flock_addr)
+ {
+     struct target_oabi_flock64 *target_fl;
+@@ -7009,7 +7009,7 @@ static inline abi_long copy_from_user_oabi_flock64(struct flock64 *fl,
+ }
+ 
+ static inline abi_long copy_to_user_oabi_flock64(abi_ulong target_flock_addr,
+-                                                 const struct flock64 *fl)
++                                                 const struct flock *fl)
+ {
+     struct target_oabi_flock64 *target_fl;
+     short l_type;
+@@ -7029,7 +7029,7 @@ static inline abi_long copy_to_user_oabi_flock64(abi_ulong target_flock_addr,
+ }
+ #endif
+ 
+-static inline abi_long copy_from_user_flock64(struct flock64 *fl,
++static inline abi_long copy_from_user_flock64(struct flock *fl,
+                                               abi_ulong target_flock_addr)
+ {
+     struct target_flock64 *target_fl;
+@@ -7054,7 +7054,7 @@ static inline abi_long copy_from_user_flock64(struct flock64 *fl,
+ }
+ 
+ static inline abi_long copy_to_user_flock64(abi_ulong target_flock_addr,
+-                                            const struct flock64 *fl)
++                                            const struct flock *fl)
+ {
+     struct target_flock64 *target_fl;
+     short l_type;
+@@ -7075,7 +7075,7 @@ static inline abi_long copy_to_user_flock64(abi_ulong target_flock_addr,
+ 
+ static abi_long do_fcntl(int fd, int cmd, abi_ulong arg)
+ {
+-    struct flock64 fl64;
++    struct flock fl64;
+ #ifdef F_GETOWN_EX
+     struct f_owner_ex fox;
+     struct target_f_owner_ex *target_fox;
+@@ -7347,7 +7347,7 @@ static inline abi_long target_truncate64(CPUArchState *cpu_env, const char *arg1
+         arg2 = arg3;
+         arg3 = arg4;
+     }
+-    return get_errno(truncate64(arg1, target_offset64(arg2, arg3)));
++    return get_errno(truncate(arg1, target_offset64(arg2, arg3)));
+ }
+ #endif
+ 
+@@ -7361,7 +7361,7 @@ static inline abi_long target_ftruncate64(CPUArchState *cpu_env, abi_long arg1,
+         arg2 = arg3;
+         arg3 = arg4;
+     }
+-    return get_errno(ftruncate64(arg1, target_offset64(arg2, arg3)));
++    return get_errno(ftruncate(arg1, target_offset64(arg2, arg3)));
+ }
+ #endif
+ 
+@@ -8597,7 +8597,7 @@ static int do_getdents(abi_long dirfd, abi_long arg2, abi_long count)
+     void *tdirp;
+     int hlen, hoff, toff;
+     int hreclen, treclen;
+-    off64_t prev_diroff = 0;
++    off_t prev_diroff = 0;
+ 
+     hdirp = g_try_malloc(count);
+     if (!hdirp) {
+@@ -8650,7 +8650,7 @@ static int do_getdents(abi_long dirfd, abi_long arg2, abi_long count)
+              * Return what we have, resetting the file pointer to the
+              * location of the first record not returned.
+              */
+-            lseek64(dirfd, prev_diroff, SEEK_SET);
++            lseek(dirfd, prev_diroff, SEEK_SET);
+             break;
+         }
+ 
+@@ -8684,7 +8684,7 @@ static int do_getdents64(abi_long dirfd, abi_long arg2, abi_long count)
+     void *tdirp;
+     int hlen, hoff, toff;
+     int hreclen, treclen;
+-    off64_t prev_diroff = 0;
++    off_t prev_diroff = 0;
+ 
+     hdirp = g_try_malloc(count);
+     if (!hdirp) {
+@@ -8726,7 +8726,7 @@ static int do_getdents64(abi_long dirfd, abi_long arg2, abi_long count)
+              * Return what we have, resetting the file pointer to the
+              * location of the first record not returned.
+              */
+-            lseek64(dirfd, prev_diroff, SEEK_SET);
++            lseek(dirfd, prev_diroff, SEEK_SET);
+             break;
+         }
+ 
+@@ -11157,7 +11157,7 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,
+                 return -TARGET_EFAULT;
+             }
+         }
+-        ret = get_errno(pread64(arg1, p, arg3, target_offset64(arg4, arg5)));
++        ret = get_errno(pread(arg1, p, arg3, target_offset64(arg4, arg5)));
+         unlock_user(p, arg2, ret);
+         return ret;
+     case TARGET_NR_pwrite64:
+@@ -11174,7 +11174,7 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,
+                 return -TARGET_EFAULT;
+             }
+         }
+-        ret = get_errno(pwrite64(arg1, p, arg3, target_offset64(arg4, arg5)));
++        ret = get_errno(pwrite(arg1, p, arg3, target_offset64(arg4, arg5)));
+         unlock_user(p, arg2, 0);
+         return ret;
+ #endif
+@@ -12034,7 +12034,7 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,
+     case TARGET_NR_fcntl64:
+     {
+         int cmd;
+-        struct flock64 fl;
++        struct flock fl;
+         from_flock64_fn *copyfrom = copy_from_user_flock64;
+         to_flock64_fn *copyto = copy_to_user_flock64;
+ 
+
diff --git a/srcpkgs/qemu/patches/mmap-mremap-efault.patch b/srcpkgs/qemu/patches/mmap-mremap-efault.patch
deleted file mode 100644
index 5a70e9658b30..000000000000
--- a/srcpkgs/qemu/patches/mmap-mremap-efault.patch
+++ /dev/null
@@ -1,42 +0,0 @@
-Source: @pullmoll
-Upstream: no
-Reason: errno=EFAULT when the address passed to mremap(2) is not valid
-
-See Rich Felker's comment at https://www.openwall.com/lists/musl/2017/06/21/2 for
-why we need to return errno as described in man mremap(2) from qemu-user-static.
-Also speed up the loop when checking for increasing the mappings size to go
-in steps of TARGET_PAGE_SIZE and OR-in a check for the very last byte of the range.
-diff --git linux-user/mmap.c linux-user/mmap.c
-index 7e3b245..1e8d0f1 100644
---- a/linux-user/mmap.c
-+++ b/linux-user/mmap.c
-@@ -738,7 +738,7 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size,
-          !guest_range_valid_untagged(new_addr, new_size)) ||
-         ((flags & MREMAP_MAYMOVE) == 0 &&
-          !guest_range_valid_untagged(old_addr, new_size))) {
--        errno = ENOMEM;
-+        errno = EFAULT;
-         return -1;
-     }
- 
-@@ -775,9 +775,10 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size,
-             abi_ulong addr;
-             for (addr = old_addr + old_size;
-                  addr < old_addr + new_size;
--                 addr++) {
-+                 addr += TARGET_PAGE_SIZE) {
-                 prot |= page_get_flags(addr);
-             }
-+				prot |= page_get_flags(old_addr + new_size - 1);
-         }
-         if (prot == 0) {
-             host_addr = mremap(g2h_untagged(old_addr),
-@@ -796,7 +797,7 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size,
-                 }
-             }
-         } else {
--            errno = ENOMEM;
-+            errno = EFAULT;
-             host_addr = MAP_FAILED;
-         }
-     }
diff --git a/srcpkgs/qemu/patches/musl-initialize-msghdr.patch b/srcpkgs/qemu/patches/musl-initialize-msghdr.patch
index 6d96b3511daf..a88547354c1e 100644
--- a/srcpkgs/qemu/patches/musl-initialize-msghdr.patch
+++ b/srcpkgs/qemu/patches/musl-initialize-msghdr.patch
@@ -1,10 +1,10 @@
 Source: https://github.com/void-linux/void-packages/issues/23557
 
-diff --git linux-user/syscall.c linux-user/syscall.c
-index 945fc25..8d8b68a 100644
+diff --git a/linux-user/syscall.c b/linux-user/syscall.c
+index 14fdebd..de280af 100644
 --- a/linux-user/syscall.c
 +++ b/linux-user/syscall.c
-@@ -3071,7 +3071,7 @@ static abi_long do_sendrecvmsg_locked(int fd, struct target_msghdr *msgp,
+@@ -3229,7 +3229,7 @@ static abi_long do_sendrecvmsg_locked(int fd, struct target_msghdr *msgp,
                                        int flags, int send)
  {
      abi_long ret, len;
diff --git a/srcpkgs/qemu/patches/musl-ppc.patch b/srcpkgs/qemu/patches/musl-ppc.patch
deleted file mode 100644
index 0b77aa8fc63d..000000000000
--- a/srcpkgs/qemu/patches/musl-ppc.patch
+++ /dev/null
@@ -1,25 +0,0 @@
---- a/linux-user/signal.c
-+++ b/linux-user/signal.c
-@@ -21,5 +21,9 @@
- #include "exec/gdbstub.h"
- #include "hw/core/tcg-cpu-ops.h"
- 
-+#if defined(_ARCH_PPC64) && !defined(__GLIBC__) /* musl */
-+#include <asm/ptrace.h>
-+#endif
-+
- #include <sys/ucontext.h>
- #include <sys/resource.h>
---- a/util/mmap-alloc.c
-+++ b/util/mmap-alloc.c
-@@ -25,6 +25,10 @@
- 
- #ifdef CONFIG_LINUX
- #include <sys/vfs.h>
-+/* musl undefs this on ppc and mips */
-+#ifndef MAP_SYNC
-+#define MAP_SYNC 0x80000
-+#endif
- #endif
- 
- size_t qemu_fd_getpagesize(int fd)
diff --git a/srcpkgs/qemu/patches/musl-rlimit-rttime.patch b/srcpkgs/qemu/patches/musl-rlimit-rttime.patch
deleted file mode 100644
index 0cbf9be36a8f..000000000000
--- a/srcpkgs/qemu/patches/musl-rlimit-rttime.patch
+++ /dev/null
@@ -1,13 +0,0 @@
---- a/linux-user/syscall.c
-+++ b/linux-user/syscall.c
-@@ -141,6 +141,10 @@
- #include "fd-trans.h"
- #include "tcg/tcg.h"
- 
-+#ifndef RLIMIT_RTTIME
-+#define RLIMIT_RTTIME 15
-+#endif
-+
- #ifndef CLONE_IO
- #define CLONE_IO                0x80000000      /* Clone io context */
- #endif
diff --git a/srcpkgs/qemu/patches/xxx-ppcle.patch b/srcpkgs/qemu/patches/xxx-ppcle.patch
deleted file mode 100644
index 90b32b5e07cd..000000000000
--- a/srcpkgs/qemu/patches/xxx-ppcle.patch
+++ /dev/null
@@ -1,113 +0,0 @@
-From 7ece08d7902d5a8c007deeb0b75cb533a41dd882 Mon Sep 17 00:00:00 2001
-From: Daniel Kolesa <daniel@octaforge.org>
-Date: Sun, 7 Mar 2021 01:47:42 +0100
-Subject: [PATCH] support ppcle architecture
-
----
- configure                            | 14 ++++++++++++--
- configs/targets/ppcle-linux-user.mak |  4 ++++
- linux-user/ppc/target_syscall.h      |  4 ++++
- scripts/qemu-binfmt-conf.sh          |  6 +++++-
- tests/tcg/configure.sh               |  2 ++
- 5 files changed, 27 insertions(+), 3 deletions(-)
- create mode 100644 configs/targets/ppcle-linux-user.mak
-
-diff --git a/configure b/configure
-index 18c26e0..03d3e18 100755
---- a/configure
-+++ b/configure
-@@ -653,7 +653,11 @@ elif check_define _ARCH_PPC ; then
-       cpu="ppc64"
-     fi
-   else
--    cpu="ppc"
-+    if check_define _LITTLE_ENDIAN ; then
-+      cpu="ppcle"
-+    else
-+      cpu="ppc"
-+    fi
-   fi
- elif check_define __mips__ ; then
-   cpu="mips"
-@@ -638,6 +642,9 @@
- 
-   ppc)
-     CPU_CFLAGS="-m32" ;;
-+  ppcle)
-+    cpu="ppc"
-+    CPU_CFLAGS="-m32 -mlittle-endian" ;;
-   ppc64)
-     CPU_CFLAGS="-m64 -mbig-endian" ;;
-   ppc64le)
-diff --git a/configs/targets/ppcle-linux-user.mak b/configs/targets/ppcle-linux-user.mak
-new file mode 100644
-index 0000000..2259243
---- /dev/null
-+++ b/configs/targets/ppcle-linux-user.mak
-@@ -0,0 +1,4 @@
-+TARGET_ARCH=ppc
-+TARGET_SYSTBL_ABI=common,nospu,32
-+TARGET_SYSTBL=syscall.tbl
-+TARGET_XML_FILES= gdb-xml/power-core.xml gdb-xml/power-fpu.xml gdb-xml/power-altivec.xml gdb-xml/power-spe.xml
-diff --git a/linux-user/ppc/target_syscall.h b/linux-user/ppc/target_syscall.h
-index b9c4b81..cf26497 100644
---- a/linux-user/ppc/target_syscall.h
-+++ b/linux-user/ppc/target_syscall.h
-@@ -65,7 +65,11 @@ struct target_revectored_struct {
- #define UNAME_MACHINE "ppc64le"
- #endif
- #else
-+#if TARGET_BIG_ENDIAN
- #define UNAME_MACHINE "ppc"
-+#else
-+#define UNAME_MACHINE "ppcle"
-+#endif
- #endif
- #define UNAME_MINIMUM_RELEASE "2.6.32"
- 
-diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh
-index 9f1580a..393943f 100755
---- a/scripts/qemu-binfmt-conf.sh
-+++ b/scripts/qemu-binfmt-conf.sh
-@@ -46,6 +46,10 @@ ppc_magic='\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x
- ppc_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
- ppc_family=ppc
- 
-+ppcle_magic='\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x14\x00'
-+ppcle_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\x00'
-+ppc_family=ppcle
-+
- ppc64_magic='\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x15'
- ppc64_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
- ppc64_family=ppc
-@@ -148,7 +152,7 @@ qemu_get_family() {
-     "Power Macintosh"|ppc64|powerpc|ppc)
-         echo "ppc"
-         ;;
--    ppc64el|ppc64le)
-+    ppc64el|ppc64le|ppcel|ppcle)
-         echo "ppcle"
-         ;;
-     arm|armel|armhf|arm64|armv[4-9]*l|aarch64)
-diff --git a/configure b/configure
-index 72ab03f11a..0691929d76 100755
---- a/configure
-+++ b/configure
-@@ -1866,6 +1866,7 @@ fi
- : ${cross_prefix_mips="mips-linux-gnu-"}
- : ${cross_prefix_nios2="nios2-linux-gnu-"}
- : ${cross_prefix_ppc="powerpc-linux-gnu-"}
-+: ${cross_prefix_ppcle="powerpcle-linux-gnu-"}
- : ${cross_prefix_ppc64="powerpc64-linux-gnu-"}
- : ${cross_prefix_ppc64le="$cross_prefix_ppc64"}
- : ${cross_prefix_riscv64="riscv64-linux-gnu-"}
-@@ -1883,6 +1884,7 @@ fi
- : ${cross_cc_cflags_hexagon="-mv67 -O2 -static"}
- : ${cross_cc_cflags_i386="-m32"}
- : ${cross_cc_cflags_ppc="-m32 -mbig-endian"}
-+: ${cross_cc_cflags_ppcle="-m32"}
- : ${cross_cc_cflags_ppc64="-m64 -mbig-endian"}
- : ${cross_cc_ppc64le="$cross_cc_ppc64"}
- : ${cross_cc_cflags_ppc64le="-m64 -mlittle-endian"}
-2.30.1
-
diff --git a/srcpkgs/qemu/template b/srcpkgs/qemu/template
index 48ab199e5686..c64664055bf9 100644
--- a/srcpkgs/qemu/template
+++ b/srcpkgs/qemu/template
@@ -1,8 +1,8 @@
 # Template file for 'qemu'
 # This package should be updated together with qemu-user-static
 pkgname=qemu
-version=7.1.0
-revision=2
+version=8.0.3
+revision=1
 build_style=configure
 configure_args="--prefix=/usr --sysconfdir=/etc --libexecdir=/usr/libexec --localstatedir=/var
  --disable-glusterfs --disable-xen --enable-docs --enable-kvm --enable-libusb --enable-pie
@@ -10,10 +10,10 @@ configure_args="--prefix=/usr --sysconfdir=/etc --libexecdir=/usr/libexec --loca
  --audio-drv-list=alsa$(vopt_if sdl2 ,sdl)$(vopt_if jack ,jack)$(vopt_if pulseaudio ,pa)
  $(vopt_enable opengl) $(vopt_enable pulseaudio pa) $(vopt_enable sdl2 sdl) $(vopt_enable smartcard)
  $(vopt_enable spice) $(vopt_enable virgl virglrenderer) $(vopt_if gtk3 '--enable-gtk')"
-hostmakedepends="gettext pkg-config perl python3 python3-Sphinx python3-sphinx_rtd_theme ninja"
+hostmakedepends="flex gettext glib-devel pkg-config perl python3 python3-Sphinx python3-sphinx_rtd_theme ninja"
 makedepends="capstone-devel dtc-devel libpng-devel libjpeg-turbo-devel pixman-devel
- snappy-devel libuuid-devel libX11-devel alsa-lib-devel libaio-devel gnutls-devel
- libsasl-devel libglib-devel ncurses-devel libseccomp-devel nss-devel
+ snappy-devel libuuid-devel libX11-devel alsa-lib-devel libaio-devel
+ gnutls-devel libsasl-devel ncurses-devel libseccomp-devel nss-devel
  libcurl-devel xfsprogs-devel libcap-ng-devel vde2-devel usbredir-devel
  libbluetooth-devel libssh2-devel libusb-devel libnfs-devel libslirp-devel
  libxkbcommon-devel libzstd-devel $(vopt_if sdl2 'SDL2-devel SDL2_image-devel')
@@ -25,17 +25,17 @@ makedepends="capstone-devel dtc-devel libpng-devel libjpeg-turbo-devel pixman-de
  $(vopt_if jack 'jack-devel') $(vopt_if pulseaudio 'pulseaudio-devel')"
 short_desc="Open Source Processor Emulator"
 maintainer="Orphaned <orphan@voidlinux.org>"
-license="GPL-2.0-or-later, LGPL-2.1-or-later"
+license="GPL-2.0-only, LGPL-2.1-only"
 homepage="https://www.qemu.org"
 distfiles="https://wiki.qemu.org/download/qemu-${version}.tar.bz2"
-checksum=f7ac2b85b3f1831e6810b140306e30af91556e15784864b209f3942858947fd0
+checksum=bb7113cd3761927621df11ec7f7ad438f868e1815f46f5dddf46a14ceb77e8e6
 ignore_elf_dirs="/usr/share/qemu"
 nostrip_files="hppa-firmware.img openbios-ppc openbios-sparc32 openbios-sparc64
  palcode-clipper s390-ccw.img s390-netboot.img u-boot.e500 opensbi-riscv32-generic-fw_dynamic.elf
  opensbi-riscv64-generic-fw_dynamic.elf"
 
-build_options="gtk3 opengl sdl2 spice virgl smartcard numa iscsi jack pulseaudio"
-build_options_default="opengl gtk3 virgl sdl2 numa iscsi jack pulseaudio"
+build_options="gtk3 iscsi jack numa opengl pulseaudio sdl2 smartcard spice virgl"
+build_options_default="gtk3 iscsi jack numa opengl pulseaudio sdl2 smartcard spice virgl"
 desc_option_sdl2="Enable SDL (2.x) video output"
 desc_option_spice="Enable support for SPICE"
 desc_option_virgl="Enable support for VirGL (A Virtual 3D GPU renderer)"
@@ -43,37 +43,10 @@ desc_option_smartcard="Enable smartcard support"
 desc_option_numa="Enable support for host NUMA"
 desc_option_iscsi="Enable support for iSCSI"
 
-case "$XBPS_TARGET_MACHINE" in
-	aarch64-musl) CFLAGS="-D_LINUX_SYSINFO_H";;
-esac
-
-if [ "$XBPS_TARGET_ENDIAN" = "le" ]; then
-	build_options_default+=" spice"
-fi
-
 if [ "$CROSS_BUILD" ]; then
-	configure_args+=" --cross-prefix=${XBPS_CROSS_TRIPLET}-"
-else
-	build_options_default+=" smartcard"
-fi
-
-if [ "$XBPS_CHECK_PKGS" != full ]; then
-	make_check_target=check-unit
+	configure_args+=" --cross-prefix=${XBPS_CROSS_TRIPLET}"
 fi
 
-post_extract() {
-	if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
-		grep -rl 'Input/output error' tests/qemu-iotests |
-			xargs -n1 sed -i -e 's;Input/output error;I/O error;g'
-		grep -rl 'Operation not supported' tests/qemu-iotests |
-			xargs -n1 sed -i -e 's;Operation not supported;Not supported;g'
-	fi
-}
-
-pre_configure() {
-	unset CPP
-}
-
 post_install() {
 	vdoc "${FILESDIR}/README.voidlinux"
 

From 21220d70280e817a015c719db3da048fa42b2fdd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Cerqueira?= <acerqueira021@gmail.com>
Date: Mon, 3 Jul 2023 18:41:30 +0100
Subject: [PATCH 2/2] qemu-user-static: update to 8.0.3.

---
 srcpkgs/qemu-user-static/template | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/srcpkgs/qemu-user-static/template b/srcpkgs/qemu-user-static/template
index 2a8da9b53f2d..ed2734e9aebd 100644
--- a/srcpkgs/qemu-user-static/template
+++ b/srcpkgs/qemu-user-static/template
@@ -1,20 +1,20 @@
 # Template file for 'qemu-user-static'
 # This package should be updated together with qemu
 pkgname=qemu-user-static
-version=7.1.0
-revision=3
+version=8.0.3
+revision=1
 build_style=configure
 configure_args="--prefix=/usr --sysconfdir=/etc --libexecdir=/usr/libexec
  --disable-kvm --disable-png --disable-virtfs --disable-fdt --disable-seccomp
  --enable-linux-user --disable-system --static --disable-pie"
-hostmakedepends="pkg-config perl python3 ninja"
+hostmakedepends="flex glib-devel pkg-config perl python3 ninja"
 makedepends="dtc-devel libglib-devel pixman-devel libuuid-devel"
 short_desc="QEMU User-mode emulators (statically compiled)"
 maintainer="Orphaned <orphan@voidlinux.org>"
-license="GPL-2.0-or-later, LGPL-2.1-or-later"
+license="GPL-2.0-only, LGPL-2.1-only"
 homepage="https://www.qemu.org"
 distfiles="https://wiki.qemu.org/download/qemu-${version}.tar.bz2"
-checksum=f7ac2b85b3f1831e6810b140306e30af91556e15784864b209f3942858947fd0
+checksum=bb7113cd3761927621df11ec7f7ad438f868e1815f46f5dddf46a14ceb77e8e6
 
 _fmts="aarch64 aarch64_be alpha arm armeb cris hppa i386 m68k microblaze
  microblazeel mips mipsel mips64 mips64el mipsn32 mipsn32el or1k
@@ -111,10 +111,6 @@ done
 
 binfmts="${binfmts%?}"
 
-pre_configure() {
-	unset CPP
-}
-
 post_install() {
 	# Remove unneeded stuff.
 	rm -rf ${DESTDIR}/etc ${DESTDIR}/usr/share ${DESTDIR}/usr/libexec

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: qemu: update to 8.0.3.
  2023-07-03 17:50 [PR PATCH] qemu: update to 8.0.2 motorto
                   ` (26 preceding siblings ...)
  2023-07-19 17:22 ` motorto
@ 2023-07-19 17:22 ` motorto
  2023-08-31 10:15 ` JamiKettunen
                   ` (10 subsequent siblings)
  38 siblings, 0 replies; 40+ messages in thread
From: motorto @ 2023-07-19 17:22 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 809 bytes --]

New comment by motorto on void-packages repository

https://github.com/void-linux/void-packages/pull/44822#issuecomment-1642471134

Comment:
> Great now there's a misunderstanding due to the revert blunder on the mailing list and the patches only being in `master` branch, it **NEEDS** to be page aligned, the proposed revert was wrong on the latest thing I linked (which is what I was trying to show by linking to comments mentioning as such) and was dropped on v2 of the "further fixes" series (https://patchwork.kernel.org/project/qemu-devel/cover/20230718185241.11433-1-deller@gmx.de/).
> 
> Basically, we **want** https://gitlab.com/qemu-project/qemu/-/commit/d28b3c9 downstream or wait until v8.0.4 / v8.1 which both should contain it.

We already had that one :) You got me confused and removed it

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: qemu: update to 8.0.3.
  2023-07-03 17:50 [PR PATCH] qemu: update to 8.0.2 motorto
                   ` (27 preceding siblings ...)
  2023-07-19 17:22 ` motorto
@ 2023-08-31 10:15 ` JamiKettunen
  2023-08-31 10:16 ` JamiKettunen
                   ` (9 subsequent siblings)
  38 siblings, 0 replies; 40+ messages in thread
From: JamiKettunen @ 2023-08-31 10:15 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 195 bytes --]

New comment by JamiKettunen on void-packages repository

https://github.com/void-linux/void-packages/pull/44822#issuecomment-1700761139

Comment:
https://github.com/qemu/qemu/releases/tag/v8.1.0

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: qemu: update to 8.0.3.
  2023-07-03 17:50 [PR PATCH] qemu: update to 8.0.2 motorto
                   ` (28 preceding siblings ...)
  2023-08-31 10:15 ` JamiKettunen
@ 2023-08-31 10:16 ` JamiKettunen
  2023-09-01 17:32 ` [PR PATCH] [Updated] " motorto
                   ` (8 subsequent siblings)
  38 siblings, 0 replies; 40+ messages in thread
From: JamiKettunen @ 2023-08-31 10:16 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 197 bytes --]

New comment by JamiKettunen on void-packages repository

https://github.com/void-linux/void-packages/pull/44822#issuecomment-1700761139

Comment:
https://gitlab.com/qemu-project/qemu/-/tags/v8.1.0

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [PR PATCH] [Updated] qemu: update to 8.0.3.
  2023-07-03 17:50 [PR PATCH] qemu: update to 8.0.2 motorto
                   ` (29 preceding siblings ...)
  2023-08-31 10:16 ` JamiKettunen
@ 2023-09-01 17:32 ` motorto
  2023-09-01 17:33 ` motorto
                   ` (7 subsequent siblings)
  38 siblings, 0 replies; 40+ messages in thread
From: motorto @ 2023-09-01 17:32 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1827 bytes --]

There is an updated pull request by motorto against master on the void-packages repository

https://github.com/motorto/void-packages qemu-8.0.2
https://github.com/void-linux/void-packages/pull/44822

qemu: update to 8.0.3.
<!-- Uncomment relevant sections and delete options which are not applicable -->
[ci-skip] 

Draft because of: https://github.com/void-linux/void-packages/pull/44822#issuecomment-1633611714


#### Testing the changes
- I tested the changes in this PR: **YES**, runned a Windows vm machine and it worked fine.

Removed a bunch of patches that in my research are no longer needed:

- Removed all ppc related patches since that arch isn't no longer supported.
- gcc12.patch: because it builds fine now in this version
- fix-softfloat-fesetround.patch: don't have a system to try it, but alpine doesn't have any patch related to this)
- mmap-mremap-efaul: not sure about if we should keep this one

Kept this patches:

- musl-initialize-msghdr.patch: just update in order to apply.

Added this ones:

- ~~CVE-2023-2861.patch~~
- ~~keymap.patch: xkeyboard-config 2.39 removed the legacy alias of ar -> ara~~
- fix-brk0.patch: make sure that initial brk(0) is page-aligned
- lfs64.patch: Builds defines -D_FILE_OFFSET_BITS=64 which makes the original functions
anf macros behave same as their 64 suffixed counterparts. This also
helps in compiling with latest musl C library, where these macros and
functions are no more available under _GNU_SOURCE feature macro

#### Local build testing
- I built this PR locally for my native architecture, x86-64-glibc
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl (cross)
  - x86_64-musl



A patch file from https://github.com/void-linux/void-packages/pull/44822.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-qemu-8.0.2-44822.patch --]
[-- Type: text/x-diff, Size: 33852 bytes --]

From bf8fed2cf54114e3b84753ec0167841634527472 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Cerqueira?= <acerqueira021@gmail.com>
Date: Fri, 1 Sep 2023 15:34:18 +0100
Subject: [PATCH 1/2] qemu: update to 8.1.0.

---
 .../qemu/patches/fix-linux-user-ppc32.patch   | 117 ----------
 .../patches/fix-softfloat-fesetround.patch    |  39 ----
 srcpkgs/qemu/patches/gcc12.patch              |  72 ------
 srcpkgs/qemu/patches/lfs64.patch              | 212 ++++++++++++++++++
 srcpkgs/qemu/patches/mmap-mremap-efault.patch |  42 ----
 .../qemu/patches/musl-initialize-msghdr.patch |   7 +-
 srcpkgs/qemu/patches/musl-ppc.patch           |  25 ---
 srcpkgs/qemu/patches/musl-rlimit-rttime.patch |  13 --
 srcpkgs/qemu/patches/xxx-ppcle.patch          | 113 ----------
 srcpkgs/qemu/template                         |  41 +---
 10 files changed, 223 insertions(+), 458 deletions(-)
 delete mode 100644 srcpkgs/qemu/patches/fix-linux-user-ppc32.patch
 delete mode 100644 srcpkgs/qemu/patches/fix-softfloat-fesetround.patch
 delete mode 100644 srcpkgs/qemu/patches/gcc12.patch
 create mode 100644 srcpkgs/qemu/patches/lfs64.patch
 delete mode 100644 srcpkgs/qemu/patches/mmap-mremap-efault.patch
 delete mode 100644 srcpkgs/qemu/patches/musl-ppc.patch
 delete mode 100644 srcpkgs/qemu/patches/musl-rlimit-rttime.patch
 delete mode 100644 srcpkgs/qemu/patches/xxx-ppcle.patch

diff --git a/srcpkgs/qemu/patches/fix-linux-user-ppc32.patch b/srcpkgs/qemu/patches/fix-linux-user-ppc32.patch
deleted file mode 100644
index cd47435d5aa9a..0000000000000
--- a/srcpkgs/qemu/patches/fix-linux-user-ppc32.patch
+++ /dev/null
@@ -1,117 +0,0 @@
-commit 37814f62c2cc7aba2eea073014d6c53dcd5bf42c
-Author: q66 <daniel@octaforge.org>
-Date:   Fri Jul 1 16:53:55 2022 +0200
-
-    fix linux-user build on 32-bit ppc
-    
-    Partial revert https://gitlab.com/qemu-project/qemu/-/commit/9d1401b79463e74adbfac69d836789d4e103fb61
-    and https://gitlab.com/qemu-project/qemu/-/commit/0a7e01904d407baa73c1baddbdfc9ccf2ace8356
-
-diff --git a/common-user/host/ppc/safe-syscall.inc.S b/common-user/host/ppc/safe-syscall.inc.S
-new file mode 100644
-index 0000000..e69de29
-diff --git a/common-user/safe-syscall-error.c b/common-user/safe-syscall-error.c
-index cf74b50..a36132c 100644
---- a/common-user/safe-syscall-error.c
-+++ b/common-user/safe-syscall-error.c
-@@ -12,6 +12,7 @@
- #include "qemu/osdep.h"
- #include "user/safe-syscall.h"
- 
-+#if !defined(__powerpc__) || defined(__powerpc64__)
- /*
-  * This is intended to be invoked via tail-call on the error path
-  * from the assembly in host/arch/safe-syscall.inc.S.  This takes
-@@ -23,3 +24,4 @@ long safe_syscall_set_errno_tail(int value)
-     errno = value;
-     return -1;
- }
-+#endif
-diff --git a/include/user/safe-syscall.h b/include/user/safe-syscall.h
-index 61a04e2..793fe84 100644
---- a/include/user/safe-syscall.h
-+++ b/include/user/safe-syscall.h
-@@ -125,6 +125,8 @@
-  * kinds of restartability.
-  */
- 
-+#if !defined(__powerpc__) || defined(__powerpc64__)
-+
- /* The core part of this function is implemented in assembly */
- extern long safe_syscall_base(int *pending, long number, ...);
- extern long safe_syscall_set_errno_tail(int value);
-@@ -137,4 +139,10 @@ extern char safe_syscall_end[];
-     safe_syscall_base(&((TaskState *)thread_cpu->opaque)->signal_pending, \
-                       __VA_ARGS__)
- 
-+#else
-+
-+#define safe_syscall syscall
-+
-+#endif
-+
- #endif
-diff --git a/linux-user/include/host/ppc/host-signal.h b/linux-user/include/host/ppc/host-signal.h
-new file mode 100644
-index 0000000..b80384d
---- /dev/null
-+++ b/linux-user/include/host/ppc/host-signal.h
-@@ -0,0 +1,38 @@
-+/*
-+ * host-signal.h: signal info dependent on the host architecture
-+ *
-+ * Copyright (c) 2003-2005 Fabrice Bellard
-+ * Copyright (c) 2021 Linaro Limited
-+ *
-+ * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
-+ * See the COPYING file in the top-level directory.
-+ */
-+
-+#ifndef PPC_HOST_SIGNAL_H
-+#define PPC_HOST_SIGNAL_H
-+
-+/* The third argument to a SA_SIGINFO handler is ucontext_t. */
-+typedef ucontext_t host_sigcontext;
-+
-+static inline uintptr_t host_signal_pc(host_sigcontext *uc)
-+{
-+    return uc->uc_mcontext.regs->nip;
-+}
-+
-+static inline void host_signal_set_pc(host_sigcontext *uc, uintptr_t pc)
-+{
-+    uc->uc_mcontext.regs->nip = pc;
-+}
-+
-+static inline void *host_signal_mask(host_sigcontext *uc)
-+{
-+    return &uc->uc_sigmask;
-+}
-+
-+static inline bool host_signal_write(siginfo_t *info, host_sigcontext *uc)
-+{
-+    return uc->uc_mcontext.regs->trap != 0x400
-+        && (uc->uc_mcontext.regs->dsisr & 0x02000000);
-+}
-+
-+#endif
-diff --git a/linux-user/signal.c b/linux-user/signal.c
-index 092e70b..b8dfa8a 100644
---- a/linux-user/signal.c
-+++ b/linux-user/signal.c
-@@ -800,6 +800,7 @@ void queue_signal(CPUArchState *env, int sig, int si_type,
- /* Adjust the signal context to rewind out of safe-syscall if we're in it */
- static inline void rewind_if_in_safe_syscall(void *puc)
- {
-+#if !defined(__powerpc__) || defined(__powerpc64__)
-     host_sigcontext *uc = (host_sigcontext *)puc;
-     uintptr_t pcreg = host_signal_pc(uc);
- 
-@@ -807,6 +808,7 @@ static inline void rewind_if_in_safe_syscall(void *puc)
-         && pcreg < (uintptr_t)safe_syscall_end) {
-         host_signal_set_pc(uc, (uintptr_t)safe_syscall_start);
-     }
-+#endif
- }
- 
- static void host_signal_handler(int host_sig, siginfo_t *info, void *puc)
diff --git a/srcpkgs/qemu/patches/fix-softfloat-fesetround.patch b/srcpkgs/qemu/patches/fix-softfloat-fesetround.patch
deleted file mode 100644
index ecdd049f79212..0000000000000
--- a/srcpkgs/qemu/patches/fix-softfloat-fesetround.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-Source: @pullmoll
-Upstream: no
-Reason: Target architectures with soft float do not define these constants.
-
---- a/tests/fp/fp-bench.c	2020-12-08 17:59:44.000000000 +0100
-+++ b/tests/fp/fp-bench.c	2020-12-12 20:38:40.702235420 +0100
-@@ -485,16 +485,32 @@
- 
-     switch (rounding) {
-     case ROUND_EVEN:
-+#if defined(FE_TONEAREST)
-         rhost = FE_TONEAREST;
-+#else
-+	return;
-+#endif
-         break;
-     case ROUND_ZERO:
-+#if defined(FE_TOWARDZERO)
-         rhost = FE_TOWARDZERO;
-+#else
-+	return;
-+#endif
-         break;
-     case ROUND_DOWN:
-+#if defined(FE_DOWNWARD)
-         rhost = FE_DOWNWARD;
-+#else
-+	return;
-+#endif
-         break;
-     case ROUND_UP:
-+#if defined(FE_UPWARD)
-         rhost = FE_UPWARD;
-+#else
-+	return;
-+#endif
-         break;
-     case ROUND_TIEAWAY:
-         die_host_rounding(rounding);
diff --git a/srcpkgs/qemu/patches/gcc12.patch b/srcpkgs/qemu/patches/gcc12.patch
deleted file mode 100644
index 2a4b2bd036096..0000000000000
--- a/srcpkgs/qemu/patches/gcc12.patch
+++ /dev/null
@@ -1,72 +0,0 @@
-From 5cb993ff131fca2abef3ce074a20258fd6fce557 Mon Sep 17 00:00:00 2001
-From: Bernhard Beschow <shentey@gmail.com>
-Date: Sat, 18 Mar 2023 19:59:31 +0100
-Subject: [PATCH] qemu/osdep: Switch position of "extern" and "G_NORETURN"
-
-Fixes the Windows build under msys2 using GCC 12 which fails with the following
-error:
-
-  [184/579] Compiling C++ object qga/vss-win32/qga-vss.dll.p/install.cpp.obj
-  FAILED: qga/vss-win32/qga-vss.dll.p/install.cpp.obj
-  "c++" "-m64" "-mcx16" "-Iqga/vss-win32/qga-vss.dll.p" "-Iqga/vss-win32" "-I../src/qga/vss-win32" "-I." "-Iqapi" "-Itrace" "-Iui" "-Iui/shader" "-IC:/msys64/mingw64/include/glib-2.0" "-IC:/msys64/mingw64/lib/glib-2.0/include" "-fdiagnostics-color=auto" "-Wall" "-Winvalid-pch" "-Wnon-virtual-dtor" "-Werror" "-std=gnu++11" "-g" "-iquote" "." "-iquote" "C:/msys64/home/shentey/Projects/qemu/src" "-iquote" "C:/msys64/home/shentey/Projects/qemu/src/include" "-iquote" "C:/msys64/home/shentey/Projects/qemu/src/tcg/i386" "-D__STDC_LIMIT_MACROS" "-D__STDC_CONSTANT_MACROS" "-D__STDC_FORMAT_MACROS" "-fno-pie" "-no-pie" "-D_GNU_SOURCE" "-D_FILE_OFFSET_BITS=64" "-D_LARGEFILE_SOURCE" "-fno-strict-aliasing" "-fno-common" "-fwrapv" "-Wundef" "-Wwrite-strings" "-Wtype-limits" "-Wformat-security" "-Wformat-y2k" "-Winit-self" "-Wignored-qualifiers" "-Wempty-body" "-Wendif-labels" "-Wexpansion-to-defined" "-Wimplicit-fallthrough=2" "-Wmissing-format-attribute" "-Wno-missing-include-dirs" "-Wno-shift-negative-value" "-Wno-psabi" "-fstack-protector-strong" "-Wno-unknown-pragmas" "-Wno-delete-non-virtual-dtor" "-Wno-non-virtual-dtor" -MD -MQ qga/vss-win32/qga-vss.dll.p/install.cpp.obj -MF "qga/vss-win32/qga-vss.dll.p/install.cpp.obj.d" -o qga/vss-win32/qga-vss.dll.p/install.cpp.obj "-c" ../src/qga/vss-win32/install.cpp
-  In file included from C:/msys64/mingw64/lib/glib-2.0/include/glibconfig.h:9,
-              from C:/msys64/mingw64/include/glib-2.0/glib/gtypes.h:34,
-              from C:/msys64/mingw64/include/glib-2.0/glib/galloca.h:34,
-              from C:/msys64/mingw64/include/glib-2.0/glib.h:32,
-              from C:/msys64/home/shentey/Projects/qemu/src/include/glib-compat.h:32,
-              from C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:144,
-              from ../src/qga/vss-win32/install.cpp:13:
-  C:/msys64/mingw64/include/glib-2.0/glib/gmacros.h:1075:21: error: standard attributes in middle of decl-specifiers
-  1075 | # define G_NORETURN [[noreturn]]
-        |                     ^
-  C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:240:8: note: in expansion of macro 'G_NORETURN'
-  240 | extern G_NORETURN
-        |        ^~~~~~~~~~
-  C:/msys64/mingw64/include/glib-2.0/glib/gmacros.h:1075:21: note: standard attributes must precede the decl-specifiers to apply to the declaration, or follow them to apply to the type
-  1075 | # define G_NORETURN [[noreturn]]
-        |                     ^
-  C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:240:8: note: in expansion of macro 'G_NORETURN'
-  240 | extern G_NORETURN
-        |        ^~~~~~~~~~
-  C:/msys64/mingw64/include/glib-2.0/glib/gmacros.h:1075:21: error: attribute ignored [-Werror=attributes]
-  1075 | # define G_NORETURN [[noreturn]]
-        |                     ^
-  C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:240:8: note: in expansion of macro 'G_NORETURN'
-  240 | extern G_NORETURN
-        |        ^~~~~~~~~~
-  C:/msys64/mingw64/include/glib-2.0/glib/gmacros.h:1075:21: note: an attribute that appertains to a type-specifier is ignored
-  1075 | # define G_NORETURN [[noreturn]]
-        |                     ^
-  C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:240:8: note: in expansion of macro 'G_NORETURN'
-  240 | extern G_NORETURN
-        |        ^~~~~~~~~~
-  cc1plus.exe: all warnings being treated as errors
-
-Apparently it also fixes the compilation with Clang 15 (see
-https://gitlab.com/qemu-project/qemu/-/issues/1541 ).
-
-Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1541
-Signed-off-by: Bernhard Beschow <shentey@gmail.com>
-Message-Id: <20230318185931.181659-1-shentey@gmail.com>
-Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
-Signed-off-by: Thomas Huth <thuth@redhat.com>
----
- include/qemu/osdep.h | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
-index f68b5d8708c..9eff0be95bd 100644
---- a/include/qemu/osdep.h
-+++ b/include/qemu/osdep.h
-@@ -237,7 +237,7 @@ extern "C" {
-  * supports QEMU_ERROR, this will be reported at compile time; otherwise
-  * this will be reported at link time due to the missing symbol.
-  */
--extern G_NORETURN
-+G_NORETURN extern
- void QEMU_ERROR("code path is reachable")
-     qemu_build_not_reached_always(void);
- #if defined(__OPTIMIZE__) && !defined(__NO_INLINE__)
--- 
-GitLab
-
diff --git a/srcpkgs/qemu/patches/lfs64.patch b/srcpkgs/qemu/patches/lfs64.patch
new file mode 100644
index 0000000000000..095ab3dceadca
--- /dev/null
+++ b/srcpkgs/qemu/patches/lfs64.patch
@@ -0,0 +1,212 @@
+Builds defines -D_FILE_OFFSET_BITS=64 which makes the original functions
+anf macros behave same as their 64 suffixed counterparts. This also
+helps in compiling with latest musl C library, where these macros and
+functions are no more available under _GNU_SOURCE feature macro
+
+source: https://git.alpinelinux.org/aports/plain/community/qemu/lfs64.patch
+--
+
+diff --git a/linux-user/syscall.c b/linux-user/syscall.c
+index bbba2a6..38fa09a 100644
+--- a/linux-user/syscall.c
++++ b/linux-user/syscall.c
+@@ -6812,13 +6812,13 @@ static int target_to_host_fcntl_cmd(int cmd)
+         ret = cmd;
+         break;
+     case TARGET_F_GETLK:
+-        ret = F_GETLK64;
++        ret = F_GETLK;
+         break;
+     case TARGET_F_SETLK:
+-        ret = F_SETLK64;
++        ret = F_SETLK;
+         break;
+     case TARGET_F_SETLKW:
+-        ret = F_SETLKW64;
++        ret = F_SETLKW;
+         break;
+     case TARGET_F_GETOWN:
+         ret = F_GETOWN;
+@@ -6834,13 +6834,13 @@ static int target_to_host_fcntl_cmd(int cmd)
+         break;
+ #if TARGET_ABI_BITS == 32
+     case TARGET_F_GETLK64:
+-        ret = F_GETLK64;
++        ret = F_GETLK;
+         break;
+     case TARGET_F_SETLK64:
+-        ret = F_SETLK64;
++        ret = F_SETLK;
+         break;
+     case TARGET_F_SETLKW64:
+-        ret = F_SETLKW64;
++        ret = F_SETLKW;
+         break;
+ #endif
+     case TARGET_F_SETLEASE:
+@@ -6894,8 +6894,8 @@ static int target_to_host_fcntl_cmd(int cmd)
+      * them to 5, 6 and 7 before making the syscall(). Since we make the
+      * syscall directly, adjust to what is supported by the kernel.
+      */
+-    if (ret >= F_GETLK64 && ret <= F_SETLKW64) {
+-        ret -= F_GETLK64 - 5;
++    if (ret >= F_GETLK && ret <= F_SETLKW) {
++        ret -= F_GETLK - 5;
+     }
+ #endif
+ 
+@@ -6928,7 +6928,7 @@ static int host_to_target_flock(int type)
+     return type;
+ }
+ 
+-static inline abi_long copy_from_user_flock(struct flock64 *fl,
++static inline abi_long copy_from_user_flock(struct flock *fl,
+                                             abi_ulong target_flock_addr)
+ {
+     struct target_flock *target_fl;
+@@ -6953,7 +6953,7 @@ static inline abi_long copy_from_user_flock(struct flock64 *fl,
+ }
+ 
+ static inline abi_long copy_to_user_flock(abi_ulong target_flock_addr,
+-                                          const struct flock64 *fl)
++                                          const struct flock *fl)
+ {
+     struct target_flock *target_fl;
+     short l_type;
+@@ -6972,8 +6972,8 @@ static inline abi_long copy_to_user_flock(abi_ulong target_flock_addr,
+     return 0;
+ }
+ 
+-typedef abi_long from_flock64_fn(struct flock64 *fl, abi_ulong target_addr);
+-typedef abi_long to_flock64_fn(abi_ulong target_addr, const struct flock64 *fl);
++typedef abi_long from_flock64_fn(struct flock *fl, abi_ulong target_addr);
++typedef abi_long to_flock64_fn(abi_ulong target_addr, const struct flock *fl);
+ 
+ #if defined(TARGET_ARM) && TARGET_ABI_BITS == 32
+ struct target_oabi_flock64 {
+@@ -6984,7 +6984,7 @@ struct target_oabi_flock64 {
+     abi_int   l_pid;
+ } QEMU_PACKED;
+ 
+-static inline abi_long copy_from_user_oabi_flock64(struct flock64 *fl,
++static inline abi_long copy_from_user_oabi_flock64(struct flock *fl,
+                                                    abi_ulong target_flock_addr)
+ {
+     struct target_oabi_flock64 *target_fl;
+@@ -7009,7 +7009,7 @@ static inline abi_long copy_from_user_oabi_flock64(struct flock64 *fl,
+ }
+ 
+ static inline abi_long copy_to_user_oabi_flock64(abi_ulong target_flock_addr,
+-                                                 const struct flock64 *fl)
++                                                 const struct flock *fl)
+ {
+     struct target_oabi_flock64 *target_fl;
+     short l_type;
+@@ -7029,7 +7029,7 @@ static inline abi_long copy_to_user_oabi_flock64(abi_ulong target_flock_addr,
+ }
+ #endif
+ 
+-static inline abi_long copy_from_user_flock64(struct flock64 *fl,
++static inline abi_long copy_from_user_flock64(struct flock *fl,
+                                               abi_ulong target_flock_addr)
+ {
+     struct target_flock64 *target_fl;
+@@ -7054,7 +7054,7 @@ static inline abi_long copy_from_user_flock64(struct flock64 *fl,
+ }
+ 
+ static inline abi_long copy_to_user_flock64(abi_ulong target_flock_addr,
+-                                            const struct flock64 *fl)
++                                            const struct flock *fl)
+ {
+     struct target_flock64 *target_fl;
+     short l_type;
+@@ -7075,7 +7075,7 @@ static inline abi_long copy_to_user_flock64(abi_ulong target_flock_addr,
+ 
+ static abi_long do_fcntl(int fd, int cmd, abi_ulong arg)
+ {
+-    struct flock64 fl64;
++    struct flock fl64;
+ #ifdef F_GETOWN_EX
+     struct f_owner_ex fox;
+     struct target_f_owner_ex *target_fox;
+@@ -7347,7 +7347,7 @@ static inline abi_long target_truncate64(CPUArchState *cpu_env, const char *arg1
+         arg2 = arg3;
+         arg3 = arg4;
+     }
+-    return get_errno(truncate64(arg1, target_offset64(arg2, arg3)));
++    return get_errno(truncate(arg1, target_offset64(arg2, arg3)));
+ }
+ #endif
+ 
+@@ -7361,7 +7361,7 @@ static inline abi_long target_ftruncate64(CPUArchState *cpu_env, abi_long arg1,
+         arg2 = arg3;
+         arg3 = arg4;
+     }
+-    return get_errno(ftruncate64(arg1, target_offset64(arg2, arg3)));
++    return get_errno(ftruncate(arg1, target_offset64(arg2, arg3)));
+ }
+ #endif
+ 
+@@ -8597,7 +8597,7 @@ static int do_getdents(abi_long dirfd, abi_long arg2, abi_long count)
+     void *tdirp;
+     int hlen, hoff, toff;
+     int hreclen, treclen;
+-    off64_t prev_diroff = 0;
++    off_t prev_diroff = 0;
+ 
+     hdirp = g_try_malloc(count);
+     if (!hdirp) {
+@@ -8650,7 +8650,7 @@ static int do_getdents(abi_long dirfd, abi_long arg2, abi_long count)
+              * Return what we have, resetting the file pointer to the
+              * location of the first record not returned.
+              */
+-            lseek64(dirfd, prev_diroff, SEEK_SET);
++            lseek(dirfd, prev_diroff, SEEK_SET);
+             break;
+         }
+ 
+@@ -8684,7 +8684,7 @@ static int do_getdents64(abi_long dirfd, abi_long arg2, abi_long count)
+     void *tdirp;
+     int hlen, hoff, toff;
+     int hreclen, treclen;
+-    off64_t prev_diroff = 0;
++    off_t prev_diroff = 0;
+ 
+     hdirp = g_try_malloc(count);
+     if (!hdirp) {
+@@ -8726,7 +8726,7 @@ static int do_getdents64(abi_long dirfd, abi_long arg2, abi_long count)
+              * Return what we have, resetting the file pointer to the
+              * location of the first record not returned.
+              */
+-            lseek64(dirfd, prev_diroff, SEEK_SET);
++            lseek(dirfd, prev_diroff, SEEK_SET);
+             break;
+         }
+ 
+@@ -11157,7 +11157,7 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,
+                 return -TARGET_EFAULT;
+             }
+         }
+-        ret = get_errno(pread64(arg1, p, arg3, target_offset64(arg4, arg5)));
++        ret = get_errno(pread(arg1, p, arg3, target_offset64(arg4, arg5)));
+         unlock_user(p, arg2, ret);
+         return ret;
+     case TARGET_NR_pwrite64:
+@@ -11174,7 +11174,7 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,
+                 return -TARGET_EFAULT;
+             }
+         }
+-        ret = get_errno(pwrite64(arg1, p, arg3, target_offset64(arg4, arg5)));
++        ret = get_errno(pwrite(arg1, p, arg3, target_offset64(arg4, arg5)));
+         unlock_user(p, arg2, 0);
+         return ret;
+ #endif
+@@ -12034,7 +12034,7 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,
+     case TARGET_NR_fcntl64:
+     {
+         int cmd;
+-        struct flock64 fl;
++        struct flock fl;
+         from_flock64_fn *copyfrom = copy_from_user_flock64;
+         to_flock64_fn *copyto = copy_to_user_flock64;
+ 
diff --git a/srcpkgs/qemu/patches/mmap-mremap-efault.patch b/srcpkgs/qemu/patches/mmap-mremap-efault.patch
deleted file mode 100644
index 5a70e9658b300..0000000000000
--- a/srcpkgs/qemu/patches/mmap-mremap-efault.patch
+++ /dev/null
@@ -1,42 +0,0 @@
-Source: @pullmoll
-Upstream: no
-Reason: errno=EFAULT when the address passed to mremap(2) is not valid
-
-See Rich Felker's comment at https://www.openwall.com/lists/musl/2017/06/21/2 for
-why we need to return errno as described in man mremap(2) from qemu-user-static.
-Also speed up the loop when checking for increasing the mappings size to go
-in steps of TARGET_PAGE_SIZE and OR-in a check for the very last byte of the range.
-diff --git linux-user/mmap.c linux-user/mmap.c
-index 7e3b245..1e8d0f1 100644
---- a/linux-user/mmap.c
-+++ b/linux-user/mmap.c
-@@ -738,7 +738,7 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size,
-          !guest_range_valid_untagged(new_addr, new_size)) ||
-         ((flags & MREMAP_MAYMOVE) == 0 &&
-          !guest_range_valid_untagged(old_addr, new_size))) {
--        errno = ENOMEM;
-+        errno = EFAULT;
-         return -1;
-     }
- 
-@@ -775,9 +775,10 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size,
-             abi_ulong addr;
-             for (addr = old_addr + old_size;
-                  addr < old_addr + new_size;
--                 addr++) {
-+                 addr += TARGET_PAGE_SIZE) {
-                 prot |= page_get_flags(addr);
-             }
-+				prot |= page_get_flags(old_addr + new_size - 1);
-         }
-         if (prot == 0) {
-             host_addr = mremap(g2h_untagged(old_addr),
-@@ -796,7 +797,7 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size,
-                 }
-             }
-         } else {
--            errno = ENOMEM;
-+            errno = EFAULT;
-             host_addr = MAP_FAILED;
-         }
-     }
diff --git a/srcpkgs/qemu/patches/musl-initialize-msghdr.patch b/srcpkgs/qemu/patches/musl-initialize-msghdr.patch
index 6d96b3511dafe..2c5cf4552ecfb 100644
--- a/srcpkgs/qemu/patches/musl-initialize-msghdr.patch
+++ b/srcpkgs/qemu/patches/musl-initialize-msghdr.patch
@@ -1,10 +1,10 @@
 Source: https://github.com/void-linux/void-packages/issues/23557
 
-diff --git linux-user/syscall.c linux-user/syscall.c
-index 945fc25..8d8b68a 100644
+diff --git a/linux-user/syscall.c b/linux-user/syscall.c
+index 14fdebd..de280af 100644
 --- a/linux-user/syscall.c
 +++ b/linux-user/syscall.c
-@@ -3071,7 +3071,7 @@ static abi_long do_sendrecvmsg_locked(int fd, struct target_msghdr *msgp,
+@@ -3229,7 +3229,7 @@ static abi_long do_sendrecvmsg_locked(int fd, struct target_msghdr *msgp,
                                        int flags, int send)
  {
      abi_long ret, len;
@@ -13,3 +13,4 @@ index 945fc25..8d8b68a 100644
      abi_ulong count;
      struct iovec *vec;
      abi_ulong target_vec;
+
diff --git a/srcpkgs/qemu/patches/musl-ppc.patch b/srcpkgs/qemu/patches/musl-ppc.patch
deleted file mode 100644
index 0b77aa8fc63d4..0000000000000
--- a/srcpkgs/qemu/patches/musl-ppc.patch
+++ /dev/null
@@ -1,25 +0,0 @@
---- a/linux-user/signal.c
-+++ b/linux-user/signal.c
-@@ -21,5 +21,9 @@
- #include "exec/gdbstub.h"
- #include "hw/core/tcg-cpu-ops.h"
- 
-+#if defined(_ARCH_PPC64) && !defined(__GLIBC__) /* musl */
-+#include <asm/ptrace.h>
-+#endif
-+
- #include <sys/ucontext.h>
- #include <sys/resource.h>
---- a/util/mmap-alloc.c
-+++ b/util/mmap-alloc.c
-@@ -25,6 +25,10 @@
- 
- #ifdef CONFIG_LINUX
- #include <sys/vfs.h>
-+/* musl undefs this on ppc and mips */
-+#ifndef MAP_SYNC
-+#define MAP_SYNC 0x80000
-+#endif
- #endif
- 
- size_t qemu_fd_getpagesize(int fd)
diff --git a/srcpkgs/qemu/patches/musl-rlimit-rttime.patch b/srcpkgs/qemu/patches/musl-rlimit-rttime.patch
deleted file mode 100644
index 0cbf9be36a8f1..0000000000000
--- a/srcpkgs/qemu/patches/musl-rlimit-rttime.patch
+++ /dev/null
@@ -1,13 +0,0 @@
---- a/linux-user/syscall.c
-+++ b/linux-user/syscall.c
-@@ -141,6 +141,10 @@
- #include "fd-trans.h"
- #include "tcg/tcg.h"
- 
-+#ifndef RLIMIT_RTTIME
-+#define RLIMIT_RTTIME 15
-+#endif
-+
- #ifndef CLONE_IO
- #define CLONE_IO                0x80000000      /* Clone io context */
- #endif
diff --git a/srcpkgs/qemu/patches/xxx-ppcle.patch b/srcpkgs/qemu/patches/xxx-ppcle.patch
deleted file mode 100644
index 90b32b5e07cd8..0000000000000
--- a/srcpkgs/qemu/patches/xxx-ppcle.patch
+++ /dev/null
@@ -1,113 +0,0 @@
-From 7ece08d7902d5a8c007deeb0b75cb533a41dd882 Mon Sep 17 00:00:00 2001
-From: Daniel Kolesa <daniel@octaforge.org>
-Date: Sun, 7 Mar 2021 01:47:42 +0100
-Subject: [PATCH] support ppcle architecture
-
----
- configure                            | 14 ++++++++++++--
- configs/targets/ppcle-linux-user.mak |  4 ++++
- linux-user/ppc/target_syscall.h      |  4 ++++
- scripts/qemu-binfmt-conf.sh          |  6 +++++-
- tests/tcg/configure.sh               |  2 ++
- 5 files changed, 27 insertions(+), 3 deletions(-)
- create mode 100644 configs/targets/ppcle-linux-user.mak
-
-diff --git a/configure b/configure
-index 18c26e0..03d3e18 100755
---- a/configure
-+++ b/configure
-@@ -653,7 +653,11 @@ elif check_define _ARCH_PPC ; then
-       cpu="ppc64"
-     fi
-   else
--    cpu="ppc"
-+    if check_define _LITTLE_ENDIAN ; then
-+      cpu="ppcle"
-+    else
-+      cpu="ppc"
-+    fi
-   fi
- elif check_define __mips__ ; then
-   cpu="mips"
-@@ -638,6 +642,9 @@
- 
-   ppc)
-     CPU_CFLAGS="-m32" ;;
-+  ppcle)
-+    cpu="ppc"
-+    CPU_CFLAGS="-m32 -mlittle-endian" ;;
-   ppc64)
-     CPU_CFLAGS="-m64 -mbig-endian" ;;
-   ppc64le)
-diff --git a/configs/targets/ppcle-linux-user.mak b/configs/targets/ppcle-linux-user.mak
-new file mode 100644
-index 0000000..2259243
---- /dev/null
-+++ b/configs/targets/ppcle-linux-user.mak
-@@ -0,0 +1,4 @@
-+TARGET_ARCH=ppc
-+TARGET_SYSTBL_ABI=common,nospu,32
-+TARGET_SYSTBL=syscall.tbl
-+TARGET_XML_FILES= gdb-xml/power-core.xml gdb-xml/power-fpu.xml gdb-xml/power-altivec.xml gdb-xml/power-spe.xml
-diff --git a/linux-user/ppc/target_syscall.h b/linux-user/ppc/target_syscall.h
-index b9c4b81..cf26497 100644
---- a/linux-user/ppc/target_syscall.h
-+++ b/linux-user/ppc/target_syscall.h
-@@ -65,7 +65,11 @@ struct target_revectored_struct {
- #define UNAME_MACHINE "ppc64le"
- #endif
- #else
-+#if TARGET_BIG_ENDIAN
- #define UNAME_MACHINE "ppc"
-+#else
-+#define UNAME_MACHINE "ppcle"
-+#endif
- #endif
- #define UNAME_MINIMUM_RELEASE "2.6.32"
- 
-diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh
-index 9f1580a..393943f 100755
---- a/scripts/qemu-binfmt-conf.sh
-+++ b/scripts/qemu-binfmt-conf.sh
-@@ -46,6 +46,10 @@ ppc_magic='\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x
- ppc_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
- ppc_family=ppc
- 
-+ppcle_magic='\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x14\x00'
-+ppcle_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\x00'
-+ppc_family=ppcle
-+
- ppc64_magic='\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x15'
- ppc64_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
- ppc64_family=ppc
-@@ -148,7 +152,7 @@ qemu_get_family() {
-     "Power Macintosh"|ppc64|powerpc|ppc)
-         echo "ppc"
-         ;;
--    ppc64el|ppc64le)
-+    ppc64el|ppc64le|ppcel|ppcle)
-         echo "ppcle"
-         ;;
-     arm|armel|armhf|arm64|armv[4-9]*l|aarch64)
-diff --git a/configure b/configure
-index 72ab03f11a..0691929d76 100755
---- a/configure
-+++ b/configure
-@@ -1866,6 +1866,7 @@ fi
- : ${cross_prefix_mips="mips-linux-gnu-"}
- : ${cross_prefix_nios2="nios2-linux-gnu-"}
- : ${cross_prefix_ppc="powerpc-linux-gnu-"}
-+: ${cross_prefix_ppcle="powerpcle-linux-gnu-"}
- : ${cross_prefix_ppc64="powerpc64-linux-gnu-"}
- : ${cross_prefix_ppc64le="$cross_prefix_ppc64"}
- : ${cross_prefix_riscv64="riscv64-linux-gnu-"}
-@@ -1883,6 +1884,7 @@ fi
- : ${cross_cc_cflags_hexagon="-mv67 -O2 -static"}
- : ${cross_cc_cflags_i386="-m32"}
- : ${cross_cc_cflags_ppc="-m32 -mbig-endian"}
-+: ${cross_cc_cflags_ppcle="-m32"}
- : ${cross_cc_cflags_ppc64="-m64 -mbig-endian"}
- : ${cross_cc_ppc64le="$cross_cc_ppc64"}
- : ${cross_cc_cflags_ppc64le="-m64 -mlittle-endian"}
-2.30.1
-
diff --git a/srcpkgs/qemu/template b/srcpkgs/qemu/template
index 48ab199e5686b..35d4c67ae2471 100644
--- a/srcpkgs/qemu/template
+++ b/srcpkgs/qemu/template
@@ -1,8 +1,8 @@
 # Template file for 'qemu'
 # This package should be updated together with qemu-user-static
 pkgname=qemu
-version=7.1.0
-revision=2
+version=8.1.0
+revision=1
 build_style=configure
 configure_args="--prefix=/usr --sysconfdir=/etc --libexecdir=/usr/libexec --localstatedir=/var
  --disable-glusterfs --disable-xen --enable-docs --enable-kvm --enable-libusb --enable-pie
@@ -10,7 +10,7 @@ configure_args="--prefix=/usr --sysconfdir=/etc --libexecdir=/usr/libexec --loca
  --audio-drv-list=alsa$(vopt_if sdl2 ,sdl)$(vopt_if jack ,jack)$(vopt_if pulseaudio ,pa)
  $(vopt_enable opengl) $(vopt_enable pulseaudio pa) $(vopt_enable sdl2 sdl) $(vopt_enable smartcard)
  $(vopt_enable spice) $(vopt_enable virgl virglrenderer) $(vopt_if gtk3 '--enable-gtk')"
-hostmakedepends="gettext pkg-config perl python3 python3-Sphinx python3-sphinx_rtd_theme ninja"
+hostmakedepends="flex gettext pkg-config perl python3 python3-Sphinx python3-sphinx_rtd_theme ninja"
 makedepends="capstone-devel dtc-devel libpng-devel libjpeg-turbo-devel pixman-devel
  snappy-devel libuuid-devel libX11-devel alsa-lib-devel libaio-devel gnutls-devel
  libsasl-devel libglib-devel ncurses-devel libseccomp-devel nss-devel
@@ -25,17 +25,17 @@ makedepends="capstone-devel dtc-devel libpng-devel libjpeg-turbo-devel pixman-de
  $(vopt_if jack 'jack-devel') $(vopt_if pulseaudio 'pulseaudio-devel')"
 short_desc="Open Source Processor Emulator"
 maintainer="Orphaned <orphan@voidlinux.org>"
-license="GPL-2.0-or-later, LGPL-2.1-or-later"
+license="GPL-2.0-only, LGPL-2.1-only"
 homepage="https://www.qemu.org"
 distfiles="https://wiki.qemu.org/download/qemu-${version}.tar.bz2"
-checksum=f7ac2b85b3f1831e6810b140306e30af91556e15784864b209f3942858947fd0
+checksum=53a2388f4f67d03e94ed7fe192d8828e64c535fadf7bf9dd0bc1d2091eedf624
 ignore_elf_dirs="/usr/share/qemu"
 nostrip_files="hppa-firmware.img openbios-ppc openbios-sparc32 openbios-sparc64
  palcode-clipper s390-ccw.img s390-netboot.img u-boot.e500 opensbi-riscv32-generic-fw_dynamic.elf
  opensbi-riscv64-generic-fw_dynamic.elf"
 
-build_options="gtk3 opengl sdl2 spice virgl smartcard numa iscsi jack pulseaudio"
-build_options_default="opengl gtk3 virgl sdl2 numa iscsi jack pulseaudio"
+build_options="gtk3 iscsi jack numa opengl pulseaudio sdl2 smartcard spice virgl"
+build_options_default="gtk3 iscsi jack numa opengl pulseaudio sdl2 smartcard spice virgl"
 desc_option_sdl2="Enable SDL (2.x) video output"
 desc_option_spice="Enable support for SPICE"
 desc_option_virgl="Enable support for VirGL (A Virtual 3D GPU renderer)"
@@ -43,37 +43,10 @@ desc_option_smartcard="Enable smartcard support"
 desc_option_numa="Enable support for host NUMA"
 desc_option_iscsi="Enable support for iSCSI"
 
-case "$XBPS_TARGET_MACHINE" in
-	aarch64-musl) CFLAGS="-D_LINUX_SYSINFO_H";;
-esac
-
-if [ "$XBPS_TARGET_ENDIAN" = "le" ]; then
-	build_options_default+=" spice"
-fi
-
 if [ "$CROSS_BUILD" ]; then
 	configure_args+=" --cross-prefix=${XBPS_CROSS_TRIPLET}-"
-else
-	build_options_default+=" smartcard"
-fi
-
-if [ "$XBPS_CHECK_PKGS" != full ]; then
-	make_check_target=check-unit
 fi
 
-post_extract() {
-	if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
-		grep -rl 'Input/output error' tests/qemu-iotests |
-			xargs -n1 sed -i -e 's;Input/output error;I/O error;g'
-		grep -rl 'Operation not supported' tests/qemu-iotests |
-			xargs -n1 sed -i -e 's;Operation not supported;Not supported;g'
-	fi
-}
-
-pre_configure() {
-	unset CPP
-}
-
 post_install() {
 	vdoc "${FILESDIR}/README.voidlinux"
 

From 03fa5482ffd514f24c994e0965cc39f59365a3a1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Cerqueira?= <acerqueira021@gmail.com>
Date: Fri, 1 Sep 2023 18:31:29 +0100
Subject: [PATCH 2/2] qemu-user-static: update to 8.1.0.

---
 srcpkgs/qemu-user-static/template | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/srcpkgs/qemu-user-static/template b/srcpkgs/qemu-user-static/template
index 2a8da9b53f2d5..fa09affc73bf8 100644
--- a/srcpkgs/qemu-user-static/template
+++ b/srcpkgs/qemu-user-static/template
@@ -1,20 +1,20 @@
 # Template file for 'qemu-user-static'
 # This package should be updated together with qemu
 pkgname=qemu-user-static
-version=7.1.0
-revision=3
+version=8.1.0
+revision=1
 build_style=configure
 configure_args="--prefix=/usr --sysconfdir=/etc --libexecdir=/usr/libexec
  --disable-kvm --disable-png --disable-virtfs --disable-fdt --disable-seccomp
  --enable-linux-user --disable-system --static --disable-pie"
-hostmakedepends="pkg-config perl python3 ninja"
+hostmakedepends="flex pkg-config perl python3 ninja"
 makedepends="dtc-devel libglib-devel pixman-devel libuuid-devel"
 short_desc="QEMU User-mode emulators (statically compiled)"
 maintainer="Orphaned <orphan@voidlinux.org>"
-license="GPL-2.0-or-later, LGPL-2.1-or-later"
+license="GPL-2.0-only, LGPL-2.1-only"
 homepage="https://www.qemu.org"
 distfiles="https://wiki.qemu.org/download/qemu-${version}.tar.bz2"
-checksum=f7ac2b85b3f1831e6810b140306e30af91556e15784864b209f3942858947fd0
+checksum=53a2388f4f67d03e94ed7fe192d8828e64c535fadf7bf9dd0bc1d2091eedf624
 
 _fmts="aarch64 aarch64_be alpha arm armeb cris hppa i386 m68k microblaze
  microblazeel mips mipsel mips64 mips64el mipsn32 mipsn32el or1k
@@ -111,10 +111,6 @@ done
 
 binfmts="${binfmts%?}"
 
-pre_configure() {
-	unset CPP
-}
-
 post_install() {
 	# Remove unneeded stuff.
 	rm -rf ${DESTDIR}/etc ${DESTDIR}/usr/share ${DESTDIR}/usr/libexec

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: qemu: update to 8.0.3.
  2023-07-03 17:50 [PR PATCH] qemu: update to 8.0.2 motorto
                   ` (30 preceding siblings ...)
  2023-09-01 17:32 ` [PR PATCH] [Updated] " motorto
@ 2023-09-01 17:33 ` motorto
  2023-09-01 22:46 ` [PR PATCH] [Updated] qemu: update to 8.1.0 motorto
                   ` (6 subsequent siblings)
  38 siblings, 0 replies; 40+ messages in thread
From: motorto @ 2023-09-01 17:33 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 226 bytes --]

New comment by motorto on void-packages repository

https://github.com/void-linux/void-packages/pull/44822#issuecomment-1703101327

Comment:
> https://gitlab.com/qemu-project/qemu/-/tags/v8.1.0

Appreciate ! Updated the PR.

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [PR PATCH] [Updated] qemu: update to 8.1.0.
  2023-07-03 17:50 [PR PATCH] qemu: update to 8.0.2 motorto
                   ` (31 preceding siblings ...)
  2023-09-01 17:33 ` motorto
@ 2023-09-01 22:46 ` motorto
  2023-09-01 23:34 ` motorto
                   ` (5 subsequent siblings)
  38 siblings, 0 replies; 40+ messages in thread
From: motorto @ 2023-09-01 22:46 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1878 bytes --]

There is an updated pull request by motorto against master on the void-packages repository

https://github.com/motorto/void-packages qemu-8.0.2
https://github.com/void-linux/void-packages/pull/44822

qemu: update to 8.1.0.
<!-- Uncomment relevant sections and delete options which are not applicable -->
[ci-skip] 

Draft because of: https://github.com/void-linux/void-packages/pull/44822#issuecomment-1633611714


#### Testing the changes
- I tested the changes in this PR: **YES**, runned a Windows vm machine and it worked fine. 
**DIDN'T Test the qemu-user-static**

Removed a bunch of patches that in my research are no longer needed:

- Removed all ppc related patches since that arch isn't no longer supported.
- gcc12.patch: because it builds fine now in this version
- fix-softfloat-fesetround.patch: don't have a system to try it, but alpine doesn't have any patch related to this)
- mmap-mremap-efaul: not sure about if we should keep this one

Kept this patches:

- musl-initialize-msghdr.patch: just update in order to apply.

Added this ones:

- ~~CVE-2023-2861.patch~~
- ~~keymap.patch: xkeyboard-config 2.39 removed the legacy alias of ar -> ara~~
- ~~fix-brk0.patch: make sure that initial brk(0) is page-aligned~~
- lfs64.patch: Builds defines -D_FILE_OFFSET_BITS=64 which makes the original functions
anf macros behave same as their 64 suffixed counterparts. This also
helps in compiling with latest musl C library, where these macros and
functions are no more available under _GNU_SOURCE feature macro

#### Local build testing
- I built this PR locally for my native architecture, x86-64-glibc
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - ~~aarch64-musl (cross)~~
  - ~~x86_64-musl~~



A patch file from https://github.com/void-linux/void-packages/pull/44822.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-qemu-8.0.2-44822.patch --]
[-- Type: text/x-diff, Size: 34303 bytes --]

From d5ac62e1f1b777767c5c8273dc9347d7fe8c7c57 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Cerqueira?= <acerqueira021@gmail.com>
Date: Fri, 1 Sep 2023 15:34:18 +0100
Subject: [PATCH 1/2] qemu: update to 8.1.0.

---
 .../qemu/patches/fix-linux-user-ppc32.patch   | 117 ----------
 .../patches/fix-softfloat-fesetround.patch    |  39 ----
 srcpkgs/qemu/patches/gcc12.patch              |  72 ------
 srcpkgs/qemu/patches/lfs64.patch              | 212 ++++++++++++++++++
 srcpkgs/qemu/patches/mmap-mremap-efault.patch |  42 ----
 .../qemu/patches/musl-initialize-msghdr.patch |   7 +-
 srcpkgs/qemu/patches/musl-ppc.patch           |  25 ---
 srcpkgs/qemu/patches/musl-rlimit-rttime.patch |  13 --
 srcpkgs/qemu/patches/xxx-ppcle.patch          | 113 ----------
 srcpkgs/qemu/template                         |  46 +---
 10 files changed, 226 insertions(+), 460 deletions(-)
 delete mode 100644 srcpkgs/qemu/patches/fix-linux-user-ppc32.patch
 delete mode 100644 srcpkgs/qemu/patches/fix-softfloat-fesetround.patch
 delete mode 100644 srcpkgs/qemu/patches/gcc12.patch
 create mode 100644 srcpkgs/qemu/patches/lfs64.patch
 delete mode 100644 srcpkgs/qemu/patches/mmap-mremap-efault.patch
 delete mode 100644 srcpkgs/qemu/patches/musl-ppc.patch
 delete mode 100644 srcpkgs/qemu/patches/musl-rlimit-rttime.patch
 delete mode 100644 srcpkgs/qemu/patches/xxx-ppcle.patch

diff --git a/srcpkgs/qemu/patches/fix-linux-user-ppc32.patch b/srcpkgs/qemu/patches/fix-linux-user-ppc32.patch
deleted file mode 100644
index cd47435d5aa9a..0000000000000
--- a/srcpkgs/qemu/patches/fix-linux-user-ppc32.patch
+++ /dev/null
@@ -1,117 +0,0 @@
-commit 37814f62c2cc7aba2eea073014d6c53dcd5bf42c
-Author: q66 <daniel@octaforge.org>
-Date:   Fri Jul 1 16:53:55 2022 +0200
-
-    fix linux-user build on 32-bit ppc
-    
-    Partial revert https://gitlab.com/qemu-project/qemu/-/commit/9d1401b79463e74adbfac69d836789d4e103fb61
-    and https://gitlab.com/qemu-project/qemu/-/commit/0a7e01904d407baa73c1baddbdfc9ccf2ace8356
-
-diff --git a/common-user/host/ppc/safe-syscall.inc.S b/common-user/host/ppc/safe-syscall.inc.S
-new file mode 100644
-index 0000000..e69de29
-diff --git a/common-user/safe-syscall-error.c b/common-user/safe-syscall-error.c
-index cf74b50..a36132c 100644
---- a/common-user/safe-syscall-error.c
-+++ b/common-user/safe-syscall-error.c
-@@ -12,6 +12,7 @@
- #include "qemu/osdep.h"
- #include "user/safe-syscall.h"
- 
-+#if !defined(__powerpc__) || defined(__powerpc64__)
- /*
-  * This is intended to be invoked via tail-call on the error path
-  * from the assembly in host/arch/safe-syscall.inc.S.  This takes
-@@ -23,3 +24,4 @@ long safe_syscall_set_errno_tail(int value)
-     errno = value;
-     return -1;
- }
-+#endif
-diff --git a/include/user/safe-syscall.h b/include/user/safe-syscall.h
-index 61a04e2..793fe84 100644
---- a/include/user/safe-syscall.h
-+++ b/include/user/safe-syscall.h
-@@ -125,6 +125,8 @@
-  * kinds of restartability.
-  */
- 
-+#if !defined(__powerpc__) || defined(__powerpc64__)
-+
- /* The core part of this function is implemented in assembly */
- extern long safe_syscall_base(int *pending, long number, ...);
- extern long safe_syscall_set_errno_tail(int value);
-@@ -137,4 +139,10 @@ extern char safe_syscall_end[];
-     safe_syscall_base(&((TaskState *)thread_cpu->opaque)->signal_pending, \
-                       __VA_ARGS__)
- 
-+#else
-+
-+#define safe_syscall syscall
-+
-+#endif
-+
- #endif
-diff --git a/linux-user/include/host/ppc/host-signal.h b/linux-user/include/host/ppc/host-signal.h
-new file mode 100644
-index 0000000..b80384d
---- /dev/null
-+++ b/linux-user/include/host/ppc/host-signal.h
-@@ -0,0 +1,38 @@
-+/*
-+ * host-signal.h: signal info dependent on the host architecture
-+ *
-+ * Copyright (c) 2003-2005 Fabrice Bellard
-+ * Copyright (c) 2021 Linaro Limited
-+ *
-+ * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
-+ * See the COPYING file in the top-level directory.
-+ */
-+
-+#ifndef PPC_HOST_SIGNAL_H
-+#define PPC_HOST_SIGNAL_H
-+
-+/* The third argument to a SA_SIGINFO handler is ucontext_t. */
-+typedef ucontext_t host_sigcontext;
-+
-+static inline uintptr_t host_signal_pc(host_sigcontext *uc)
-+{
-+    return uc->uc_mcontext.regs->nip;
-+}
-+
-+static inline void host_signal_set_pc(host_sigcontext *uc, uintptr_t pc)
-+{
-+    uc->uc_mcontext.regs->nip = pc;
-+}
-+
-+static inline void *host_signal_mask(host_sigcontext *uc)
-+{
-+    return &uc->uc_sigmask;
-+}
-+
-+static inline bool host_signal_write(siginfo_t *info, host_sigcontext *uc)
-+{
-+    return uc->uc_mcontext.regs->trap != 0x400
-+        && (uc->uc_mcontext.regs->dsisr & 0x02000000);
-+}
-+
-+#endif
-diff --git a/linux-user/signal.c b/linux-user/signal.c
-index 092e70b..b8dfa8a 100644
---- a/linux-user/signal.c
-+++ b/linux-user/signal.c
-@@ -800,6 +800,7 @@ void queue_signal(CPUArchState *env, int sig, int si_type,
- /* Adjust the signal context to rewind out of safe-syscall if we're in it */
- static inline void rewind_if_in_safe_syscall(void *puc)
- {
-+#if !defined(__powerpc__) || defined(__powerpc64__)
-     host_sigcontext *uc = (host_sigcontext *)puc;
-     uintptr_t pcreg = host_signal_pc(uc);
- 
-@@ -807,6 +808,7 @@ static inline void rewind_if_in_safe_syscall(void *puc)
-         && pcreg < (uintptr_t)safe_syscall_end) {
-         host_signal_set_pc(uc, (uintptr_t)safe_syscall_start);
-     }
-+#endif
- }
- 
- static void host_signal_handler(int host_sig, siginfo_t *info, void *puc)
diff --git a/srcpkgs/qemu/patches/fix-softfloat-fesetround.patch b/srcpkgs/qemu/patches/fix-softfloat-fesetround.patch
deleted file mode 100644
index ecdd049f79212..0000000000000
--- a/srcpkgs/qemu/patches/fix-softfloat-fesetround.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-Source: @pullmoll
-Upstream: no
-Reason: Target architectures with soft float do not define these constants.
-
---- a/tests/fp/fp-bench.c	2020-12-08 17:59:44.000000000 +0100
-+++ b/tests/fp/fp-bench.c	2020-12-12 20:38:40.702235420 +0100
-@@ -485,16 +485,32 @@
- 
-     switch (rounding) {
-     case ROUND_EVEN:
-+#if defined(FE_TONEAREST)
-         rhost = FE_TONEAREST;
-+#else
-+	return;
-+#endif
-         break;
-     case ROUND_ZERO:
-+#if defined(FE_TOWARDZERO)
-         rhost = FE_TOWARDZERO;
-+#else
-+	return;
-+#endif
-         break;
-     case ROUND_DOWN:
-+#if defined(FE_DOWNWARD)
-         rhost = FE_DOWNWARD;
-+#else
-+	return;
-+#endif
-         break;
-     case ROUND_UP:
-+#if defined(FE_UPWARD)
-         rhost = FE_UPWARD;
-+#else
-+	return;
-+#endif
-         break;
-     case ROUND_TIEAWAY:
-         die_host_rounding(rounding);
diff --git a/srcpkgs/qemu/patches/gcc12.patch b/srcpkgs/qemu/patches/gcc12.patch
deleted file mode 100644
index 2a4b2bd036096..0000000000000
--- a/srcpkgs/qemu/patches/gcc12.patch
+++ /dev/null
@@ -1,72 +0,0 @@
-From 5cb993ff131fca2abef3ce074a20258fd6fce557 Mon Sep 17 00:00:00 2001
-From: Bernhard Beschow <shentey@gmail.com>
-Date: Sat, 18 Mar 2023 19:59:31 +0100
-Subject: [PATCH] qemu/osdep: Switch position of "extern" and "G_NORETURN"
-
-Fixes the Windows build under msys2 using GCC 12 which fails with the following
-error:
-
-  [184/579] Compiling C++ object qga/vss-win32/qga-vss.dll.p/install.cpp.obj
-  FAILED: qga/vss-win32/qga-vss.dll.p/install.cpp.obj
-  "c++" "-m64" "-mcx16" "-Iqga/vss-win32/qga-vss.dll.p" "-Iqga/vss-win32" "-I../src/qga/vss-win32" "-I." "-Iqapi" "-Itrace" "-Iui" "-Iui/shader" "-IC:/msys64/mingw64/include/glib-2.0" "-IC:/msys64/mingw64/lib/glib-2.0/include" "-fdiagnostics-color=auto" "-Wall" "-Winvalid-pch" "-Wnon-virtual-dtor" "-Werror" "-std=gnu++11" "-g" "-iquote" "." "-iquote" "C:/msys64/home/shentey/Projects/qemu/src" "-iquote" "C:/msys64/home/shentey/Projects/qemu/src/include" "-iquote" "C:/msys64/home/shentey/Projects/qemu/src/tcg/i386" "-D__STDC_LIMIT_MACROS" "-D__STDC_CONSTANT_MACROS" "-D__STDC_FORMAT_MACROS" "-fno-pie" "-no-pie" "-D_GNU_SOURCE" "-D_FILE_OFFSET_BITS=64" "-D_LARGEFILE_SOURCE" "-fno-strict-aliasing" "-fno-common" "-fwrapv" "-Wundef" "-Wwrite-strings" "-Wtype-limits" "-Wformat-security" "-Wformat-y2k" "-Winit-self" "-Wignored-qualifiers" "-Wempty-body" "-Wendif-labels" "-Wexpansion-to-defined" "-Wimplicit-fallthrough=2" "-Wmissing-format-attribute" "-Wno-missing-include-dirs" "-Wno-shift-negative-value" "-Wno-psabi" "-fstack-protector-strong" "-Wno-unknown-pragmas" "-Wno-delete-non-virtual-dtor" "-Wno-non-virtual-dtor" -MD -MQ qga/vss-win32/qga-vss.dll.p/install.cpp.obj -MF "qga/vss-win32/qga-vss.dll.p/install.cpp.obj.d" -o qga/vss-win32/qga-vss.dll.p/install.cpp.obj "-c" ../src/qga/vss-win32/install.cpp
-  In file included from C:/msys64/mingw64/lib/glib-2.0/include/glibconfig.h:9,
-              from C:/msys64/mingw64/include/glib-2.0/glib/gtypes.h:34,
-              from C:/msys64/mingw64/include/glib-2.0/glib/galloca.h:34,
-              from C:/msys64/mingw64/include/glib-2.0/glib.h:32,
-              from C:/msys64/home/shentey/Projects/qemu/src/include/glib-compat.h:32,
-              from C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:144,
-              from ../src/qga/vss-win32/install.cpp:13:
-  C:/msys64/mingw64/include/glib-2.0/glib/gmacros.h:1075:21: error: standard attributes in middle of decl-specifiers
-  1075 | # define G_NORETURN [[noreturn]]
-        |                     ^
-  C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:240:8: note: in expansion of macro 'G_NORETURN'
-  240 | extern G_NORETURN
-        |        ^~~~~~~~~~
-  C:/msys64/mingw64/include/glib-2.0/glib/gmacros.h:1075:21: note: standard attributes must precede the decl-specifiers to apply to the declaration, or follow them to apply to the type
-  1075 | # define G_NORETURN [[noreturn]]
-        |                     ^
-  C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:240:8: note: in expansion of macro 'G_NORETURN'
-  240 | extern G_NORETURN
-        |        ^~~~~~~~~~
-  C:/msys64/mingw64/include/glib-2.0/glib/gmacros.h:1075:21: error: attribute ignored [-Werror=attributes]
-  1075 | # define G_NORETURN [[noreturn]]
-        |                     ^
-  C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:240:8: note: in expansion of macro 'G_NORETURN'
-  240 | extern G_NORETURN
-        |        ^~~~~~~~~~
-  C:/msys64/mingw64/include/glib-2.0/glib/gmacros.h:1075:21: note: an attribute that appertains to a type-specifier is ignored
-  1075 | # define G_NORETURN [[noreturn]]
-        |                     ^
-  C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:240:8: note: in expansion of macro 'G_NORETURN'
-  240 | extern G_NORETURN
-        |        ^~~~~~~~~~
-  cc1plus.exe: all warnings being treated as errors
-
-Apparently it also fixes the compilation with Clang 15 (see
-https://gitlab.com/qemu-project/qemu/-/issues/1541 ).
-
-Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1541
-Signed-off-by: Bernhard Beschow <shentey@gmail.com>
-Message-Id: <20230318185931.181659-1-shentey@gmail.com>
-Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
-Signed-off-by: Thomas Huth <thuth@redhat.com>
----
- include/qemu/osdep.h | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
-index f68b5d8708c..9eff0be95bd 100644
---- a/include/qemu/osdep.h
-+++ b/include/qemu/osdep.h
-@@ -237,7 +237,7 @@ extern "C" {
-  * supports QEMU_ERROR, this will be reported at compile time; otherwise
-  * this will be reported at link time due to the missing symbol.
-  */
--extern G_NORETURN
-+G_NORETURN extern
- void QEMU_ERROR("code path is reachable")
-     qemu_build_not_reached_always(void);
- #if defined(__OPTIMIZE__) && !defined(__NO_INLINE__)
--- 
-GitLab
-
diff --git a/srcpkgs/qemu/patches/lfs64.patch b/srcpkgs/qemu/patches/lfs64.patch
new file mode 100644
index 0000000000000..095ab3dceadca
--- /dev/null
+++ b/srcpkgs/qemu/patches/lfs64.patch
@@ -0,0 +1,212 @@
+Builds defines -D_FILE_OFFSET_BITS=64 which makes the original functions
+anf macros behave same as their 64 suffixed counterparts. This also
+helps in compiling with latest musl C library, where these macros and
+functions are no more available under _GNU_SOURCE feature macro
+
+source: https://git.alpinelinux.org/aports/plain/community/qemu/lfs64.patch
+--
+
+diff --git a/linux-user/syscall.c b/linux-user/syscall.c
+index bbba2a6..38fa09a 100644
+--- a/linux-user/syscall.c
++++ b/linux-user/syscall.c
+@@ -6812,13 +6812,13 @@ static int target_to_host_fcntl_cmd(int cmd)
+         ret = cmd;
+         break;
+     case TARGET_F_GETLK:
+-        ret = F_GETLK64;
++        ret = F_GETLK;
+         break;
+     case TARGET_F_SETLK:
+-        ret = F_SETLK64;
++        ret = F_SETLK;
+         break;
+     case TARGET_F_SETLKW:
+-        ret = F_SETLKW64;
++        ret = F_SETLKW;
+         break;
+     case TARGET_F_GETOWN:
+         ret = F_GETOWN;
+@@ -6834,13 +6834,13 @@ static int target_to_host_fcntl_cmd(int cmd)
+         break;
+ #if TARGET_ABI_BITS == 32
+     case TARGET_F_GETLK64:
+-        ret = F_GETLK64;
++        ret = F_GETLK;
+         break;
+     case TARGET_F_SETLK64:
+-        ret = F_SETLK64;
++        ret = F_SETLK;
+         break;
+     case TARGET_F_SETLKW64:
+-        ret = F_SETLKW64;
++        ret = F_SETLKW;
+         break;
+ #endif
+     case TARGET_F_SETLEASE:
+@@ -6894,8 +6894,8 @@ static int target_to_host_fcntl_cmd(int cmd)
+      * them to 5, 6 and 7 before making the syscall(). Since we make the
+      * syscall directly, adjust to what is supported by the kernel.
+      */
+-    if (ret >= F_GETLK64 && ret <= F_SETLKW64) {
+-        ret -= F_GETLK64 - 5;
++    if (ret >= F_GETLK && ret <= F_SETLKW) {
++        ret -= F_GETLK - 5;
+     }
+ #endif
+ 
+@@ -6928,7 +6928,7 @@ static int host_to_target_flock(int type)
+     return type;
+ }
+ 
+-static inline abi_long copy_from_user_flock(struct flock64 *fl,
++static inline abi_long copy_from_user_flock(struct flock *fl,
+                                             abi_ulong target_flock_addr)
+ {
+     struct target_flock *target_fl;
+@@ -6953,7 +6953,7 @@ static inline abi_long copy_from_user_flock(struct flock64 *fl,
+ }
+ 
+ static inline abi_long copy_to_user_flock(abi_ulong target_flock_addr,
+-                                          const struct flock64 *fl)
++                                          const struct flock *fl)
+ {
+     struct target_flock *target_fl;
+     short l_type;
+@@ -6972,8 +6972,8 @@ static inline abi_long copy_to_user_flock(abi_ulong target_flock_addr,
+     return 0;
+ }
+ 
+-typedef abi_long from_flock64_fn(struct flock64 *fl, abi_ulong target_addr);
+-typedef abi_long to_flock64_fn(abi_ulong target_addr, const struct flock64 *fl);
++typedef abi_long from_flock64_fn(struct flock *fl, abi_ulong target_addr);
++typedef abi_long to_flock64_fn(abi_ulong target_addr, const struct flock *fl);
+ 
+ #if defined(TARGET_ARM) && TARGET_ABI_BITS == 32
+ struct target_oabi_flock64 {
+@@ -6984,7 +6984,7 @@ struct target_oabi_flock64 {
+     abi_int   l_pid;
+ } QEMU_PACKED;
+ 
+-static inline abi_long copy_from_user_oabi_flock64(struct flock64 *fl,
++static inline abi_long copy_from_user_oabi_flock64(struct flock *fl,
+                                                    abi_ulong target_flock_addr)
+ {
+     struct target_oabi_flock64 *target_fl;
+@@ -7009,7 +7009,7 @@ static inline abi_long copy_from_user_oabi_flock64(struct flock64 *fl,
+ }
+ 
+ static inline abi_long copy_to_user_oabi_flock64(abi_ulong target_flock_addr,
+-                                                 const struct flock64 *fl)
++                                                 const struct flock *fl)
+ {
+     struct target_oabi_flock64 *target_fl;
+     short l_type;
+@@ -7029,7 +7029,7 @@ static inline abi_long copy_to_user_oabi_flock64(abi_ulong target_flock_addr,
+ }
+ #endif
+ 
+-static inline abi_long copy_from_user_flock64(struct flock64 *fl,
++static inline abi_long copy_from_user_flock64(struct flock *fl,
+                                               abi_ulong target_flock_addr)
+ {
+     struct target_flock64 *target_fl;
+@@ -7054,7 +7054,7 @@ static inline abi_long copy_from_user_flock64(struct flock64 *fl,
+ }
+ 
+ static inline abi_long copy_to_user_flock64(abi_ulong target_flock_addr,
+-                                            const struct flock64 *fl)
++                                            const struct flock *fl)
+ {
+     struct target_flock64 *target_fl;
+     short l_type;
+@@ -7075,7 +7075,7 @@ static inline abi_long copy_to_user_flock64(abi_ulong target_flock_addr,
+ 
+ static abi_long do_fcntl(int fd, int cmd, abi_ulong arg)
+ {
+-    struct flock64 fl64;
++    struct flock fl64;
+ #ifdef F_GETOWN_EX
+     struct f_owner_ex fox;
+     struct target_f_owner_ex *target_fox;
+@@ -7347,7 +7347,7 @@ static inline abi_long target_truncate64(CPUArchState *cpu_env, const char *arg1
+         arg2 = arg3;
+         arg3 = arg4;
+     }
+-    return get_errno(truncate64(arg1, target_offset64(arg2, arg3)));
++    return get_errno(truncate(arg1, target_offset64(arg2, arg3)));
+ }
+ #endif
+ 
+@@ -7361,7 +7361,7 @@ static inline abi_long target_ftruncate64(CPUArchState *cpu_env, abi_long arg1,
+         arg2 = arg3;
+         arg3 = arg4;
+     }
+-    return get_errno(ftruncate64(arg1, target_offset64(arg2, arg3)));
++    return get_errno(ftruncate(arg1, target_offset64(arg2, arg3)));
+ }
+ #endif
+ 
+@@ -8597,7 +8597,7 @@ static int do_getdents(abi_long dirfd, abi_long arg2, abi_long count)
+     void *tdirp;
+     int hlen, hoff, toff;
+     int hreclen, treclen;
+-    off64_t prev_diroff = 0;
++    off_t prev_diroff = 0;
+ 
+     hdirp = g_try_malloc(count);
+     if (!hdirp) {
+@@ -8650,7 +8650,7 @@ static int do_getdents(abi_long dirfd, abi_long arg2, abi_long count)
+              * Return what we have, resetting the file pointer to the
+              * location of the first record not returned.
+              */
+-            lseek64(dirfd, prev_diroff, SEEK_SET);
++            lseek(dirfd, prev_diroff, SEEK_SET);
+             break;
+         }
+ 
+@@ -8684,7 +8684,7 @@ static int do_getdents64(abi_long dirfd, abi_long arg2, abi_long count)
+     void *tdirp;
+     int hlen, hoff, toff;
+     int hreclen, treclen;
+-    off64_t prev_diroff = 0;
++    off_t prev_diroff = 0;
+ 
+     hdirp = g_try_malloc(count);
+     if (!hdirp) {
+@@ -8726,7 +8726,7 @@ static int do_getdents64(abi_long dirfd, abi_long arg2, abi_long count)
+              * Return what we have, resetting the file pointer to the
+              * location of the first record not returned.
+              */
+-            lseek64(dirfd, prev_diroff, SEEK_SET);
++            lseek(dirfd, prev_diroff, SEEK_SET);
+             break;
+         }
+ 
+@@ -11157,7 +11157,7 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,
+                 return -TARGET_EFAULT;
+             }
+         }
+-        ret = get_errno(pread64(arg1, p, arg3, target_offset64(arg4, arg5)));
++        ret = get_errno(pread(arg1, p, arg3, target_offset64(arg4, arg5)));
+         unlock_user(p, arg2, ret);
+         return ret;
+     case TARGET_NR_pwrite64:
+@@ -11174,7 +11174,7 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,
+                 return -TARGET_EFAULT;
+             }
+         }
+-        ret = get_errno(pwrite64(arg1, p, arg3, target_offset64(arg4, arg5)));
++        ret = get_errno(pwrite(arg1, p, arg3, target_offset64(arg4, arg5)));
+         unlock_user(p, arg2, 0);
+         return ret;
+ #endif
+@@ -12034,7 +12034,7 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,
+     case TARGET_NR_fcntl64:
+     {
+         int cmd;
+-        struct flock64 fl;
++        struct flock fl;
+         from_flock64_fn *copyfrom = copy_from_user_flock64;
+         to_flock64_fn *copyto = copy_to_user_flock64;
+ 
diff --git a/srcpkgs/qemu/patches/mmap-mremap-efault.patch b/srcpkgs/qemu/patches/mmap-mremap-efault.patch
deleted file mode 100644
index 5a70e9658b300..0000000000000
--- a/srcpkgs/qemu/patches/mmap-mremap-efault.patch
+++ /dev/null
@@ -1,42 +0,0 @@
-Source: @pullmoll
-Upstream: no
-Reason: errno=EFAULT when the address passed to mremap(2) is not valid
-
-See Rich Felker's comment at https://www.openwall.com/lists/musl/2017/06/21/2 for
-why we need to return errno as described in man mremap(2) from qemu-user-static.
-Also speed up the loop when checking for increasing the mappings size to go
-in steps of TARGET_PAGE_SIZE and OR-in a check for the very last byte of the range.
-diff --git linux-user/mmap.c linux-user/mmap.c
-index 7e3b245..1e8d0f1 100644
---- a/linux-user/mmap.c
-+++ b/linux-user/mmap.c
-@@ -738,7 +738,7 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size,
-          !guest_range_valid_untagged(new_addr, new_size)) ||
-         ((flags & MREMAP_MAYMOVE) == 0 &&
-          !guest_range_valid_untagged(old_addr, new_size))) {
--        errno = ENOMEM;
-+        errno = EFAULT;
-         return -1;
-     }
- 
-@@ -775,9 +775,10 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size,
-             abi_ulong addr;
-             for (addr = old_addr + old_size;
-                  addr < old_addr + new_size;
--                 addr++) {
-+                 addr += TARGET_PAGE_SIZE) {
-                 prot |= page_get_flags(addr);
-             }
-+				prot |= page_get_flags(old_addr + new_size - 1);
-         }
-         if (prot == 0) {
-             host_addr = mremap(g2h_untagged(old_addr),
-@@ -796,7 +797,7 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size,
-                 }
-             }
-         } else {
--            errno = ENOMEM;
-+            errno = EFAULT;
-             host_addr = MAP_FAILED;
-         }
-     }
diff --git a/srcpkgs/qemu/patches/musl-initialize-msghdr.patch b/srcpkgs/qemu/patches/musl-initialize-msghdr.patch
index 6d96b3511dafe..2c5cf4552ecfb 100644
--- a/srcpkgs/qemu/patches/musl-initialize-msghdr.patch
+++ b/srcpkgs/qemu/patches/musl-initialize-msghdr.patch
@@ -1,10 +1,10 @@
 Source: https://github.com/void-linux/void-packages/issues/23557
 
-diff --git linux-user/syscall.c linux-user/syscall.c
-index 945fc25..8d8b68a 100644
+diff --git a/linux-user/syscall.c b/linux-user/syscall.c
+index 14fdebd..de280af 100644
 --- a/linux-user/syscall.c
 +++ b/linux-user/syscall.c
-@@ -3071,7 +3071,7 @@ static abi_long do_sendrecvmsg_locked(int fd, struct target_msghdr *msgp,
+@@ -3229,7 +3229,7 @@ static abi_long do_sendrecvmsg_locked(int fd, struct target_msghdr *msgp,
                                        int flags, int send)
  {
      abi_long ret, len;
@@ -13,3 +13,4 @@ index 945fc25..8d8b68a 100644
      abi_ulong count;
      struct iovec *vec;
      abi_ulong target_vec;
+
diff --git a/srcpkgs/qemu/patches/musl-ppc.patch b/srcpkgs/qemu/patches/musl-ppc.patch
deleted file mode 100644
index 0b77aa8fc63d4..0000000000000
--- a/srcpkgs/qemu/patches/musl-ppc.patch
+++ /dev/null
@@ -1,25 +0,0 @@
---- a/linux-user/signal.c
-+++ b/linux-user/signal.c
-@@ -21,5 +21,9 @@
- #include "exec/gdbstub.h"
- #include "hw/core/tcg-cpu-ops.h"
- 
-+#if defined(_ARCH_PPC64) && !defined(__GLIBC__) /* musl */
-+#include <asm/ptrace.h>
-+#endif
-+
- #include <sys/ucontext.h>
- #include <sys/resource.h>
---- a/util/mmap-alloc.c
-+++ b/util/mmap-alloc.c
-@@ -25,6 +25,10 @@
- 
- #ifdef CONFIG_LINUX
- #include <sys/vfs.h>
-+/* musl undefs this on ppc and mips */
-+#ifndef MAP_SYNC
-+#define MAP_SYNC 0x80000
-+#endif
- #endif
- 
- size_t qemu_fd_getpagesize(int fd)
diff --git a/srcpkgs/qemu/patches/musl-rlimit-rttime.patch b/srcpkgs/qemu/patches/musl-rlimit-rttime.patch
deleted file mode 100644
index 0cbf9be36a8f1..0000000000000
--- a/srcpkgs/qemu/patches/musl-rlimit-rttime.patch
+++ /dev/null
@@ -1,13 +0,0 @@
---- a/linux-user/syscall.c
-+++ b/linux-user/syscall.c
-@@ -141,6 +141,10 @@
- #include "fd-trans.h"
- #include "tcg/tcg.h"
- 
-+#ifndef RLIMIT_RTTIME
-+#define RLIMIT_RTTIME 15
-+#endif
-+
- #ifndef CLONE_IO
- #define CLONE_IO                0x80000000      /* Clone io context */
- #endif
diff --git a/srcpkgs/qemu/patches/xxx-ppcle.patch b/srcpkgs/qemu/patches/xxx-ppcle.patch
deleted file mode 100644
index 90b32b5e07cd8..0000000000000
--- a/srcpkgs/qemu/patches/xxx-ppcle.patch
+++ /dev/null
@@ -1,113 +0,0 @@
-From 7ece08d7902d5a8c007deeb0b75cb533a41dd882 Mon Sep 17 00:00:00 2001
-From: Daniel Kolesa <daniel@octaforge.org>
-Date: Sun, 7 Mar 2021 01:47:42 +0100
-Subject: [PATCH] support ppcle architecture
-
----
- configure                            | 14 ++++++++++++--
- configs/targets/ppcle-linux-user.mak |  4 ++++
- linux-user/ppc/target_syscall.h      |  4 ++++
- scripts/qemu-binfmt-conf.sh          |  6 +++++-
- tests/tcg/configure.sh               |  2 ++
- 5 files changed, 27 insertions(+), 3 deletions(-)
- create mode 100644 configs/targets/ppcle-linux-user.mak
-
-diff --git a/configure b/configure
-index 18c26e0..03d3e18 100755
---- a/configure
-+++ b/configure
-@@ -653,7 +653,11 @@ elif check_define _ARCH_PPC ; then
-       cpu="ppc64"
-     fi
-   else
--    cpu="ppc"
-+    if check_define _LITTLE_ENDIAN ; then
-+      cpu="ppcle"
-+    else
-+      cpu="ppc"
-+    fi
-   fi
- elif check_define __mips__ ; then
-   cpu="mips"
-@@ -638,6 +642,9 @@
- 
-   ppc)
-     CPU_CFLAGS="-m32" ;;
-+  ppcle)
-+    cpu="ppc"
-+    CPU_CFLAGS="-m32 -mlittle-endian" ;;
-   ppc64)
-     CPU_CFLAGS="-m64 -mbig-endian" ;;
-   ppc64le)
-diff --git a/configs/targets/ppcle-linux-user.mak b/configs/targets/ppcle-linux-user.mak
-new file mode 100644
-index 0000000..2259243
---- /dev/null
-+++ b/configs/targets/ppcle-linux-user.mak
-@@ -0,0 +1,4 @@
-+TARGET_ARCH=ppc
-+TARGET_SYSTBL_ABI=common,nospu,32
-+TARGET_SYSTBL=syscall.tbl
-+TARGET_XML_FILES= gdb-xml/power-core.xml gdb-xml/power-fpu.xml gdb-xml/power-altivec.xml gdb-xml/power-spe.xml
-diff --git a/linux-user/ppc/target_syscall.h b/linux-user/ppc/target_syscall.h
-index b9c4b81..cf26497 100644
---- a/linux-user/ppc/target_syscall.h
-+++ b/linux-user/ppc/target_syscall.h
-@@ -65,7 +65,11 @@ struct target_revectored_struct {
- #define UNAME_MACHINE "ppc64le"
- #endif
- #else
-+#if TARGET_BIG_ENDIAN
- #define UNAME_MACHINE "ppc"
-+#else
-+#define UNAME_MACHINE "ppcle"
-+#endif
- #endif
- #define UNAME_MINIMUM_RELEASE "2.6.32"
- 
-diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh
-index 9f1580a..393943f 100755
---- a/scripts/qemu-binfmt-conf.sh
-+++ b/scripts/qemu-binfmt-conf.sh
-@@ -46,6 +46,10 @@ ppc_magic='\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x
- ppc_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
- ppc_family=ppc
- 
-+ppcle_magic='\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x14\x00'
-+ppcle_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\x00'
-+ppc_family=ppcle
-+
- ppc64_magic='\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x15'
- ppc64_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
- ppc64_family=ppc
-@@ -148,7 +152,7 @@ qemu_get_family() {
-     "Power Macintosh"|ppc64|powerpc|ppc)
-         echo "ppc"
-         ;;
--    ppc64el|ppc64le)
-+    ppc64el|ppc64le|ppcel|ppcle)
-         echo "ppcle"
-         ;;
-     arm|armel|armhf|arm64|armv[4-9]*l|aarch64)
-diff --git a/configure b/configure
-index 72ab03f11a..0691929d76 100755
---- a/configure
-+++ b/configure
-@@ -1866,6 +1866,7 @@ fi
- : ${cross_prefix_mips="mips-linux-gnu-"}
- : ${cross_prefix_nios2="nios2-linux-gnu-"}
- : ${cross_prefix_ppc="powerpc-linux-gnu-"}
-+: ${cross_prefix_ppcle="powerpcle-linux-gnu-"}
- : ${cross_prefix_ppc64="powerpc64-linux-gnu-"}
- : ${cross_prefix_ppc64le="$cross_prefix_ppc64"}
- : ${cross_prefix_riscv64="riscv64-linux-gnu-"}
-@@ -1883,6 +1884,7 @@ fi
- : ${cross_cc_cflags_hexagon="-mv67 -O2 -static"}
- : ${cross_cc_cflags_i386="-m32"}
- : ${cross_cc_cflags_ppc="-m32 -mbig-endian"}
-+: ${cross_cc_cflags_ppcle="-m32"}
- : ${cross_cc_cflags_ppc64="-m64 -mbig-endian"}
- : ${cross_cc_ppc64le="$cross_cc_ppc64"}
- : ${cross_cc_cflags_ppc64le="-m64 -mlittle-endian"}
-2.30.1
-
diff --git a/srcpkgs/qemu/template b/srcpkgs/qemu/template
index 48ab199e5686b..4f69cdaf54df7 100644
--- a/srcpkgs/qemu/template
+++ b/srcpkgs/qemu/template
@@ -1,8 +1,8 @@
 # Template file for 'qemu'
 # This package should be updated together with qemu-user-static
 pkgname=qemu
-version=7.1.0
-revision=2
+version=8.1.0
+revision=1
 build_style=configure
 configure_args="--prefix=/usr --sysconfdir=/etc --libexecdir=/usr/libexec --localstatedir=/var
  --disable-glusterfs --disable-xen --enable-docs --enable-kvm --enable-libusb --enable-pie
@@ -10,10 +10,11 @@ configure_args="--prefix=/usr --sysconfdir=/etc --libexecdir=/usr/libexec --loca
  --audio-drv-list=alsa$(vopt_if sdl2 ,sdl)$(vopt_if jack ,jack)$(vopt_if pulseaudio ,pa)
  $(vopt_enable opengl) $(vopt_enable pulseaudio pa) $(vopt_enable sdl2 sdl) $(vopt_enable smartcard)
  $(vopt_enable spice) $(vopt_enable virgl virglrenderer) $(vopt_if gtk3 '--enable-gtk')"
-hostmakedepends="gettext pkg-config perl python3 python3-Sphinx python3-sphinx_rtd_theme ninja"
+hostmakedepends="flex gettext glib-devel pkg-config perl python3 python3-Sphinx
+ python3-sphinx_rtd_theme ninja"
 makedepends="capstone-devel dtc-devel libpng-devel libjpeg-turbo-devel pixman-devel
- snappy-devel libuuid-devel libX11-devel alsa-lib-devel libaio-devel gnutls-devel
- libsasl-devel libglib-devel ncurses-devel libseccomp-devel nss-devel
+ snappy-devel libuuid-devel libX11-devel alsa-lib-devel libaio-devel
+ gnutls-devel libsasl-devel ncurses-devel libseccomp-devel nss-devel
  libcurl-devel xfsprogs-devel libcap-ng-devel vde2-devel usbredir-devel
  libbluetooth-devel libssh2-devel libusb-devel libnfs-devel libslirp-devel
  libxkbcommon-devel libzstd-devel $(vopt_if sdl2 'SDL2-devel SDL2_image-devel')
@@ -25,17 +26,17 @@ makedepends="capstone-devel dtc-devel libpng-devel libjpeg-turbo-devel pixman-de
  $(vopt_if jack 'jack-devel') $(vopt_if pulseaudio 'pulseaudio-devel')"
 short_desc="Open Source Processor Emulator"
 maintainer="Orphaned <orphan@voidlinux.org>"
-license="GPL-2.0-or-later, LGPL-2.1-or-later"
+license="GPL-2.0-only, LGPL-2.1-only"
 homepage="https://www.qemu.org"
 distfiles="https://wiki.qemu.org/download/qemu-${version}.tar.bz2"
-checksum=f7ac2b85b3f1831e6810b140306e30af91556e15784864b209f3942858947fd0
+checksum=53a2388f4f67d03e94ed7fe192d8828e64c535fadf7bf9dd0bc1d2091eedf624
 ignore_elf_dirs="/usr/share/qemu"
 nostrip_files="hppa-firmware.img openbios-ppc openbios-sparc32 openbios-sparc64
  palcode-clipper s390-ccw.img s390-netboot.img u-boot.e500 opensbi-riscv32-generic-fw_dynamic.elf
  opensbi-riscv64-generic-fw_dynamic.elf"
 
-build_options="gtk3 opengl sdl2 spice virgl smartcard numa iscsi jack pulseaudio"
-build_options_default="opengl gtk3 virgl sdl2 numa iscsi jack pulseaudio"
+build_options="gtk3 iscsi jack numa opengl pulseaudio sdl2 smartcard spice virgl"
+build_options_default="gtk3 iscsi jack numa opengl pulseaudio sdl2 smartcard spice virgl"
 desc_option_sdl2="Enable SDL (2.x) video output"
 desc_option_spice="Enable support for SPICE"
 desc_option_virgl="Enable support for VirGL (A Virtual 3D GPU renderer)"
@@ -43,37 +44,10 @@ desc_option_smartcard="Enable smartcard support"
 desc_option_numa="Enable support for host NUMA"
 desc_option_iscsi="Enable support for iSCSI"
 
-case "$XBPS_TARGET_MACHINE" in
-	aarch64-musl) CFLAGS="-D_LINUX_SYSINFO_H";;
-esac
-
-if [ "$XBPS_TARGET_ENDIAN" = "le" ]; then
-	build_options_default+=" spice"
-fi
-
 if [ "$CROSS_BUILD" ]; then
 	configure_args+=" --cross-prefix=${XBPS_CROSS_TRIPLET}-"
-else
-	build_options_default+=" smartcard"
-fi
-
-if [ "$XBPS_CHECK_PKGS" != full ]; then
-	make_check_target=check-unit
 fi
 
-post_extract() {
-	if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
-		grep -rl 'Input/output error' tests/qemu-iotests |
-			xargs -n1 sed -i -e 's;Input/output error;I/O error;g'
-		grep -rl 'Operation not supported' tests/qemu-iotests |
-			xargs -n1 sed -i -e 's;Operation not supported;Not supported;g'
-	fi
-}
-
-pre_configure() {
-	unset CPP
-}
-
 post_install() {
 	vdoc "${FILESDIR}/README.voidlinux"
 

From 3aea880998ee168e880f41f5d131ed7244f891bc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Cerqueira?= <acerqueira021@gmail.com>
Date: Fri, 1 Sep 2023 18:31:29 +0100
Subject: [PATCH 2/2] qemu-user-static: update to 8.1.0.

---
 srcpkgs/qemu-user-static/template | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/srcpkgs/qemu-user-static/template b/srcpkgs/qemu-user-static/template
index 2a8da9b53f2d5..48aa0ee129c29 100644
--- a/srcpkgs/qemu-user-static/template
+++ b/srcpkgs/qemu-user-static/template
@@ -1,20 +1,20 @@
 # Template file for 'qemu-user-static'
 # This package should be updated together with qemu
 pkgname=qemu-user-static
-version=7.1.0
-revision=3
+version=8.1.0
+revision=1
 build_style=configure
 configure_args="--prefix=/usr --sysconfdir=/etc --libexecdir=/usr/libexec
  --disable-kvm --disable-png --disable-virtfs --disable-fdt --disable-seccomp
  --enable-linux-user --disable-system --static --disable-pie"
-hostmakedepends="pkg-config perl python3 ninja"
-makedepends="dtc-devel libglib-devel pixman-devel libuuid-devel"
+hostmakedepends="flex glib-devel pkg-config perl python3 ninja"
+makedepends="dtc-devel pixman-devel libuuid-devel"
 short_desc="QEMU User-mode emulators (statically compiled)"
 maintainer="Orphaned <orphan@voidlinux.org>"
-license="GPL-2.0-or-later, LGPL-2.1-or-later"
+license="GPL-2.0-only, LGPL-2.1-only"
 homepage="https://www.qemu.org"
 distfiles="https://wiki.qemu.org/download/qemu-${version}.tar.bz2"
-checksum=f7ac2b85b3f1831e6810b140306e30af91556e15784864b209f3942858947fd0
+checksum=53a2388f4f67d03e94ed7fe192d8828e64c535fadf7bf9dd0bc1d2091eedf624
 
 _fmts="aarch64 aarch64_be alpha arm armeb cris hppa i386 m68k microblaze
  microblazeel mips mipsel mips64 mips64el mipsn32 mipsn32el or1k
@@ -111,10 +111,6 @@ done
 
 binfmts="${binfmts%?}"
 
-pre_configure() {
-	unset CPP
-}
-
 post_install() {
 	# Remove unneeded stuff.
 	rm -rf ${DESTDIR}/etc ${DESTDIR}/usr/share ${DESTDIR}/usr/libexec

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [PR PATCH] [Updated] qemu: update to 8.1.0.
  2023-07-03 17:50 [PR PATCH] qemu: update to 8.0.2 motorto
                   ` (32 preceding siblings ...)
  2023-09-01 22:46 ` [PR PATCH] [Updated] qemu: update to 8.1.0 motorto
@ 2023-09-01 23:34 ` motorto
  2023-09-17 10:21 ` motorto
                   ` (4 subsequent siblings)
  38 siblings, 0 replies; 40+ messages in thread
From: motorto @ 2023-09-01 23:34 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1878 bytes --]

There is an updated pull request by motorto against master on the void-packages repository

https://github.com/motorto/void-packages qemu-8.0.2
https://github.com/void-linux/void-packages/pull/44822

qemu: update to 8.1.0.
<!-- Uncomment relevant sections and delete options which are not applicable -->
[ci-skip] 

Draft because of: https://github.com/void-linux/void-packages/pull/44822#issuecomment-1633611714


#### Testing the changes
- I tested the changes in this PR: **YES**, runned a Windows vm machine and it worked fine. 
**DIDN'T Test the qemu-user-static**

Removed a bunch of patches that in my research are no longer needed:

- Removed all ppc related patches since that arch isn't no longer supported.
- gcc12.patch: because it builds fine now in this version
- fix-softfloat-fesetround.patch: don't have a system to try it, but alpine doesn't have any patch related to this)
- mmap-mremap-efaul: not sure about if we should keep this one

Kept this patches:

- musl-initialize-msghdr.patch: just update in order to apply.

Added this ones:

- ~~CVE-2023-2861.patch~~
- ~~keymap.patch: xkeyboard-config 2.39 removed the legacy alias of ar -> ara~~
- ~~fix-brk0.patch: make sure that initial brk(0) is page-aligned~~
- lfs64.patch: Builds defines -D_FILE_OFFSET_BITS=64 which makes the original functions
anf macros behave same as their 64 suffixed counterparts. This also
helps in compiling with latest musl C library, where these macros and
functions are no more available under _GNU_SOURCE feature macro

#### Local build testing
- I built this PR locally for my native architecture, x86-64-glibc
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - ~~aarch64-musl (cross)~~
  - ~~x86_64-musl~~



A patch file from https://github.com/void-linux/void-packages/pull/44822.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-qemu-8.0.2-44822.patch --]
[-- Type: text/x-diff, Size: 33943 bytes --]

From 92ef5107eae64038e80064e195dd82e2d9cd278a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Cerqueira?= <acerqueira021@gmail.com>
Date: Fri, 1 Sep 2023 15:34:18 +0100
Subject: [PATCH 1/2] qemu: update to 8.1.0.

---
 .../qemu/patches/fix-linux-user-ppc32.patch   | 117 ----------
 .../patches/fix-softfloat-fesetround.patch    |  39 ----
 srcpkgs/qemu/patches/gcc12.patch              |  72 ------
 srcpkgs/qemu/patches/lfs64.patch              | 212 ++++++++++++++++++
 srcpkgs/qemu/patches/mmap-mremap-efault.patch |  42 ----
 .../qemu/patches/musl-initialize-msghdr.patch |   7 +-
 srcpkgs/qemu/patches/musl-ppc.patch           |  25 ---
 srcpkgs/qemu/patches/musl-rlimit-rttime.patch |  13 --
 srcpkgs/qemu/patches/xxx-ppcle.patch          | 113 ----------
 srcpkgs/qemu/template                         |  41 +---
 10 files changed, 223 insertions(+), 458 deletions(-)
 delete mode 100644 srcpkgs/qemu/patches/fix-linux-user-ppc32.patch
 delete mode 100644 srcpkgs/qemu/patches/fix-softfloat-fesetround.patch
 delete mode 100644 srcpkgs/qemu/patches/gcc12.patch
 create mode 100644 srcpkgs/qemu/patches/lfs64.patch
 delete mode 100644 srcpkgs/qemu/patches/mmap-mremap-efault.patch
 delete mode 100644 srcpkgs/qemu/patches/musl-ppc.patch
 delete mode 100644 srcpkgs/qemu/patches/musl-rlimit-rttime.patch
 delete mode 100644 srcpkgs/qemu/patches/xxx-ppcle.patch

diff --git a/srcpkgs/qemu/patches/fix-linux-user-ppc32.patch b/srcpkgs/qemu/patches/fix-linux-user-ppc32.patch
deleted file mode 100644
index cd47435d5aa9a..0000000000000
--- a/srcpkgs/qemu/patches/fix-linux-user-ppc32.patch
+++ /dev/null
@@ -1,117 +0,0 @@
-commit 37814f62c2cc7aba2eea073014d6c53dcd5bf42c
-Author: q66 <daniel@octaforge.org>
-Date:   Fri Jul 1 16:53:55 2022 +0200
-
-    fix linux-user build on 32-bit ppc
-    
-    Partial revert https://gitlab.com/qemu-project/qemu/-/commit/9d1401b79463e74adbfac69d836789d4e103fb61
-    and https://gitlab.com/qemu-project/qemu/-/commit/0a7e01904d407baa73c1baddbdfc9ccf2ace8356
-
-diff --git a/common-user/host/ppc/safe-syscall.inc.S b/common-user/host/ppc/safe-syscall.inc.S
-new file mode 100644
-index 0000000..e69de29
-diff --git a/common-user/safe-syscall-error.c b/common-user/safe-syscall-error.c
-index cf74b50..a36132c 100644
---- a/common-user/safe-syscall-error.c
-+++ b/common-user/safe-syscall-error.c
-@@ -12,6 +12,7 @@
- #include "qemu/osdep.h"
- #include "user/safe-syscall.h"
- 
-+#if !defined(__powerpc__) || defined(__powerpc64__)
- /*
-  * This is intended to be invoked via tail-call on the error path
-  * from the assembly in host/arch/safe-syscall.inc.S.  This takes
-@@ -23,3 +24,4 @@ long safe_syscall_set_errno_tail(int value)
-     errno = value;
-     return -1;
- }
-+#endif
-diff --git a/include/user/safe-syscall.h b/include/user/safe-syscall.h
-index 61a04e2..793fe84 100644
---- a/include/user/safe-syscall.h
-+++ b/include/user/safe-syscall.h
-@@ -125,6 +125,8 @@
-  * kinds of restartability.
-  */
- 
-+#if !defined(__powerpc__) || defined(__powerpc64__)
-+
- /* The core part of this function is implemented in assembly */
- extern long safe_syscall_base(int *pending, long number, ...);
- extern long safe_syscall_set_errno_tail(int value);
-@@ -137,4 +139,10 @@ extern char safe_syscall_end[];
-     safe_syscall_base(&((TaskState *)thread_cpu->opaque)->signal_pending, \
-                       __VA_ARGS__)
- 
-+#else
-+
-+#define safe_syscall syscall
-+
-+#endif
-+
- #endif
-diff --git a/linux-user/include/host/ppc/host-signal.h b/linux-user/include/host/ppc/host-signal.h
-new file mode 100644
-index 0000000..b80384d
---- /dev/null
-+++ b/linux-user/include/host/ppc/host-signal.h
-@@ -0,0 +1,38 @@
-+/*
-+ * host-signal.h: signal info dependent on the host architecture
-+ *
-+ * Copyright (c) 2003-2005 Fabrice Bellard
-+ * Copyright (c) 2021 Linaro Limited
-+ *
-+ * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
-+ * See the COPYING file in the top-level directory.
-+ */
-+
-+#ifndef PPC_HOST_SIGNAL_H
-+#define PPC_HOST_SIGNAL_H
-+
-+/* The third argument to a SA_SIGINFO handler is ucontext_t. */
-+typedef ucontext_t host_sigcontext;
-+
-+static inline uintptr_t host_signal_pc(host_sigcontext *uc)
-+{
-+    return uc->uc_mcontext.regs->nip;
-+}
-+
-+static inline void host_signal_set_pc(host_sigcontext *uc, uintptr_t pc)
-+{
-+    uc->uc_mcontext.regs->nip = pc;
-+}
-+
-+static inline void *host_signal_mask(host_sigcontext *uc)
-+{
-+    return &uc->uc_sigmask;
-+}
-+
-+static inline bool host_signal_write(siginfo_t *info, host_sigcontext *uc)
-+{
-+    return uc->uc_mcontext.regs->trap != 0x400
-+        && (uc->uc_mcontext.regs->dsisr & 0x02000000);
-+}
-+
-+#endif
-diff --git a/linux-user/signal.c b/linux-user/signal.c
-index 092e70b..b8dfa8a 100644
---- a/linux-user/signal.c
-+++ b/linux-user/signal.c
-@@ -800,6 +800,7 @@ void queue_signal(CPUArchState *env, int sig, int si_type,
- /* Adjust the signal context to rewind out of safe-syscall if we're in it */
- static inline void rewind_if_in_safe_syscall(void *puc)
- {
-+#if !defined(__powerpc__) || defined(__powerpc64__)
-     host_sigcontext *uc = (host_sigcontext *)puc;
-     uintptr_t pcreg = host_signal_pc(uc);
- 
-@@ -807,6 +808,7 @@ static inline void rewind_if_in_safe_syscall(void *puc)
-         && pcreg < (uintptr_t)safe_syscall_end) {
-         host_signal_set_pc(uc, (uintptr_t)safe_syscall_start);
-     }
-+#endif
- }
- 
- static void host_signal_handler(int host_sig, siginfo_t *info, void *puc)
diff --git a/srcpkgs/qemu/patches/fix-softfloat-fesetround.patch b/srcpkgs/qemu/patches/fix-softfloat-fesetround.patch
deleted file mode 100644
index ecdd049f79212..0000000000000
--- a/srcpkgs/qemu/patches/fix-softfloat-fesetround.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-Source: @pullmoll
-Upstream: no
-Reason: Target architectures with soft float do not define these constants.
-
---- a/tests/fp/fp-bench.c	2020-12-08 17:59:44.000000000 +0100
-+++ b/tests/fp/fp-bench.c	2020-12-12 20:38:40.702235420 +0100
-@@ -485,16 +485,32 @@
- 
-     switch (rounding) {
-     case ROUND_EVEN:
-+#if defined(FE_TONEAREST)
-         rhost = FE_TONEAREST;
-+#else
-+	return;
-+#endif
-         break;
-     case ROUND_ZERO:
-+#if defined(FE_TOWARDZERO)
-         rhost = FE_TOWARDZERO;
-+#else
-+	return;
-+#endif
-         break;
-     case ROUND_DOWN:
-+#if defined(FE_DOWNWARD)
-         rhost = FE_DOWNWARD;
-+#else
-+	return;
-+#endif
-         break;
-     case ROUND_UP:
-+#if defined(FE_UPWARD)
-         rhost = FE_UPWARD;
-+#else
-+	return;
-+#endif
-         break;
-     case ROUND_TIEAWAY:
-         die_host_rounding(rounding);
diff --git a/srcpkgs/qemu/patches/gcc12.patch b/srcpkgs/qemu/patches/gcc12.patch
deleted file mode 100644
index 2a4b2bd036096..0000000000000
--- a/srcpkgs/qemu/patches/gcc12.patch
+++ /dev/null
@@ -1,72 +0,0 @@
-From 5cb993ff131fca2abef3ce074a20258fd6fce557 Mon Sep 17 00:00:00 2001
-From: Bernhard Beschow <shentey@gmail.com>
-Date: Sat, 18 Mar 2023 19:59:31 +0100
-Subject: [PATCH] qemu/osdep: Switch position of "extern" and "G_NORETURN"
-
-Fixes the Windows build under msys2 using GCC 12 which fails with the following
-error:
-
-  [184/579] Compiling C++ object qga/vss-win32/qga-vss.dll.p/install.cpp.obj
-  FAILED: qga/vss-win32/qga-vss.dll.p/install.cpp.obj
-  "c++" "-m64" "-mcx16" "-Iqga/vss-win32/qga-vss.dll.p" "-Iqga/vss-win32" "-I../src/qga/vss-win32" "-I." "-Iqapi" "-Itrace" "-Iui" "-Iui/shader" "-IC:/msys64/mingw64/include/glib-2.0" "-IC:/msys64/mingw64/lib/glib-2.0/include" "-fdiagnostics-color=auto" "-Wall" "-Winvalid-pch" "-Wnon-virtual-dtor" "-Werror" "-std=gnu++11" "-g" "-iquote" "." "-iquote" "C:/msys64/home/shentey/Projects/qemu/src" "-iquote" "C:/msys64/home/shentey/Projects/qemu/src/include" "-iquote" "C:/msys64/home/shentey/Projects/qemu/src/tcg/i386" "-D__STDC_LIMIT_MACROS" "-D__STDC_CONSTANT_MACROS" "-D__STDC_FORMAT_MACROS" "-fno-pie" "-no-pie" "-D_GNU_SOURCE" "-D_FILE_OFFSET_BITS=64" "-D_LARGEFILE_SOURCE" "-fno-strict-aliasing" "-fno-common" "-fwrapv" "-Wundef" "-Wwrite-strings" "-Wtype-limits" "-Wformat-security" "-Wformat-y2k" "-Winit-self" "-Wignored-qualifiers" "-Wempty-body" "-Wendif-labels" "-Wexpansion-to-defined" "-Wimplicit-fallthrough=2" "-Wmissing-format-attribute" "-Wno-missing-include-dirs" "-Wno-shift-negative-value" "-Wno-psabi" "-fstack-protector-strong" "-Wno-unknown-pragmas" "-Wno-delete-non-virtual-dtor" "-Wno-non-virtual-dtor" -MD -MQ qga/vss-win32/qga-vss.dll.p/install.cpp.obj -MF "qga/vss-win32/qga-vss.dll.p/install.cpp.obj.d" -o qga/vss-win32/qga-vss.dll.p/install.cpp.obj "-c" ../src/qga/vss-win32/install.cpp
-  In file included from C:/msys64/mingw64/lib/glib-2.0/include/glibconfig.h:9,
-              from C:/msys64/mingw64/include/glib-2.0/glib/gtypes.h:34,
-              from C:/msys64/mingw64/include/glib-2.0/glib/galloca.h:34,
-              from C:/msys64/mingw64/include/glib-2.0/glib.h:32,
-              from C:/msys64/home/shentey/Projects/qemu/src/include/glib-compat.h:32,
-              from C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:144,
-              from ../src/qga/vss-win32/install.cpp:13:
-  C:/msys64/mingw64/include/glib-2.0/glib/gmacros.h:1075:21: error: standard attributes in middle of decl-specifiers
-  1075 | # define G_NORETURN [[noreturn]]
-        |                     ^
-  C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:240:8: note: in expansion of macro 'G_NORETURN'
-  240 | extern G_NORETURN
-        |        ^~~~~~~~~~
-  C:/msys64/mingw64/include/glib-2.0/glib/gmacros.h:1075:21: note: standard attributes must precede the decl-specifiers to apply to the declaration, or follow them to apply to the type
-  1075 | # define G_NORETURN [[noreturn]]
-        |                     ^
-  C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:240:8: note: in expansion of macro 'G_NORETURN'
-  240 | extern G_NORETURN
-        |        ^~~~~~~~~~
-  C:/msys64/mingw64/include/glib-2.0/glib/gmacros.h:1075:21: error: attribute ignored [-Werror=attributes]
-  1075 | # define G_NORETURN [[noreturn]]
-        |                     ^
-  C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:240:8: note: in expansion of macro 'G_NORETURN'
-  240 | extern G_NORETURN
-        |        ^~~~~~~~~~
-  C:/msys64/mingw64/include/glib-2.0/glib/gmacros.h:1075:21: note: an attribute that appertains to a type-specifier is ignored
-  1075 | # define G_NORETURN [[noreturn]]
-        |                     ^
-  C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:240:8: note: in expansion of macro 'G_NORETURN'
-  240 | extern G_NORETURN
-        |        ^~~~~~~~~~
-  cc1plus.exe: all warnings being treated as errors
-
-Apparently it also fixes the compilation with Clang 15 (see
-https://gitlab.com/qemu-project/qemu/-/issues/1541 ).
-
-Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1541
-Signed-off-by: Bernhard Beschow <shentey@gmail.com>
-Message-Id: <20230318185931.181659-1-shentey@gmail.com>
-Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
-Signed-off-by: Thomas Huth <thuth@redhat.com>
----
- include/qemu/osdep.h | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
-index f68b5d8708c..9eff0be95bd 100644
---- a/include/qemu/osdep.h
-+++ b/include/qemu/osdep.h
-@@ -237,7 +237,7 @@ extern "C" {
-  * supports QEMU_ERROR, this will be reported at compile time; otherwise
-  * this will be reported at link time due to the missing symbol.
-  */
--extern G_NORETURN
-+G_NORETURN extern
- void QEMU_ERROR("code path is reachable")
-     qemu_build_not_reached_always(void);
- #if defined(__OPTIMIZE__) && !defined(__NO_INLINE__)
--- 
-GitLab
-
diff --git a/srcpkgs/qemu/patches/lfs64.patch b/srcpkgs/qemu/patches/lfs64.patch
new file mode 100644
index 0000000000000..095ab3dceadca
--- /dev/null
+++ b/srcpkgs/qemu/patches/lfs64.patch
@@ -0,0 +1,212 @@
+Builds defines -D_FILE_OFFSET_BITS=64 which makes the original functions
+anf macros behave same as their 64 suffixed counterparts. This also
+helps in compiling with latest musl C library, where these macros and
+functions are no more available under _GNU_SOURCE feature macro
+
+source: https://git.alpinelinux.org/aports/plain/community/qemu/lfs64.patch
+--
+
+diff --git a/linux-user/syscall.c b/linux-user/syscall.c
+index bbba2a6..38fa09a 100644
+--- a/linux-user/syscall.c
++++ b/linux-user/syscall.c
+@@ -6812,13 +6812,13 @@ static int target_to_host_fcntl_cmd(int cmd)
+         ret = cmd;
+         break;
+     case TARGET_F_GETLK:
+-        ret = F_GETLK64;
++        ret = F_GETLK;
+         break;
+     case TARGET_F_SETLK:
+-        ret = F_SETLK64;
++        ret = F_SETLK;
+         break;
+     case TARGET_F_SETLKW:
+-        ret = F_SETLKW64;
++        ret = F_SETLKW;
+         break;
+     case TARGET_F_GETOWN:
+         ret = F_GETOWN;
+@@ -6834,13 +6834,13 @@ static int target_to_host_fcntl_cmd(int cmd)
+         break;
+ #if TARGET_ABI_BITS == 32
+     case TARGET_F_GETLK64:
+-        ret = F_GETLK64;
++        ret = F_GETLK;
+         break;
+     case TARGET_F_SETLK64:
+-        ret = F_SETLK64;
++        ret = F_SETLK;
+         break;
+     case TARGET_F_SETLKW64:
+-        ret = F_SETLKW64;
++        ret = F_SETLKW;
+         break;
+ #endif
+     case TARGET_F_SETLEASE:
+@@ -6894,8 +6894,8 @@ static int target_to_host_fcntl_cmd(int cmd)
+      * them to 5, 6 and 7 before making the syscall(). Since we make the
+      * syscall directly, adjust to what is supported by the kernel.
+      */
+-    if (ret >= F_GETLK64 && ret <= F_SETLKW64) {
+-        ret -= F_GETLK64 - 5;
++    if (ret >= F_GETLK && ret <= F_SETLKW) {
++        ret -= F_GETLK - 5;
+     }
+ #endif
+ 
+@@ -6928,7 +6928,7 @@ static int host_to_target_flock(int type)
+     return type;
+ }
+ 
+-static inline abi_long copy_from_user_flock(struct flock64 *fl,
++static inline abi_long copy_from_user_flock(struct flock *fl,
+                                             abi_ulong target_flock_addr)
+ {
+     struct target_flock *target_fl;
+@@ -6953,7 +6953,7 @@ static inline abi_long copy_from_user_flock(struct flock64 *fl,
+ }
+ 
+ static inline abi_long copy_to_user_flock(abi_ulong target_flock_addr,
+-                                          const struct flock64 *fl)
++                                          const struct flock *fl)
+ {
+     struct target_flock *target_fl;
+     short l_type;
+@@ -6972,8 +6972,8 @@ static inline abi_long copy_to_user_flock(abi_ulong target_flock_addr,
+     return 0;
+ }
+ 
+-typedef abi_long from_flock64_fn(struct flock64 *fl, abi_ulong target_addr);
+-typedef abi_long to_flock64_fn(abi_ulong target_addr, const struct flock64 *fl);
++typedef abi_long from_flock64_fn(struct flock *fl, abi_ulong target_addr);
++typedef abi_long to_flock64_fn(abi_ulong target_addr, const struct flock *fl);
+ 
+ #if defined(TARGET_ARM) && TARGET_ABI_BITS == 32
+ struct target_oabi_flock64 {
+@@ -6984,7 +6984,7 @@ struct target_oabi_flock64 {
+     abi_int   l_pid;
+ } QEMU_PACKED;
+ 
+-static inline abi_long copy_from_user_oabi_flock64(struct flock64 *fl,
++static inline abi_long copy_from_user_oabi_flock64(struct flock *fl,
+                                                    abi_ulong target_flock_addr)
+ {
+     struct target_oabi_flock64 *target_fl;
+@@ -7009,7 +7009,7 @@ static inline abi_long copy_from_user_oabi_flock64(struct flock64 *fl,
+ }
+ 
+ static inline abi_long copy_to_user_oabi_flock64(abi_ulong target_flock_addr,
+-                                                 const struct flock64 *fl)
++                                                 const struct flock *fl)
+ {
+     struct target_oabi_flock64 *target_fl;
+     short l_type;
+@@ -7029,7 +7029,7 @@ static inline abi_long copy_to_user_oabi_flock64(abi_ulong target_flock_addr,
+ }
+ #endif
+ 
+-static inline abi_long copy_from_user_flock64(struct flock64 *fl,
++static inline abi_long copy_from_user_flock64(struct flock *fl,
+                                               abi_ulong target_flock_addr)
+ {
+     struct target_flock64 *target_fl;
+@@ -7054,7 +7054,7 @@ static inline abi_long copy_from_user_flock64(struct flock64 *fl,
+ }
+ 
+ static inline abi_long copy_to_user_flock64(abi_ulong target_flock_addr,
+-                                            const struct flock64 *fl)
++                                            const struct flock *fl)
+ {
+     struct target_flock64 *target_fl;
+     short l_type;
+@@ -7075,7 +7075,7 @@ static inline abi_long copy_to_user_flock64(abi_ulong target_flock_addr,
+ 
+ static abi_long do_fcntl(int fd, int cmd, abi_ulong arg)
+ {
+-    struct flock64 fl64;
++    struct flock fl64;
+ #ifdef F_GETOWN_EX
+     struct f_owner_ex fox;
+     struct target_f_owner_ex *target_fox;
+@@ -7347,7 +7347,7 @@ static inline abi_long target_truncate64(CPUArchState *cpu_env, const char *arg1
+         arg2 = arg3;
+         arg3 = arg4;
+     }
+-    return get_errno(truncate64(arg1, target_offset64(arg2, arg3)));
++    return get_errno(truncate(arg1, target_offset64(arg2, arg3)));
+ }
+ #endif
+ 
+@@ -7361,7 +7361,7 @@ static inline abi_long target_ftruncate64(CPUArchState *cpu_env, abi_long arg1,
+         arg2 = arg3;
+         arg3 = arg4;
+     }
+-    return get_errno(ftruncate64(arg1, target_offset64(arg2, arg3)));
++    return get_errno(ftruncate(arg1, target_offset64(arg2, arg3)));
+ }
+ #endif
+ 
+@@ -8597,7 +8597,7 @@ static int do_getdents(abi_long dirfd, abi_long arg2, abi_long count)
+     void *tdirp;
+     int hlen, hoff, toff;
+     int hreclen, treclen;
+-    off64_t prev_diroff = 0;
++    off_t prev_diroff = 0;
+ 
+     hdirp = g_try_malloc(count);
+     if (!hdirp) {
+@@ -8650,7 +8650,7 @@ static int do_getdents(abi_long dirfd, abi_long arg2, abi_long count)
+              * Return what we have, resetting the file pointer to the
+              * location of the first record not returned.
+              */
+-            lseek64(dirfd, prev_diroff, SEEK_SET);
++            lseek(dirfd, prev_diroff, SEEK_SET);
+             break;
+         }
+ 
+@@ -8684,7 +8684,7 @@ static int do_getdents64(abi_long dirfd, abi_long arg2, abi_long count)
+     void *tdirp;
+     int hlen, hoff, toff;
+     int hreclen, treclen;
+-    off64_t prev_diroff = 0;
++    off_t prev_diroff = 0;
+ 
+     hdirp = g_try_malloc(count);
+     if (!hdirp) {
+@@ -8726,7 +8726,7 @@ static int do_getdents64(abi_long dirfd, abi_long arg2, abi_long count)
+              * Return what we have, resetting the file pointer to the
+              * location of the first record not returned.
+              */
+-            lseek64(dirfd, prev_diroff, SEEK_SET);
++            lseek(dirfd, prev_diroff, SEEK_SET);
+             break;
+         }
+ 
+@@ -11157,7 +11157,7 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,
+                 return -TARGET_EFAULT;
+             }
+         }
+-        ret = get_errno(pread64(arg1, p, arg3, target_offset64(arg4, arg5)));
++        ret = get_errno(pread(arg1, p, arg3, target_offset64(arg4, arg5)));
+         unlock_user(p, arg2, ret);
+         return ret;
+     case TARGET_NR_pwrite64:
+@@ -11174,7 +11174,7 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,
+                 return -TARGET_EFAULT;
+             }
+         }
+-        ret = get_errno(pwrite64(arg1, p, arg3, target_offset64(arg4, arg5)));
++        ret = get_errno(pwrite(arg1, p, arg3, target_offset64(arg4, arg5)));
+         unlock_user(p, arg2, 0);
+         return ret;
+ #endif
+@@ -12034,7 +12034,7 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,
+     case TARGET_NR_fcntl64:
+     {
+         int cmd;
+-        struct flock64 fl;
++        struct flock fl;
+         from_flock64_fn *copyfrom = copy_from_user_flock64;
+         to_flock64_fn *copyto = copy_to_user_flock64;
+ 
diff --git a/srcpkgs/qemu/patches/mmap-mremap-efault.patch b/srcpkgs/qemu/patches/mmap-mremap-efault.patch
deleted file mode 100644
index 5a70e9658b300..0000000000000
--- a/srcpkgs/qemu/patches/mmap-mremap-efault.patch
+++ /dev/null
@@ -1,42 +0,0 @@
-Source: @pullmoll
-Upstream: no
-Reason: errno=EFAULT when the address passed to mremap(2) is not valid
-
-See Rich Felker's comment at https://www.openwall.com/lists/musl/2017/06/21/2 for
-why we need to return errno as described in man mremap(2) from qemu-user-static.
-Also speed up the loop when checking for increasing the mappings size to go
-in steps of TARGET_PAGE_SIZE and OR-in a check for the very last byte of the range.
-diff --git linux-user/mmap.c linux-user/mmap.c
-index 7e3b245..1e8d0f1 100644
---- a/linux-user/mmap.c
-+++ b/linux-user/mmap.c
-@@ -738,7 +738,7 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size,
-          !guest_range_valid_untagged(new_addr, new_size)) ||
-         ((flags & MREMAP_MAYMOVE) == 0 &&
-          !guest_range_valid_untagged(old_addr, new_size))) {
--        errno = ENOMEM;
-+        errno = EFAULT;
-         return -1;
-     }
- 
-@@ -775,9 +775,10 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size,
-             abi_ulong addr;
-             for (addr = old_addr + old_size;
-                  addr < old_addr + new_size;
--                 addr++) {
-+                 addr += TARGET_PAGE_SIZE) {
-                 prot |= page_get_flags(addr);
-             }
-+				prot |= page_get_flags(old_addr + new_size - 1);
-         }
-         if (prot == 0) {
-             host_addr = mremap(g2h_untagged(old_addr),
-@@ -796,7 +797,7 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size,
-                 }
-             }
-         } else {
--            errno = ENOMEM;
-+            errno = EFAULT;
-             host_addr = MAP_FAILED;
-         }
-     }
diff --git a/srcpkgs/qemu/patches/musl-initialize-msghdr.patch b/srcpkgs/qemu/patches/musl-initialize-msghdr.patch
index 6d96b3511dafe..2c5cf4552ecfb 100644
--- a/srcpkgs/qemu/patches/musl-initialize-msghdr.patch
+++ b/srcpkgs/qemu/patches/musl-initialize-msghdr.patch
@@ -1,10 +1,10 @@
 Source: https://github.com/void-linux/void-packages/issues/23557
 
-diff --git linux-user/syscall.c linux-user/syscall.c
-index 945fc25..8d8b68a 100644
+diff --git a/linux-user/syscall.c b/linux-user/syscall.c
+index 14fdebd..de280af 100644
 --- a/linux-user/syscall.c
 +++ b/linux-user/syscall.c
-@@ -3071,7 +3071,7 @@ static abi_long do_sendrecvmsg_locked(int fd, struct target_msghdr *msgp,
+@@ -3229,7 +3229,7 @@ static abi_long do_sendrecvmsg_locked(int fd, struct target_msghdr *msgp,
                                        int flags, int send)
  {
      abi_long ret, len;
@@ -13,3 +13,4 @@ index 945fc25..8d8b68a 100644
      abi_ulong count;
      struct iovec *vec;
      abi_ulong target_vec;
+
diff --git a/srcpkgs/qemu/patches/musl-ppc.patch b/srcpkgs/qemu/patches/musl-ppc.patch
deleted file mode 100644
index 0b77aa8fc63d4..0000000000000
--- a/srcpkgs/qemu/patches/musl-ppc.patch
+++ /dev/null
@@ -1,25 +0,0 @@
---- a/linux-user/signal.c
-+++ b/linux-user/signal.c
-@@ -21,5 +21,9 @@
- #include "exec/gdbstub.h"
- #include "hw/core/tcg-cpu-ops.h"
- 
-+#if defined(_ARCH_PPC64) && !defined(__GLIBC__) /* musl */
-+#include <asm/ptrace.h>
-+#endif
-+
- #include <sys/ucontext.h>
- #include <sys/resource.h>
---- a/util/mmap-alloc.c
-+++ b/util/mmap-alloc.c
-@@ -25,6 +25,10 @@
- 
- #ifdef CONFIG_LINUX
- #include <sys/vfs.h>
-+/* musl undefs this on ppc and mips */
-+#ifndef MAP_SYNC
-+#define MAP_SYNC 0x80000
-+#endif
- #endif
- 
- size_t qemu_fd_getpagesize(int fd)
diff --git a/srcpkgs/qemu/patches/musl-rlimit-rttime.patch b/srcpkgs/qemu/patches/musl-rlimit-rttime.patch
deleted file mode 100644
index 0cbf9be36a8f1..0000000000000
--- a/srcpkgs/qemu/patches/musl-rlimit-rttime.patch
+++ /dev/null
@@ -1,13 +0,0 @@
---- a/linux-user/syscall.c
-+++ b/linux-user/syscall.c
-@@ -141,6 +141,10 @@
- #include "fd-trans.h"
- #include "tcg/tcg.h"
- 
-+#ifndef RLIMIT_RTTIME
-+#define RLIMIT_RTTIME 15
-+#endif
-+
- #ifndef CLONE_IO
- #define CLONE_IO                0x80000000      /* Clone io context */
- #endif
diff --git a/srcpkgs/qemu/patches/xxx-ppcle.patch b/srcpkgs/qemu/patches/xxx-ppcle.patch
deleted file mode 100644
index 90b32b5e07cd8..0000000000000
--- a/srcpkgs/qemu/patches/xxx-ppcle.patch
+++ /dev/null
@@ -1,113 +0,0 @@
-From 7ece08d7902d5a8c007deeb0b75cb533a41dd882 Mon Sep 17 00:00:00 2001
-From: Daniel Kolesa <daniel@octaforge.org>
-Date: Sun, 7 Mar 2021 01:47:42 +0100
-Subject: [PATCH] support ppcle architecture
-
----
- configure                            | 14 ++++++++++++--
- configs/targets/ppcle-linux-user.mak |  4 ++++
- linux-user/ppc/target_syscall.h      |  4 ++++
- scripts/qemu-binfmt-conf.sh          |  6 +++++-
- tests/tcg/configure.sh               |  2 ++
- 5 files changed, 27 insertions(+), 3 deletions(-)
- create mode 100644 configs/targets/ppcle-linux-user.mak
-
-diff --git a/configure b/configure
-index 18c26e0..03d3e18 100755
---- a/configure
-+++ b/configure
-@@ -653,7 +653,11 @@ elif check_define _ARCH_PPC ; then
-       cpu="ppc64"
-     fi
-   else
--    cpu="ppc"
-+    if check_define _LITTLE_ENDIAN ; then
-+      cpu="ppcle"
-+    else
-+      cpu="ppc"
-+    fi
-   fi
- elif check_define __mips__ ; then
-   cpu="mips"
-@@ -638,6 +642,9 @@
- 
-   ppc)
-     CPU_CFLAGS="-m32" ;;
-+  ppcle)
-+    cpu="ppc"
-+    CPU_CFLAGS="-m32 -mlittle-endian" ;;
-   ppc64)
-     CPU_CFLAGS="-m64 -mbig-endian" ;;
-   ppc64le)
-diff --git a/configs/targets/ppcle-linux-user.mak b/configs/targets/ppcle-linux-user.mak
-new file mode 100644
-index 0000000..2259243
---- /dev/null
-+++ b/configs/targets/ppcle-linux-user.mak
-@@ -0,0 +1,4 @@
-+TARGET_ARCH=ppc
-+TARGET_SYSTBL_ABI=common,nospu,32
-+TARGET_SYSTBL=syscall.tbl
-+TARGET_XML_FILES= gdb-xml/power-core.xml gdb-xml/power-fpu.xml gdb-xml/power-altivec.xml gdb-xml/power-spe.xml
-diff --git a/linux-user/ppc/target_syscall.h b/linux-user/ppc/target_syscall.h
-index b9c4b81..cf26497 100644
---- a/linux-user/ppc/target_syscall.h
-+++ b/linux-user/ppc/target_syscall.h
-@@ -65,7 +65,11 @@ struct target_revectored_struct {
- #define UNAME_MACHINE "ppc64le"
- #endif
- #else
-+#if TARGET_BIG_ENDIAN
- #define UNAME_MACHINE "ppc"
-+#else
-+#define UNAME_MACHINE "ppcle"
-+#endif
- #endif
- #define UNAME_MINIMUM_RELEASE "2.6.32"
- 
-diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh
-index 9f1580a..393943f 100755
---- a/scripts/qemu-binfmt-conf.sh
-+++ b/scripts/qemu-binfmt-conf.sh
-@@ -46,6 +46,10 @@ ppc_magic='\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x
- ppc_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
- ppc_family=ppc
- 
-+ppcle_magic='\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x14\x00'
-+ppcle_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\x00'
-+ppc_family=ppcle
-+
- ppc64_magic='\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x15'
- ppc64_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
- ppc64_family=ppc
-@@ -148,7 +152,7 @@ qemu_get_family() {
-     "Power Macintosh"|ppc64|powerpc|ppc)
-         echo "ppc"
-         ;;
--    ppc64el|ppc64le)
-+    ppc64el|ppc64le|ppcel|ppcle)
-         echo "ppcle"
-         ;;
-     arm|armel|armhf|arm64|armv[4-9]*l|aarch64)
-diff --git a/configure b/configure
-index 72ab03f11a..0691929d76 100755
---- a/configure
-+++ b/configure
-@@ -1866,6 +1866,7 @@ fi
- : ${cross_prefix_mips="mips-linux-gnu-"}
- : ${cross_prefix_nios2="nios2-linux-gnu-"}
- : ${cross_prefix_ppc="powerpc-linux-gnu-"}
-+: ${cross_prefix_ppcle="powerpcle-linux-gnu-"}
- : ${cross_prefix_ppc64="powerpc64-linux-gnu-"}
- : ${cross_prefix_ppc64le="$cross_prefix_ppc64"}
- : ${cross_prefix_riscv64="riscv64-linux-gnu-"}
-@@ -1883,6 +1884,7 @@ fi
- : ${cross_cc_cflags_hexagon="-mv67 -O2 -static"}
- : ${cross_cc_cflags_i386="-m32"}
- : ${cross_cc_cflags_ppc="-m32 -mbig-endian"}
-+: ${cross_cc_cflags_ppcle="-m32"}
- : ${cross_cc_cflags_ppc64="-m64 -mbig-endian"}
- : ${cross_cc_ppc64le="$cross_cc_ppc64"}
- : ${cross_cc_cflags_ppc64le="-m64 -mlittle-endian"}
-2.30.1
-
diff --git a/srcpkgs/qemu/template b/srcpkgs/qemu/template
index 48ab199e5686b..ff59cdde44dce 100644
--- a/srcpkgs/qemu/template
+++ b/srcpkgs/qemu/template
@@ -1,8 +1,8 @@
 # Template file for 'qemu'
 # This package should be updated together with qemu-user-static
 pkgname=qemu
-version=7.1.0
-revision=2
+version=8.1.0
+revision=1
 build_style=configure
 configure_args="--prefix=/usr --sysconfdir=/etc --libexecdir=/usr/libexec --localstatedir=/var
  --disable-glusterfs --disable-xen --enable-docs --enable-kvm --enable-libusb --enable-pie
@@ -10,7 +10,7 @@ configure_args="--prefix=/usr --sysconfdir=/etc --libexecdir=/usr/libexec --loca
  --audio-drv-list=alsa$(vopt_if sdl2 ,sdl)$(vopt_if jack ,jack)$(vopt_if pulseaudio ,pa)
  $(vopt_enable opengl) $(vopt_enable pulseaudio pa) $(vopt_enable sdl2 sdl) $(vopt_enable smartcard)
  $(vopt_enable spice) $(vopt_enable virgl virglrenderer) $(vopt_if gtk3 '--enable-gtk')"
-hostmakedepends="gettext pkg-config perl python3 python3-Sphinx python3-sphinx_rtd_theme ninja"
+hostmakedepends="flex glib-devel gettext pkg-config perl python3 python3-Sphinx python3-sphinx_rtd_theme ninja"
 makedepends="capstone-devel dtc-devel libpng-devel libjpeg-turbo-devel pixman-devel
  snappy-devel libuuid-devel libX11-devel alsa-lib-devel libaio-devel gnutls-devel
  libsasl-devel libglib-devel ncurses-devel libseccomp-devel nss-devel
@@ -25,17 +25,17 @@ makedepends="capstone-devel dtc-devel libpng-devel libjpeg-turbo-devel pixman-de
  $(vopt_if jack 'jack-devel') $(vopt_if pulseaudio 'pulseaudio-devel')"
 short_desc="Open Source Processor Emulator"
 maintainer="Orphaned <orphan@voidlinux.org>"
-license="GPL-2.0-or-later, LGPL-2.1-or-later"
+license="GPL-2.0-only, LGPL-2.1-only"
 homepage="https://www.qemu.org"
 distfiles="https://wiki.qemu.org/download/qemu-${version}.tar.bz2"
-checksum=f7ac2b85b3f1831e6810b140306e30af91556e15784864b209f3942858947fd0
+checksum=53a2388f4f67d03e94ed7fe192d8828e64c535fadf7bf9dd0bc1d2091eedf624
 ignore_elf_dirs="/usr/share/qemu"
 nostrip_files="hppa-firmware.img openbios-ppc openbios-sparc32 openbios-sparc64
  palcode-clipper s390-ccw.img s390-netboot.img u-boot.e500 opensbi-riscv32-generic-fw_dynamic.elf
  opensbi-riscv64-generic-fw_dynamic.elf"
 
-build_options="gtk3 opengl sdl2 spice virgl smartcard numa iscsi jack pulseaudio"
-build_options_default="opengl gtk3 virgl sdl2 numa iscsi jack pulseaudio"
+build_options="gtk3 iscsi jack numa opengl pulseaudio sdl2 smartcard spice virgl"
+build_options_default="gtk3 iscsi jack numa opengl pulseaudio sdl2 smartcard spice virgl"
 desc_option_sdl2="Enable SDL (2.x) video output"
 desc_option_spice="Enable support for SPICE"
 desc_option_virgl="Enable support for VirGL (A Virtual 3D GPU renderer)"
@@ -43,37 +43,10 @@ desc_option_smartcard="Enable smartcard support"
 desc_option_numa="Enable support for host NUMA"
 desc_option_iscsi="Enable support for iSCSI"
 
-case "$XBPS_TARGET_MACHINE" in
-	aarch64-musl) CFLAGS="-D_LINUX_SYSINFO_H";;
-esac
-
-if [ "$XBPS_TARGET_ENDIAN" = "le" ]; then
-	build_options_default+=" spice"
-fi
-
 if [ "$CROSS_BUILD" ]; then
 	configure_args+=" --cross-prefix=${XBPS_CROSS_TRIPLET}-"
-else
-	build_options_default+=" smartcard"
-fi
-
-if [ "$XBPS_CHECK_PKGS" != full ]; then
-	make_check_target=check-unit
 fi
 
-post_extract() {
-	if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
-		grep -rl 'Input/output error' tests/qemu-iotests |
-			xargs -n1 sed -i -e 's;Input/output error;I/O error;g'
-		grep -rl 'Operation not supported' tests/qemu-iotests |
-			xargs -n1 sed -i -e 's;Operation not supported;Not supported;g'
-	fi
-}
-
-pre_configure() {
-	unset CPP
-}
-
 post_install() {
 	vdoc "${FILESDIR}/README.voidlinux"
 

From ffa4d5edfcfc7efe15ef140ebd116846eae750de Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Cerqueira?= <acerqueira021@gmail.com>
Date: Fri, 1 Sep 2023 18:31:29 +0100
Subject: [PATCH 2/2] qemu-user-static: update to 8.1.0.

---
 srcpkgs/qemu-user-static/template | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/srcpkgs/qemu-user-static/template b/srcpkgs/qemu-user-static/template
index 2a8da9b53f2d5..fcb343eaa1d79 100644
--- a/srcpkgs/qemu-user-static/template
+++ b/srcpkgs/qemu-user-static/template
@@ -1,20 +1,20 @@
 # Template file for 'qemu-user-static'
 # This package should be updated together with qemu
 pkgname=qemu-user-static
-version=7.1.0
-revision=3
+version=8.1.0
+revision=1
 build_style=configure
 configure_args="--prefix=/usr --sysconfdir=/etc --libexecdir=/usr/libexec
  --disable-kvm --disable-png --disable-virtfs --disable-fdt --disable-seccomp
  --enable-linux-user --disable-system --static --disable-pie"
-hostmakedepends="pkg-config perl python3 ninja"
-makedepends="dtc-devel libglib-devel pixman-devel libuuid-devel"
+hostmakedepends="flex glib-devel pkg-config perl python3 ninja"
+makedepends="dtc-devel pixman-devel libglib-devel libuuid-devel"
 short_desc="QEMU User-mode emulators (statically compiled)"
 maintainer="Orphaned <orphan@voidlinux.org>"
-license="GPL-2.0-or-later, LGPL-2.1-or-later"
+license="GPL-2.0-only, LGPL-2.1-only"
 homepage="https://www.qemu.org"
 distfiles="https://wiki.qemu.org/download/qemu-${version}.tar.bz2"
-checksum=f7ac2b85b3f1831e6810b140306e30af91556e15784864b209f3942858947fd0
+checksum=53a2388f4f67d03e94ed7fe192d8828e64c535fadf7bf9dd0bc1d2091eedf624
 
 _fmts="aarch64 aarch64_be alpha arm armeb cris hppa i386 m68k microblaze
  microblazeel mips mipsel mips64 mips64el mipsn32 mipsn32el or1k
@@ -111,10 +111,6 @@ done
 
 binfmts="${binfmts%?}"
 
-pre_configure() {
-	unset CPP
-}
-
 post_install() {
 	# Remove unneeded stuff.
 	rm -rf ${DESTDIR}/etc ${DESTDIR}/usr/share ${DESTDIR}/usr/libexec

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [PR PATCH] [Updated] qemu: update to 8.1.0.
  2023-07-03 17:50 [PR PATCH] qemu: update to 8.0.2 motorto
                   ` (33 preceding siblings ...)
  2023-09-01 23:34 ` motorto
@ 2023-09-17 10:21 ` motorto
  2023-09-17 10:30 ` motorto
                   ` (3 subsequent siblings)
  38 siblings, 0 replies; 40+ messages in thread
From: motorto @ 2023-09-17 10:21 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1870 bytes --]

There is an updated pull request by motorto against master on the void-packages repository

https://github.com/motorto/void-packages qemu-8.0.2
https://github.com/void-linux/void-packages/pull/44822

qemu: update to 8.1.0.
<!-- Uncomment relevant sections and delete options which are not applicable -->
[ci-skip] 

Draft because of: https://github.com/void-linux/void-packages/pull/44822#issuecomment-1633611714


#### Testing the changes
- I tested the changes in this PR: **YES**, runned a Windows vm machine and it worked fine. 
**DIDN'T Test the qemu-user-static**

Removed a bunch of patches that in my research are no longer needed:

- Removed all ppc related patches since that arch isn't no longer supported.
- gcc12.patch: because it builds fine now in this version
- fix-softfloat-fesetround.patch: don't have a system to try it, but alpine doesn't have any patch related to this)
- mmap-mremap-efaul: not sure about if we should keep this one

Kept this patches:

- musl-initialize-msghdr.patch: just update in order to apply.

Added this ones:

- ~~CVE-2023-2861.patch~~
- ~~keymap.patch: xkeyboard-config 2.39 removed the legacy alias of ar -> ara~~
- ~~fix-brk0.patch: make sure that initial brk(0) is page-aligned~~
- lfs64.patch: Builds defines -D_FILE_OFFSET_BITS=64 which makes the original functions
anf macros behave same as their 64 suffixed counterparts. This also
helps in compiling with latest musl C library, where these macros and
functions are no more available under _GNU_SOURCE feature macro

#### Local build testing
- I built this PR locally for my native architecture, x86-64-glibc
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl (cross)
  - x86_64-musl



A patch file from https://github.com/void-linux/void-packages/pull/44822.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-qemu-8.0.2-44822.patch --]
[-- Type: text/x-diff, Size: 36641 bytes --]

From f15894177dbb2376ac986a9cb175a941a0e932a7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Cerqueira?= <acerqueira021@gmail.com>
Date: Fri, 15 Sep 2023 23:38:32 +0100
Subject: [PATCH 1/2] qemu: update to 8.1.0.

---
 .../qemu/patches/fix-linux-user-ppc32.patch   | 117 ----------
 .../patches/fix-softfloat-fesetround.patch    |  39 ----
 srcpkgs/qemu/patches/gcc12.patch              |  72 ------
 srcpkgs/qemu/patches/lfs64.patch              | 211 ++++++++++++++++++
 srcpkgs/qemu/patches/mmap-mremap-efault.patch |  42 ----
 .../qemu/patches/musl-initialize-msghdr.patch |   6 +-
 srcpkgs/qemu/patches/musl-ppc.patch           |  25 ---
 srcpkgs/qemu/patches/musl-rlimit-rttime.patch |  13 --
 srcpkgs/qemu/patches/tricore_feature.patch    |  60 -----
 srcpkgs/qemu/patches/xxx-ppcle.patch          | 113 ----------
 srcpkgs/qemu/template                         |  41 +---
 11 files changed, 223 insertions(+), 516 deletions(-)
 delete mode 100644 srcpkgs/qemu/patches/fix-linux-user-ppc32.patch
 delete mode 100644 srcpkgs/qemu/patches/fix-softfloat-fesetround.patch
 delete mode 100644 srcpkgs/qemu/patches/gcc12.patch
 create mode 100644 srcpkgs/qemu/patches/lfs64.patch
 delete mode 100644 srcpkgs/qemu/patches/mmap-mremap-efault.patch
 delete mode 100644 srcpkgs/qemu/patches/musl-ppc.patch
 delete mode 100644 srcpkgs/qemu/patches/musl-rlimit-rttime.patch
 delete mode 100644 srcpkgs/qemu/patches/tricore_feature.patch
 delete mode 100644 srcpkgs/qemu/patches/xxx-ppcle.patch

diff --git a/srcpkgs/qemu/patches/fix-linux-user-ppc32.patch b/srcpkgs/qemu/patches/fix-linux-user-ppc32.patch
deleted file mode 100644
index cd47435d5aa9a..0000000000000
--- a/srcpkgs/qemu/patches/fix-linux-user-ppc32.patch
+++ /dev/null
@@ -1,117 +0,0 @@
-commit 37814f62c2cc7aba2eea073014d6c53dcd5bf42c
-Author: q66 <daniel@octaforge.org>
-Date:   Fri Jul 1 16:53:55 2022 +0200
-
-    fix linux-user build on 32-bit ppc
-    
-    Partial revert https://gitlab.com/qemu-project/qemu/-/commit/9d1401b79463e74adbfac69d836789d4e103fb61
-    and https://gitlab.com/qemu-project/qemu/-/commit/0a7e01904d407baa73c1baddbdfc9ccf2ace8356
-
-diff --git a/common-user/host/ppc/safe-syscall.inc.S b/common-user/host/ppc/safe-syscall.inc.S
-new file mode 100644
-index 0000000..e69de29
-diff --git a/common-user/safe-syscall-error.c b/common-user/safe-syscall-error.c
-index cf74b50..a36132c 100644
---- a/common-user/safe-syscall-error.c
-+++ b/common-user/safe-syscall-error.c
-@@ -12,6 +12,7 @@
- #include "qemu/osdep.h"
- #include "user/safe-syscall.h"
- 
-+#if !defined(__powerpc__) || defined(__powerpc64__)
- /*
-  * This is intended to be invoked via tail-call on the error path
-  * from the assembly in host/arch/safe-syscall.inc.S.  This takes
-@@ -23,3 +24,4 @@ long safe_syscall_set_errno_tail(int value)
-     errno = value;
-     return -1;
- }
-+#endif
-diff --git a/include/user/safe-syscall.h b/include/user/safe-syscall.h
-index 61a04e2..793fe84 100644
---- a/include/user/safe-syscall.h
-+++ b/include/user/safe-syscall.h
-@@ -125,6 +125,8 @@
-  * kinds of restartability.
-  */
- 
-+#if !defined(__powerpc__) || defined(__powerpc64__)
-+
- /* The core part of this function is implemented in assembly */
- extern long safe_syscall_base(int *pending, long number, ...);
- extern long safe_syscall_set_errno_tail(int value);
-@@ -137,4 +139,10 @@ extern char safe_syscall_end[];
-     safe_syscall_base(&((TaskState *)thread_cpu->opaque)->signal_pending, \
-                       __VA_ARGS__)
- 
-+#else
-+
-+#define safe_syscall syscall
-+
-+#endif
-+
- #endif
-diff --git a/linux-user/include/host/ppc/host-signal.h b/linux-user/include/host/ppc/host-signal.h
-new file mode 100644
-index 0000000..b80384d
---- /dev/null
-+++ b/linux-user/include/host/ppc/host-signal.h
-@@ -0,0 +1,38 @@
-+/*
-+ * host-signal.h: signal info dependent on the host architecture
-+ *
-+ * Copyright (c) 2003-2005 Fabrice Bellard
-+ * Copyright (c) 2021 Linaro Limited
-+ *
-+ * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
-+ * See the COPYING file in the top-level directory.
-+ */
-+
-+#ifndef PPC_HOST_SIGNAL_H
-+#define PPC_HOST_SIGNAL_H
-+
-+/* The third argument to a SA_SIGINFO handler is ucontext_t. */
-+typedef ucontext_t host_sigcontext;
-+
-+static inline uintptr_t host_signal_pc(host_sigcontext *uc)
-+{
-+    return uc->uc_mcontext.regs->nip;
-+}
-+
-+static inline void host_signal_set_pc(host_sigcontext *uc, uintptr_t pc)
-+{
-+    uc->uc_mcontext.regs->nip = pc;
-+}
-+
-+static inline void *host_signal_mask(host_sigcontext *uc)
-+{
-+    return &uc->uc_sigmask;
-+}
-+
-+static inline bool host_signal_write(siginfo_t *info, host_sigcontext *uc)
-+{
-+    return uc->uc_mcontext.regs->trap != 0x400
-+        && (uc->uc_mcontext.regs->dsisr & 0x02000000);
-+}
-+
-+#endif
-diff --git a/linux-user/signal.c b/linux-user/signal.c
-index 092e70b..b8dfa8a 100644
---- a/linux-user/signal.c
-+++ b/linux-user/signal.c
-@@ -800,6 +800,7 @@ void queue_signal(CPUArchState *env, int sig, int si_type,
- /* Adjust the signal context to rewind out of safe-syscall if we're in it */
- static inline void rewind_if_in_safe_syscall(void *puc)
- {
-+#if !defined(__powerpc__) || defined(__powerpc64__)
-     host_sigcontext *uc = (host_sigcontext *)puc;
-     uintptr_t pcreg = host_signal_pc(uc);
- 
-@@ -807,6 +808,7 @@ static inline void rewind_if_in_safe_syscall(void *puc)
-         && pcreg < (uintptr_t)safe_syscall_end) {
-         host_signal_set_pc(uc, (uintptr_t)safe_syscall_start);
-     }
-+#endif
- }
- 
- static void host_signal_handler(int host_sig, siginfo_t *info, void *puc)
diff --git a/srcpkgs/qemu/patches/fix-softfloat-fesetround.patch b/srcpkgs/qemu/patches/fix-softfloat-fesetround.patch
deleted file mode 100644
index ecdd049f79212..0000000000000
--- a/srcpkgs/qemu/patches/fix-softfloat-fesetround.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-Source: @pullmoll
-Upstream: no
-Reason: Target architectures with soft float do not define these constants.
-
---- a/tests/fp/fp-bench.c	2020-12-08 17:59:44.000000000 +0100
-+++ b/tests/fp/fp-bench.c	2020-12-12 20:38:40.702235420 +0100
-@@ -485,16 +485,32 @@
- 
-     switch (rounding) {
-     case ROUND_EVEN:
-+#if defined(FE_TONEAREST)
-         rhost = FE_TONEAREST;
-+#else
-+	return;
-+#endif
-         break;
-     case ROUND_ZERO:
-+#if defined(FE_TOWARDZERO)
-         rhost = FE_TOWARDZERO;
-+#else
-+	return;
-+#endif
-         break;
-     case ROUND_DOWN:
-+#if defined(FE_DOWNWARD)
-         rhost = FE_DOWNWARD;
-+#else
-+	return;
-+#endif
-         break;
-     case ROUND_UP:
-+#if defined(FE_UPWARD)
-         rhost = FE_UPWARD;
-+#else
-+	return;
-+#endif
-         break;
-     case ROUND_TIEAWAY:
-         die_host_rounding(rounding);
diff --git a/srcpkgs/qemu/patches/gcc12.patch b/srcpkgs/qemu/patches/gcc12.patch
deleted file mode 100644
index 2a4b2bd036096..0000000000000
--- a/srcpkgs/qemu/patches/gcc12.patch
+++ /dev/null
@@ -1,72 +0,0 @@
-From 5cb993ff131fca2abef3ce074a20258fd6fce557 Mon Sep 17 00:00:00 2001
-From: Bernhard Beschow <shentey@gmail.com>
-Date: Sat, 18 Mar 2023 19:59:31 +0100
-Subject: [PATCH] qemu/osdep: Switch position of "extern" and "G_NORETURN"
-
-Fixes the Windows build under msys2 using GCC 12 which fails with the following
-error:
-
-  [184/579] Compiling C++ object qga/vss-win32/qga-vss.dll.p/install.cpp.obj
-  FAILED: qga/vss-win32/qga-vss.dll.p/install.cpp.obj
-  "c++" "-m64" "-mcx16" "-Iqga/vss-win32/qga-vss.dll.p" "-Iqga/vss-win32" "-I../src/qga/vss-win32" "-I." "-Iqapi" "-Itrace" "-Iui" "-Iui/shader" "-IC:/msys64/mingw64/include/glib-2.0" "-IC:/msys64/mingw64/lib/glib-2.0/include" "-fdiagnostics-color=auto" "-Wall" "-Winvalid-pch" "-Wnon-virtual-dtor" "-Werror" "-std=gnu++11" "-g" "-iquote" "." "-iquote" "C:/msys64/home/shentey/Projects/qemu/src" "-iquote" "C:/msys64/home/shentey/Projects/qemu/src/include" "-iquote" "C:/msys64/home/shentey/Projects/qemu/src/tcg/i386" "-D__STDC_LIMIT_MACROS" "-D__STDC_CONSTANT_MACROS" "-D__STDC_FORMAT_MACROS" "-fno-pie" "-no-pie" "-D_GNU_SOURCE" "-D_FILE_OFFSET_BITS=64" "-D_LARGEFILE_SOURCE" "-fno-strict-aliasing" "-fno-common" "-fwrapv" "-Wundef" "-Wwrite-strings" "-Wtype-limits" "-Wformat-security" "-Wformat-y2k" "-Winit-self" "-Wignored-qualifiers" "-Wempty-body" "-Wendif-labels" "-Wexpansion-to-defined" "-Wimplicit-fallthrough=2" "-Wmissing-format-attribute" "-Wno-missing-include-dirs" "-Wno-shift-negative-value" "-Wno-psabi" "-fstack-protector-strong" "-Wno-unknown-pragmas" "-Wno-delete-non-virtual-dtor" "-Wno-non-virtual-dtor" -MD -MQ qga/vss-win32/qga-vss.dll.p/install.cpp.obj -MF "qga/vss-win32/qga-vss.dll.p/install.cpp.obj.d" -o qga/vss-win32/qga-vss.dll.p/install.cpp.obj "-c" ../src/qga/vss-win32/install.cpp
-  In file included from C:/msys64/mingw64/lib/glib-2.0/include/glibconfig.h:9,
-              from C:/msys64/mingw64/include/glib-2.0/glib/gtypes.h:34,
-              from C:/msys64/mingw64/include/glib-2.0/glib/galloca.h:34,
-              from C:/msys64/mingw64/include/glib-2.0/glib.h:32,
-              from C:/msys64/home/shentey/Projects/qemu/src/include/glib-compat.h:32,
-              from C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:144,
-              from ../src/qga/vss-win32/install.cpp:13:
-  C:/msys64/mingw64/include/glib-2.0/glib/gmacros.h:1075:21: error: standard attributes in middle of decl-specifiers
-  1075 | # define G_NORETURN [[noreturn]]
-        |                     ^
-  C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:240:8: note: in expansion of macro 'G_NORETURN'
-  240 | extern G_NORETURN
-        |        ^~~~~~~~~~
-  C:/msys64/mingw64/include/glib-2.0/glib/gmacros.h:1075:21: note: standard attributes must precede the decl-specifiers to apply to the declaration, or follow them to apply to the type
-  1075 | # define G_NORETURN [[noreturn]]
-        |                     ^
-  C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:240:8: note: in expansion of macro 'G_NORETURN'
-  240 | extern G_NORETURN
-        |        ^~~~~~~~~~
-  C:/msys64/mingw64/include/glib-2.0/glib/gmacros.h:1075:21: error: attribute ignored [-Werror=attributes]
-  1075 | # define G_NORETURN [[noreturn]]
-        |                     ^
-  C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:240:8: note: in expansion of macro 'G_NORETURN'
-  240 | extern G_NORETURN
-        |        ^~~~~~~~~~
-  C:/msys64/mingw64/include/glib-2.0/glib/gmacros.h:1075:21: note: an attribute that appertains to a type-specifier is ignored
-  1075 | # define G_NORETURN [[noreturn]]
-        |                     ^
-  C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:240:8: note: in expansion of macro 'G_NORETURN'
-  240 | extern G_NORETURN
-        |        ^~~~~~~~~~
-  cc1plus.exe: all warnings being treated as errors
-
-Apparently it also fixes the compilation with Clang 15 (see
-https://gitlab.com/qemu-project/qemu/-/issues/1541 ).
-
-Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1541
-Signed-off-by: Bernhard Beschow <shentey@gmail.com>
-Message-Id: <20230318185931.181659-1-shentey@gmail.com>
-Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
-Signed-off-by: Thomas Huth <thuth@redhat.com>
----
- include/qemu/osdep.h | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
-index f68b5d8708c..9eff0be95bd 100644
---- a/include/qemu/osdep.h
-+++ b/include/qemu/osdep.h
-@@ -237,7 +237,7 @@ extern "C" {
-  * supports QEMU_ERROR, this will be reported at compile time; otherwise
-  * this will be reported at link time due to the missing symbol.
-  */
--extern G_NORETURN
-+G_NORETURN extern
- void QEMU_ERROR("code path is reachable")
-     qemu_build_not_reached_always(void);
- #if defined(__OPTIMIZE__) && !defined(__NO_INLINE__)
--- 
-GitLab
-
diff --git a/srcpkgs/qemu/patches/lfs64.patch b/srcpkgs/qemu/patches/lfs64.patch
new file mode 100644
index 0000000000000..d198ad2ba28ea
--- /dev/null
+++ b/srcpkgs/qemu/patches/lfs64.patch
@@ -0,0 +1,211 @@
+Builds defines -D_FILE_OFFSET_BITS=64 which makes the original functions
+anf macros behave same as their 64 suffixed counterparts. This also
+helps in compiling with latest musl C library, where these macros and
+functions are no more available under _GNU_SOURCE feature macro
+
+source: https://git.alpinelinux.org/aports/plain/community/qemu/lfs64.patch
+--
+diff --git a/linux-user/syscall.c b/linux-user/syscall.c
+index bbba2a6..38fa09a 100644
+--- a/linux-user/syscall.c
++++ b/linux-user/syscall.c
+@@ -6812,13 +6812,13 @@ static int target_to_host_fcntl_cmd(int cmd)
+         ret = cmd;
+         break;
+     case TARGET_F_GETLK:
+-        ret = F_GETLK64;
++        ret = F_GETLK;
+         break;
+     case TARGET_F_SETLK:
+-        ret = F_SETLK64;
++        ret = F_SETLK;
+         break;
+     case TARGET_F_SETLKW:
+-        ret = F_SETLKW64;
++        ret = F_SETLKW;
+         break;
+     case TARGET_F_GETOWN:
+         ret = F_GETOWN;
+@@ -6834,13 +6834,13 @@ static int target_to_host_fcntl_cmd(int cmd)
+         break;
+ #if TARGET_ABI_BITS == 32
+     case TARGET_F_GETLK64:
+-        ret = F_GETLK64;
++        ret = F_GETLK;
+         break;
+     case TARGET_F_SETLK64:
+-        ret = F_SETLK64;
++        ret = F_SETLK;
+         break;
+     case TARGET_F_SETLKW64:
+-        ret = F_SETLKW64;
++        ret = F_SETLKW;
+         break;
+ #endif
+     case TARGET_F_SETLEASE:
+@@ -6894,8 +6894,8 @@ static int target_to_host_fcntl_cmd(int cmd)
+      * them to 5, 6 and 7 before making the syscall(). Since we make the
+      * syscall directly, adjust to what is supported by the kernel.
+      */
+-    if (ret >= F_GETLK64 && ret <= F_SETLKW64) {
+-        ret -= F_GETLK64 - 5;
++    if (ret >= F_GETLK && ret <= F_SETLKW) {
++        ret -= F_GETLK - 5;
+     }
+ #endif
+ 
+@@ -6928,7 +6928,7 @@ static int host_to_target_flock(int type)
+     return type;
+ }
+ 
+-static inline abi_long copy_from_user_flock(struct flock64 *fl,
++static inline abi_long copy_from_user_flock(struct flock *fl,
+                                             abi_ulong target_flock_addr)
+ {
+     struct target_flock *target_fl;
+@@ -6953,7 +6953,7 @@ static inline abi_long copy_from_user_flock(struct flock64 *fl,
+ }
+ 
+ static inline abi_long copy_to_user_flock(abi_ulong target_flock_addr,
+-                                          const struct flock64 *fl)
++                                          const struct flock *fl)
+ {
+     struct target_flock *target_fl;
+     short l_type;
+@@ -6972,8 +6972,8 @@ static inline abi_long copy_to_user_flock(abi_ulong target_flock_addr,
+     return 0;
+ }
+ 
+-typedef abi_long from_flock64_fn(struct flock64 *fl, abi_ulong target_addr);
+-typedef abi_long to_flock64_fn(abi_ulong target_addr, const struct flock64 *fl);
++typedef abi_long from_flock64_fn(struct flock *fl, abi_ulong target_addr);
++typedef abi_long to_flock64_fn(abi_ulong target_addr, const struct flock *fl);
+ 
+ #if defined(TARGET_ARM) && TARGET_ABI_BITS == 32
+ struct target_oabi_flock64 {
+@@ -6984,7 +6984,7 @@ struct target_oabi_flock64 {
+     abi_int   l_pid;
+ } QEMU_PACKED;
+ 
+-static inline abi_long copy_from_user_oabi_flock64(struct flock64 *fl,
++static inline abi_long copy_from_user_oabi_flock64(struct flock *fl,
+                                                    abi_ulong target_flock_addr)
+ {
+     struct target_oabi_flock64 *target_fl;
+@@ -7009,7 +7009,7 @@ static inline abi_long copy_from_user_oabi_flock64(struct flock64 *fl,
+ }
+ 
+ static inline abi_long copy_to_user_oabi_flock64(abi_ulong target_flock_addr,
+-                                                 const struct flock64 *fl)
++                                                 const struct flock *fl)
+ {
+     struct target_oabi_flock64 *target_fl;
+     short l_type;
+@@ -7029,7 +7029,7 @@ static inline abi_long copy_to_user_oabi_flock64(abi_ulong target_flock_addr,
+ }
+ #endif
+ 
+-static inline abi_long copy_from_user_flock64(struct flock64 *fl,
++static inline abi_long copy_from_user_flock64(struct flock *fl,
+                                               abi_ulong target_flock_addr)
+ {
+     struct target_flock64 *target_fl;
+@@ -7054,7 +7054,7 @@ static inline abi_long copy_from_user_flock64(struct flock64 *fl,
+ }
+ 
+ static inline abi_long copy_to_user_flock64(abi_ulong target_flock_addr,
+-                                            const struct flock64 *fl)
++                                            const struct flock *fl)
+ {
+     struct target_flock64 *target_fl;
+     short l_type;
+@@ -7075,7 +7075,7 @@ static inline abi_long copy_to_user_flock64(abi_ulong target_flock_addr,
+ 
+ static abi_long do_fcntl(int fd, int cmd, abi_ulong arg)
+ {
+-    struct flock64 fl64;
++    struct flock fl64;
+ #ifdef F_GETOWN_EX
+     struct f_owner_ex fox;
+     struct target_f_owner_ex *target_fox;
+@@ -7347,7 +7347,7 @@ static inline abi_long target_truncate64(CPUArchState *cpu_env, const char *arg1
+         arg2 = arg3;
+         arg3 = arg4;
+     }
+-    return get_errno(truncate64(arg1, target_offset64(arg2, arg3)));
++    return get_errno(truncate(arg1, target_offset64(arg2, arg3)));
+ }
+ #endif
+ 
+@@ -7361,7 +7361,7 @@ static inline abi_long target_ftruncate64(CPUArchState *cpu_env, abi_long arg1,
+         arg2 = arg3;
+         arg3 = arg4;
+     }
+-    return get_errno(ftruncate64(arg1, target_offset64(arg2, arg3)));
++    return get_errno(ftruncate(arg1, target_offset64(arg2, arg3)));
+ }
+ #endif
+ 
+@@ -8597,7 +8597,7 @@ static int do_getdents(abi_long dirfd, abi_long arg2, abi_long count)
+     void *tdirp;
+     int hlen, hoff, toff;
+     int hreclen, treclen;
+-    off64_t prev_diroff = 0;
++    off_t prev_diroff = 0;
+ 
+     hdirp = g_try_malloc(count);
+     if (!hdirp) {
+@@ -8650,7 +8650,7 @@ static int do_getdents(abi_long dirfd, abi_long arg2, abi_long count)
+              * Return what we have, resetting the file pointer to the
+              * location of the first record not returned.
+              */
+-            lseek64(dirfd, prev_diroff, SEEK_SET);
++            lseek(dirfd, prev_diroff, SEEK_SET);
+             break;
+         }
+ 
+@@ -8684,7 +8684,7 @@ static int do_getdents64(abi_long dirfd, abi_long arg2, abi_long count)
+     void *tdirp;
+     int hlen, hoff, toff;
+     int hreclen, treclen;
+-    off64_t prev_diroff = 0;
++    off_t prev_diroff = 0;
+ 
+     hdirp = g_try_malloc(count);
+     if (!hdirp) {
+@@ -8726,7 +8726,7 @@ static int do_getdents64(abi_long dirfd, abi_long arg2, abi_long count)
+              * Return what we have, resetting the file pointer to the
+              * location of the first record not returned.
+              */
+-            lseek64(dirfd, prev_diroff, SEEK_SET);
++            lseek(dirfd, prev_diroff, SEEK_SET);
+             break;
+         }
+ 
+@@ -11157,7 +11157,7 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,
+                 return -TARGET_EFAULT;
+             }
+         }
+-        ret = get_errno(pread64(arg1, p, arg3, target_offset64(arg4, arg5)));
++        ret = get_errno(pread(arg1, p, arg3, target_offset64(arg4, arg5)));
+         unlock_user(p, arg2, ret);
+         return ret;
+     case TARGET_NR_pwrite64:
+@@ -11174,7 +11174,7 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,
+                 return -TARGET_EFAULT;
+             }
+         }
+-        ret = get_errno(pwrite64(arg1, p, arg3, target_offset64(arg4, arg5)));
++        ret = get_errno(pwrite(arg1, p, arg3, target_offset64(arg4, arg5)));
+         unlock_user(p, arg2, 0);
+         return ret;
+ #endif
+@@ -12034,7 +12034,7 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,
+     case TARGET_NR_fcntl64:
+     {
+         int cmd;
+-        struct flock64 fl;
++        struct flock fl;
+         from_flock64_fn *copyfrom = copy_from_user_flock64;
+         to_flock64_fn *copyto = copy_to_user_flock64;
+
diff --git a/srcpkgs/qemu/patches/mmap-mremap-efault.patch b/srcpkgs/qemu/patches/mmap-mremap-efault.patch
deleted file mode 100644
index 5a70e9658b300..0000000000000
--- a/srcpkgs/qemu/patches/mmap-mremap-efault.patch
+++ /dev/null
@@ -1,42 +0,0 @@
-Source: @pullmoll
-Upstream: no
-Reason: errno=EFAULT when the address passed to mremap(2) is not valid
-
-See Rich Felker's comment at https://www.openwall.com/lists/musl/2017/06/21/2 for
-why we need to return errno as described in man mremap(2) from qemu-user-static.
-Also speed up the loop when checking for increasing the mappings size to go
-in steps of TARGET_PAGE_SIZE and OR-in a check for the very last byte of the range.
-diff --git linux-user/mmap.c linux-user/mmap.c
-index 7e3b245..1e8d0f1 100644
---- a/linux-user/mmap.c
-+++ b/linux-user/mmap.c
-@@ -738,7 +738,7 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size,
-          !guest_range_valid_untagged(new_addr, new_size)) ||
-         ((flags & MREMAP_MAYMOVE) == 0 &&
-          !guest_range_valid_untagged(old_addr, new_size))) {
--        errno = ENOMEM;
-+        errno = EFAULT;
-         return -1;
-     }
- 
-@@ -775,9 +775,10 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size,
-             abi_ulong addr;
-             for (addr = old_addr + old_size;
-                  addr < old_addr + new_size;
--                 addr++) {
-+                 addr += TARGET_PAGE_SIZE) {
-                 prot |= page_get_flags(addr);
-             }
-+				prot |= page_get_flags(old_addr + new_size - 1);
-         }
-         if (prot == 0) {
-             host_addr = mremap(g2h_untagged(old_addr),
-@@ -796,7 +797,7 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size,
-                 }
-             }
-         } else {
--            errno = ENOMEM;
-+            errno = EFAULT;
-             host_addr = MAP_FAILED;
-         }
-     }
diff --git a/srcpkgs/qemu/patches/musl-initialize-msghdr.patch b/srcpkgs/qemu/patches/musl-initialize-msghdr.patch
index 6d96b3511dafe..a88547354c1e5 100644
--- a/srcpkgs/qemu/patches/musl-initialize-msghdr.patch
+++ b/srcpkgs/qemu/patches/musl-initialize-msghdr.patch
@@ -1,10 +1,10 @@
 Source: https://github.com/void-linux/void-packages/issues/23557
 
-diff --git linux-user/syscall.c linux-user/syscall.c
-index 945fc25..8d8b68a 100644
+diff --git a/linux-user/syscall.c b/linux-user/syscall.c
+index 14fdebd..de280af 100644
 --- a/linux-user/syscall.c
 +++ b/linux-user/syscall.c
-@@ -3071,7 +3071,7 @@ static abi_long do_sendrecvmsg_locked(int fd, struct target_msghdr *msgp,
+@@ -3229,7 +3229,7 @@ static abi_long do_sendrecvmsg_locked(int fd, struct target_msghdr *msgp,
                                        int flags, int send)
  {
      abi_long ret, len;
diff --git a/srcpkgs/qemu/patches/musl-ppc.patch b/srcpkgs/qemu/patches/musl-ppc.patch
deleted file mode 100644
index 0b77aa8fc63d4..0000000000000
--- a/srcpkgs/qemu/patches/musl-ppc.patch
+++ /dev/null
@@ -1,25 +0,0 @@
---- a/linux-user/signal.c
-+++ b/linux-user/signal.c
-@@ -21,5 +21,9 @@
- #include "exec/gdbstub.h"
- #include "hw/core/tcg-cpu-ops.h"
- 
-+#if defined(_ARCH_PPC64) && !defined(__GLIBC__) /* musl */
-+#include <asm/ptrace.h>
-+#endif
-+
- #include <sys/ucontext.h>
- #include <sys/resource.h>
---- a/util/mmap-alloc.c
-+++ b/util/mmap-alloc.c
-@@ -25,6 +25,10 @@
- 
- #ifdef CONFIG_LINUX
- #include <sys/vfs.h>
-+/* musl undefs this on ppc and mips */
-+#ifndef MAP_SYNC
-+#define MAP_SYNC 0x80000
-+#endif
- #endif
- 
- size_t qemu_fd_getpagesize(int fd)
diff --git a/srcpkgs/qemu/patches/musl-rlimit-rttime.patch b/srcpkgs/qemu/patches/musl-rlimit-rttime.patch
deleted file mode 100644
index 0cbf9be36a8f1..0000000000000
--- a/srcpkgs/qemu/patches/musl-rlimit-rttime.patch
+++ /dev/null
@@ -1,13 +0,0 @@
---- a/linux-user/syscall.c
-+++ b/linux-user/syscall.c
-@@ -141,6 +141,10 @@
- #include "fd-trans.h"
- #include "tcg/tcg.h"
- 
-+#ifndef RLIMIT_RTTIME
-+#define RLIMIT_RTTIME 15
-+#endif
-+
- #ifndef CLONE_IO
- #define CLONE_IO                0x80000000      /* Clone io context */
- #endif
diff --git a/srcpkgs/qemu/patches/tricore_feature.patch b/srcpkgs/qemu/patches/tricore_feature.patch
deleted file mode 100644
index f7f621f81170b..0000000000000
--- a/srcpkgs/qemu/patches/tricore_feature.patch
+++ /dev/null
@@ -1,60 +0,0 @@
-capstone 5 declares this struct, so we need a different name
---
-diff --git a/target/tricore/cpu.c b/target/tricore/cpu.c
-index d0a9272..6297af9 100644
---- a/target/tricore/cpu.c
-+++ b/target/tricore/cpu.c
-@@ -103,14 +103,14 @@ static void tricore_cpu_realizefn(DeviceState *dev, Error **errp)
-     }
- 
-     /* Some features automatically imply others */
--    if (tricore_feature(env, TRICORE_FEATURE_161)) {
-+    if (tricore_feature_x(env, TRICORE_FEATURE_161)) {
-         set_feature(env, TRICORE_FEATURE_16);
-     }
- 
--    if (tricore_feature(env, TRICORE_FEATURE_16)) {
-+    if (tricore_feature_x(env, TRICORE_FEATURE_16)) {
-         set_feature(env, TRICORE_FEATURE_131);
-     }
--    if (tricore_feature(env, TRICORE_FEATURE_131)) {
-+    if (tricore_feature_x(env, TRICORE_FEATURE_131)) {
-         set_feature(env, TRICORE_FEATURE_13);
-     }
-     cpu_reset(cs);
-diff --git a/target/tricore/cpu.h b/target/tricore/cpu.h
-index 47d0ffb..6fd447c 100644
---- a/target/tricore/cpu.h
-+++ b/target/tricore/cpu.h
-@@ -258,7 +258,7 @@ enum tricore_features {
-     TRICORE_FEATURE_161,
- };
- 
--static inline int tricore_feature(CPUTriCoreState *env, int feature)
-+static inline int tricore_feature_x(CPUTriCoreState *env, int feature)
- {
-     return (env->features & (1ULL << feature)) != 0;
- }
-diff --git a/target/tricore/op_helper.c b/target/tricore/op_helper.c
-index 532ae6b..6a71b5b 100644
---- a/target/tricore/op_helper.c
-+++ b/target/tricore/op_helper.c
-@@ -2528,7 +2528,7 @@ void helper_ret(CPUTriCoreState *env)
-     /* PCXI = new_PCXI; */
-     env->PCXI = new_PCXI;
- 
--    if (tricore_feature(env, TRICORE_FEATURE_13)) {
-+    if (tricore_feature_x(env, TRICORE_FEATURE_13)) {
-         /* PSW = new_PSW */
-         psw_write(env, new_PSW);
-     } else {
-@@ -2639,7 +2639,7 @@ void helper_rfm(CPUTriCoreState *env)
-     env->gpr_a[10] = cpu_ldl_data(env, env->DCX+8);
-     env->gpr_a[11] = cpu_ldl_data(env, env->DCX+12);
- 
--    if (tricore_feature(env, TRICORE_FEATURE_131)) {
-+    if (tricore_feature_x(env, TRICORE_FEATURE_131)) {
-         env->DBGTCR = 0;
-     }
- }
-
diff --git a/srcpkgs/qemu/patches/xxx-ppcle.patch b/srcpkgs/qemu/patches/xxx-ppcle.patch
deleted file mode 100644
index 90b32b5e07cd8..0000000000000
--- a/srcpkgs/qemu/patches/xxx-ppcle.patch
+++ /dev/null
@@ -1,113 +0,0 @@
-From 7ece08d7902d5a8c007deeb0b75cb533a41dd882 Mon Sep 17 00:00:00 2001
-From: Daniel Kolesa <daniel@octaforge.org>
-Date: Sun, 7 Mar 2021 01:47:42 +0100
-Subject: [PATCH] support ppcle architecture
-
----
- configure                            | 14 ++++++++++++--
- configs/targets/ppcle-linux-user.mak |  4 ++++
- linux-user/ppc/target_syscall.h      |  4 ++++
- scripts/qemu-binfmt-conf.sh          |  6 +++++-
- tests/tcg/configure.sh               |  2 ++
- 5 files changed, 27 insertions(+), 3 deletions(-)
- create mode 100644 configs/targets/ppcle-linux-user.mak
-
-diff --git a/configure b/configure
-index 18c26e0..03d3e18 100755
---- a/configure
-+++ b/configure
-@@ -653,7 +653,11 @@ elif check_define _ARCH_PPC ; then
-       cpu="ppc64"
-     fi
-   else
--    cpu="ppc"
-+    if check_define _LITTLE_ENDIAN ; then
-+      cpu="ppcle"
-+    else
-+      cpu="ppc"
-+    fi
-   fi
- elif check_define __mips__ ; then
-   cpu="mips"
-@@ -638,6 +642,9 @@
- 
-   ppc)
-     CPU_CFLAGS="-m32" ;;
-+  ppcle)
-+    cpu="ppc"
-+    CPU_CFLAGS="-m32 -mlittle-endian" ;;
-   ppc64)
-     CPU_CFLAGS="-m64 -mbig-endian" ;;
-   ppc64le)
-diff --git a/configs/targets/ppcle-linux-user.mak b/configs/targets/ppcle-linux-user.mak
-new file mode 100644
-index 0000000..2259243
---- /dev/null
-+++ b/configs/targets/ppcle-linux-user.mak
-@@ -0,0 +1,4 @@
-+TARGET_ARCH=ppc
-+TARGET_SYSTBL_ABI=common,nospu,32
-+TARGET_SYSTBL=syscall.tbl
-+TARGET_XML_FILES= gdb-xml/power-core.xml gdb-xml/power-fpu.xml gdb-xml/power-altivec.xml gdb-xml/power-spe.xml
-diff --git a/linux-user/ppc/target_syscall.h b/linux-user/ppc/target_syscall.h
-index b9c4b81..cf26497 100644
---- a/linux-user/ppc/target_syscall.h
-+++ b/linux-user/ppc/target_syscall.h
-@@ -65,7 +65,11 @@ struct target_revectored_struct {
- #define UNAME_MACHINE "ppc64le"
- #endif
- #else
-+#if TARGET_BIG_ENDIAN
- #define UNAME_MACHINE "ppc"
-+#else
-+#define UNAME_MACHINE "ppcle"
-+#endif
- #endif
- #define UNAME_MINIMUM_RELEASE "2.6.32"
- 
-diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh
-index 9f1580a..393943f 100755
---- a/scripts/qemu-binfmt-conf.sh
-+++ b/scripts/qemu-binfmt-conf.sh
-@@ -46,6 +46,10 @@ ppc_magic='\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x
- ppc_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
- ppc_family=ppc
- 
-+ppcle_magic='\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x14\x00'
-+ppcle_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\x00'
-+ppc_family=ppcle
-+
- ppc64_magic='\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x15'
- ppc64_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
- ppc64_family=ppc
-@@ -148,7 +152,7 @@ qemu_get_family() {
-     "Power Macintosh"|ppc64|powerpc|ppc)
-         echo "ppc"
-         ;;
--    ppc64el|ppc64le)
-+    ppc64el|ppc64le|ppcel|ppcle)
-         echo "ppcle"
-         ;;
-     arm|armel|armhf|arm64|armv[4-9]*l|aarch64)
-diff --git a/configure b/configure
-index 72ab03f11a..0691929d76 100755
---- a/configure
-+++ b/configure
-@@ -1866,6 +1866,7 @@ fi
- : ${cross_prefix_mips="mips-linux-gnu-"}
- : ${cross_prefix_nios2="nios2-linux-gnu-"}
- : ${cross_prefix_ppc="powerpc-linux-gnu-"}
-+: ${cross_prefix_ppcle="powerpcle-linux-gnu-"}
- : ${cross_prefix_ppc64="powerpc64-linux-gnu-"}
- : ${cross_prefix_ppc64le="$cross_prefix_ppc64"}
- : ${cross_prefix_riscv64="riscv64-linux-gnu-"}
-@@ -1883,6 +1884,7 @@ fi
- : ${cross_cc_cflags_hexagon="-mv67 -O2 -static"}
- : ${cross_cc_cflags_i386="-m32"}
- : ${cross_cc_cflags_ppc="-m32 -mbig-endian"}
-+: ${cross_cc_cflags_ppcle="-m32"}
- : ${cross_cc_cflags_ppc64="-m64 -mbig-endian"}
- : ${cross_cc_ppc64le="$cross_cc_ppc64"}
- : ${cross_cc_cflags_ppc64le="-m64 -mlittle-endian"}
-2.30.1
-
diff --git a/srcpkgs/qemu/template b/srcpkgs/qemu/template
index 9793e2f6101a7..d709d264e92db 100644
--- a/srcpkgs/qemu/template
+++ b/srcpkgs/qemu/template
@@ -1,8 +1,8 @@
 # Template file for 'qemu'
 # This package should be updated together with qemu-user-static
 pkgname=qemu
-version=7.1.0
-revision=3
+version=8.1.0
+revision=1
 build_style=configure
 configure_args="--prefix=/usr --sysconfdir=/etc --libexecdir=/usr/libexec --localstatedir=/var
  --disable-glusterfs --disable-xen --enable-docs --enable-kvm --enable-libusb --enable-pie
@@ -10,10 +10,10 @@ configure_args="--prefix=/usr --sysconfdir=/etc --libexecdir=/usr/libexec --loca
  --audio-drv-list=alsa$(vopt_if sdl2 ,sdl)$(vopt_if jack ,jack)$(vopt_if pulseaudio ,pa)
  $(vopt_enable opengl) $(vopt_enable pulseaudio pa) $(vopt_enable sdl2 sdl) $(vopt_enable smartcard)
  $(vopt_enable spice) $(vopt_enable virgl virglrenderer) $(vopt_if gtk3 '--enable-gtk')"
-hostmakedepends="gettext pkg-config perl python3 python3-Sphinx python3-sphinx_rtd_theme ninja"
+hostmakedepends="flex glib-devel gettext pkg-config perl python3 python3-Sphinx python3-sphinx_rtd_theme ninja"
 makedepends="capstone-devel dtc-devel libpng-devel libjpeg-turbo-devel pixman-devel
  snappy-devel libuuid-devel libX11-devel alsa-lib-devel libaio-devel gnutls-devel
- libsasl-devel libglib-devel ncurses-devel libseccomp-devel nss-devel
+ libsasl-devel ncurses-devel libseccomp-devel nss-devel
  libcurl-devel xfsprogs-devel libcap-ng-devel vde2-devel usbredir-devel
  libbluetooth-devel libssh2-devel libusb-devel libnfs-devel libslirp-devel
  libxkbcommon-devel libzstd-devel $(vopt_if sdl2 'SDL2-devel SDL2_image-devel')
@@ -25,18 +25,18 @@ makedepends="capstone-devel dtc-devel libpng-devel libjpeg-turbo-devel pixman-de
  $(vopt_if jack 'jack-devel') $(vopt_if pulseaudio 'pulseaudio-devel')"
 short_desc="Open Source Processor Emulator"
 maintainer="Orphaned <orphan@voidlinux.org>"
-license="GPL-2.0-or-later, LGPL-2.1-or-later"
+license="GPL-2.0-only, LGPL-2.1-only"
 homepage="https://www.qemu.org"
 distfiles="https://wiki.qemu.org/download/qemu-${version}.tar.bz2"
-checksum=f7ac2b85b3f1831e6810b140306e30af91556e15784864b209f3942858947fd0
+checksum=53a2388f4f67d03e94ed7fe192d8828e64c535fadf7bf9dd0bc1d2091eedf624
 ignore_elf_dirs="/usr/share/qemu"
 nostrip_files="hppa-firmware.img openbios-ppc openbios-sparc32 openbios-sparc64
  palcode-clipper s390-ccw.img s390-netboot.img u-boot.e500 opensbi-riscv32-generic-fw_dynamic.elf
  opensbi-riscv64-generic-fw_dynamic.elf"
-make_check=no # capstone5.0: fails 90/95 qemu:unit / test-vmstate (when updating the qemu package this should go away)
+make_check=yes
 
-build_options="gtk3 opengl sdl2 spice virgl smartcard numa iscsi jack pulseaudio"
-build_options_default="opengl gtk3 virgl sdl2 numa iscsi jack pulseaudio"
+build_options="gtk3 iscsi jack numa opengl pulseaudio sdl2 smartcard spice virgl"
+build_options_default="gtk3 iscsi jack numa opengl pulseaudio sdl2 smartcard spice virgl"
 desc_option_sdl2="Enable SDL (2.x) video output"
 desc_option_spice="Enable support for SPICE"
 desc_option_virgl="Enable support for VirGL (A Virtual 3D GPU renderer)"
@@ -44,33 +44,10 @@ desc_option_smartcard="Enable smartcard support"
 desc_option_numa="Enable support for host NUMA"
 desc_option_iscsi="Enable support for iSCSI"
 
-case "$XBPS_TARGET_MACHINE" in
-	aarch64-musl) CFLAGS="-D_LINUX_SYSINFO_H";;
-esac
-
-if [ "$XBPS_TARGET_ENDIAN" = "le" ]; then
-	build_options_default+=" spice"
-fi
-
 if [ "$CROSS_BUILD" ]; then
 	configure_args+=" --cross-prefix=${XBPS_CROSS_TRIPLET}-"
-else
-	build_options_default+=" smartcard"
 fi
 
-post_extract() {
-	if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
-		grep -rl 'Input/output error' tests/qemu-iotests |
-			xargs -n1 sed -i -e 's;Input/output error;I/O error;g'
-		grep -rl 'Operation not supported' tests/qemu-iotests |
-			xargs -n1 sed -i -e 's;Operation not supported;Not supported;g'
-	fi
-}
-
-pre_configure() {
-	unset CPP
-}
-
 post_install() {
 	vdoc "${FILESDIR}/README.voidlinux"
 

From 800d6f6ef1d75dc4b042a29b421c153f6c2563ec Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Cerqueira?= <acerqueira021@gmail.com>
Date: Sun, 17 Sep 2023 11:21:18 +0100
Subject: [PATCH 2/2] qemu-user-static: update to 8.1.0.

---
 srcpkgs/qemu-user-static/template | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/srcpkgs/qemu-user-static/template b/srcpkgs/qemu-user-static/template
index 2a8da9b53f2d5..48aa0ee129c29 100644
--- a/srcpkgs/qemu-user-static/template
+++ b/srcpkgs/qemu-user-static/template
@@ -1,20 +1,20 @@
 # Template file for 'qemu-user-static'
 # This package should be updated together with qemu
 pkgname=qemu-user-static
-version=7.1.0
-revision=3
+version=8.1.0
+revision=1
 build_style=configure
 configure_args="--prefix=/usr --sysconfdir=/etc --libexecdir=/usr/libexec
  --disable-kvm --disable-png --disable-virtfs --disable-fdt --disable-seccomp
  --enable-linux-user --disable-system --static --disable-pie"
-hostmakedepends="pkg-config perl python3 ninja"
-makedepends="dtc-devel libglib-devel pixman-devel libuuid-devel"
+hostmakedepends="flex glib-devel pkg-config perl python3 ninja"
+makedepends="dtc-devel pixman-devel libuuid-devel"
 short_desc="QEMU User-mode emulators (statically compiled)"
 maintainer="Orphaned <orphan@voidlinux.org>"
-license="GPL-2.0-or-later, LGPL-2.1-or-later"
+license="GPL-2.0-only, LGPL-2.1-only"
 homepage="https://www.qemu.org"
 distfiles="https://wiki.qemu.org/download/qemu-${version}.tar.bz2"
-checksum=f7ac2b85b3f1831e6810b140306e30af91556e15784864b209f3942858947fd0
+checksum=53a2388f4f67d03e94ed7fe192d8828e64c535fadf7bf9dd0bc1d2091eedf624
 
 _fmts="aarch64 aarch64_be alpha arm armeb cris hppa i386 m68k microblaze
  microblazeel mips mipsel mips64 mips64el mipsn32 mipsn32el or1k
@@ -111,10 +111,6 @@ done
 
 binfmts="${binfmts%?}"
 
-pre_configure() {
-	unset CPP
-}
-
 post_install() {
 	# Remove unneeded stuff.
 	rm -rf ${DESTDIR}/etc ${DESTDIR}/usr/share ${DESTDIR}/usr/libexec

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [PR PATCH] [Updated] qemu: update to 8.1.0.
  2023-07-03 17:50 [PR PATCH] qemu: update to 8.0.2 motorto
                   ` (34 preceding siblings ...)
  2023-09-17 10:21 ` motorto
@ 2023-09-17 10:30 ` motorto
  2023-09-17 13:58 ` motorto
                   ` (2 subsequent siblings)
  38 siblings, 0 replies; 40+ messages in thread
From: motorto @ 2023-09-17 10:30 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1870 bytes --]

There is an updated pull request by motorto against master on the void-packages repository

https://github.com/motorto/void-packages qemu-8.0.2
https://github.com/void-linux/void-packages/pull/44822

qemu: update to 8.1.0.
<!-- Uncomment relevant sections and delete options which are not applicable -->
[ci-skip] 

Draft because of: https://github.com/void-linux/void-packages/pull/44822#issuecomment-1633611714


#### Testing the changes
- I tested the changes in this PR: **YES**, runned a Windows vm machine and it worked fine. 
**DIDN'T Test the qemu-user-static**

Removed a bunch of patches that in my research are no longer needed:

- Removed all ppc related patches since that arch isn't no longer supported.
- gcc12.patch: because it builds fine now in this version
- fix-softfloat-fesetround.patch: don't have a system to try it, but alpine doesn't have any patch related to this)
- mmap-mremap-efaul: not sure about if we should keep this one

Kept this patches:

- musl-initialize-msghdr.patch: just update in order to apply.

Added this ones:

- ~~CVE-2023-2861.patch~~
- ~~keymap.patch: xkeyboard-config 2.39 removed the legacy alias of ar -> ara~~
- ~~fix-brk0.patch: make sure that initial brk(0) is page-aligned~~
- lfs64.patch: Builds defines -D_FILE_OFFSET_BITS=64 which makes the original functions
anf macros behave same as their 64 suffixed counterparts. This also
helps in compiling with latest musl C library, where these macros and
functions are no more available under _GNU_SOURCE feature macro

#### Local build testing
- I built this PR locally for my native architecture, x86-64-glibc
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl (cross)
  - x86_64-musl



A patch file from https://github.com/void-linux/void-packages/pull/44822.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-qemu-8.0.2-44822.patch --]
[-- Type: text/x-diff, Size: 36652 bytes --]

From f15894177dbb2376ac986a9cb175a941a0e932a7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Cerqueira?= <acerqueira021@gmail.com>
Date: Fri, 15 Sep 2023 23:38:32 +0100
Subject: [PATCH 1/2] qemu: update to 8.1.0.

---
 .../qemu/patches/fix-linux-user-ppc32.patch   | 117 ----------
 .../patches/fix-softfloat-fesetround.patch    |  39 ----
 srcpkgs/qemu/patches/gcc12.patch              |  72 ------
 srcpkgs/qemu/patches/lfs64.patch              | 211 ++++++++++++++++++
 srcpkgs/qemu/patches/mmap-mremap-efault.patch |  42 ----
 .../qemu/patches/musl-initialize-msghdr.patch |   6 +-
 srcpkgs/qemu/patches/musl-ppc.patch           |  25 ---
 srcpkgs/qemu/patches/musl-rlimit-rttime.patch |  13 --
 srcpkgs/qemu/patches/tricore_feature.patch    |  60 -----
 srcpkgs/qemu/patches/xxx-ppcle.patch          | 113 ----------
 srcpkgs/qemu/template                         |  41 +---
 11 files changed, 223 insertions(+), 516 deletions(-)
 delete mode 100644 srcpkgs/qemu/patches/fix-linux-user-ppc32.patch
 delete mode 100644 srcpkgs/qemu/patches/fix-softfloat-fesetround.patch
 delete mode 100644 srcpkgs/qemu/patches/gcc12.patch
 create mode 100644 srcpkgs/qemu/patches/lfs64.patch
 delete mode 100644 srcpkgs/qemu/patches/mmap-mremap-efault.patch
 delete mode 100644 srcpkgs/qemu/patches/musl-ppc.patch
 delete mode 100644 srcpkgs/qemu/patches/musl-rlimit-rttime.patch
 delete mode 100644 srcpkgs/qemu/patches/tricore_feature.patch
 delete mode 100644 srcpkgs/qemu/patches/xxx-ppcle.patch

diff --git a/srcpkgs/qemu/patches/fix-linux-user-ppc32.patch b/srcpkgs/qemu/patches/fix-linux-user-ppc32.patch
deleted file mode 100644
index cd47435d5aa9a..0000000000000
--- a/srcpkgs/qemu/patches/fix-linux-user-ppc32.patch
+++ /dev/null
@@ -1,117 +0,0 @@
-commit 37814f62c2cc7aba2eea073014d6c53dcd5bf42c
-Author: q66 <daniel@octaforge.org>
-Date:   Fri Jul 1 16:53:55 2022 +0200
-
-    fix linux-user build on 32-bit ppc
-    
-    Partial revert https://gitlab.com/qemu-project/qemu/-/commit/9d1401b79463e74adbfac69d836789d4e103fb61
-    and https://gitlab.com/qemu-project/qemu/-/commit/0a7e01904d407baa73c1baddbdfc9ccf2ace8356
-
-diff --git a/common-user/host/ppc/safe-syscall.inc.S b/common-user/host/ppc/safe-syscall.inc.S
-new file mode 100644
-index 0000000..e69de29
-diff --git a/common-user/safe-syscall-error.c b/common-user/safe-syscall-error.c
-index cf74b50..a36132c 100644
---- a/common-user/safe-syscall-error.c
-+++ b/common-user/safe-syscall-error.c
-@@ -12,6 +12,7 @@
- #include "qemu/osdep.h"
- #include "user/safe-syscall.h"
- 
-+#if !defined(__powerpc__) || defined(__powerpc64__)
- /*
-  * This is intended to be invoked via tail-call on the error path
-  * from the assembly in host/arch/safe-syscall.inc.S.  This takes
-@@ -23,3 +24,4 @@ long safe_syscall_set_errno_tail(int value)
-     errno = value;
-     return -1;
- }
-+#endif
-diff --git a/include/user/safe-syscall.h b/include/user/safe-syscall.h
-index 61a04e2..793fe84 100644
---- a/include/user/safe-syscall.h
-+++ b/include/user/safe-syscall.h
-@@ -125,6 +125,8 @@
-  * kinds of restartability.
-  */
- 
-+#if !defined(__powerpc__) || defined(__powerpc64__)
-+
- /* The core part of this function is implemented in assembly */
- extern long safe_syscall_base(int *pending, long number, ...);
- extern long safe_syscall_set_errno_tail(int value);
-@@ -137,4 +139,10 @@ extern char safe_syscall_end[];
-     safe_syscall_base(&((TaskState *)thread_cpu->opaque)->signal_pending, \
-                       __VA_ARGS__)
- 
-+#else
-+
-+#define safe_syscall syscall
-+
-+#endif
-+
- #endif
-diff --git a/linux-user/include/host/ppc/host-signal.h b/linux-user/include/host/ppc/host-signal.h
-new file mode 100644
-index 0000000..b80384d
---- /dev/null
-+++ b/linux-user/include/host/ppc/host-signal.h
-@@ -0,0 +1,38 @@
-+/*
-+ * host-signal.h: signal info dependent on the host architecture
-+ *
-+ * Copyright (c) 2003-2005 Fabrice Bellard
-+ * Copyright (c) 2021 Linaro Limited
-+ *
-+ * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
-+ * See the COPYING file in the top-level directory.
-+ */
-+
-+#ifndef PPC_HOST_SIGNAL_H
-+#define PPC_HOST_SIGNAL_H
-+
-+/* The third argument to a SA_SIGINFO handler is ucontext_t. */
-+typedef ucontext_t host_sigcontext;
-+
-+static inline uintptr_t host_signal_pc(host_sigcontext *uc)
-+{
-+    return uc->uc_mcontext.regs->nip;
-+}
-+
-+static inline void host_signal_set_pc(host_sigcontext *uc, uintptr_t pc)
-+{
-+    uc->uc_mcontext.regs->nip = pc;
-+}
-+
-+static inline void *host_signal_mask(host_sigcontext *uc)
-+{
-+    return &uc->uc_sigmask;
-+}
-+
-+static inline bool host_signal_write(siginfo_t *info, host_sigcontext *uc)
-+{
-+    return uc->uc_mcontext.regs->trap != 0x400
-+        && (uc->uc_mcontext.regs->dsisr & 0x02000000);
-+}
-+
-+#endif
-diff --git a/linux-user/signal.c b/linux-user/signal.c
-index 092e70b..b8dfa8a 100644
---- a/linux-user/signal.c
-+++ b/linux-user/signal.c
-@@ -800,6 +800,7 @@ void queue_signal(CPUArchState *env, int sig, int si_type,
- /* Adjust the signal context to rewind out of safe-syscall if we're in it */
- static inline void rewind_if_in_safe_syscall(void *puc)
- {
-+#if !defined(__powerpc__) || defined(__powerpc64__)
-     host_sigcontext *uc = (host_sigcontext *)puc;
-     uintptr_t pcreg = host_signal_pc(uc);
- 
-@@ -807,6 +808,7 @@ static inline void rewind_if_in_safe_syscall(void *puc)
-         && pcreg < (uintptr_t)safe_syscall_end) {
-         host_signal_set_pc(uc, (uintptr_t)safe_syscall_start);
-     }
-+#endif
- }
- 
- static void host_signal_handler(int host_sig, siginfo_t *info, void *puc)
diff --git a/srcpkgs/qemu/patches/fix-softfloat-fesetround.patch b/srcpkgs/qemu/patches/fix-softfloat-fesetround.patch
deleted file mode 100644
index ecdd049f79212..0000000000000
--- a/srcpkgs/qemu/patches/fix-softfloat-fesetround.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-Source: @pullmoll
-Upstream: no
-Reason: Target architectures with soft float do not define these constants.
-
---- a/tests/fp/fp-bench.c	2020-12-08 17:59:44.000000000 +0100
-+++ b/tests/fp/fp-bench.c	2020-12-12 20:38:40.702235420 +0100
-@@ -485,16 +485,32 @@
- 
-     switch (rounding) {
-     case ROUND_EVEN:
-+#if defined(FE_TONEAREST)
-         rhost = FE_TONEAREST;
-+#else
-+	return;
-+#endif
-         break;
-     case ROUND_ZERO:
-+#if defined(FE_TOWARDZERO)
-         rhost = FE_TOWARDZERO;
-+#else
-+	return;
-+#endif
-         break;
-     case ROUND_DOWN:
-+#if defined(FE_DOWNWARD)
-         rhost = FE_DOWNWARD;
-+#else
-+	return;
-+#endif
-         break;
-     case ROUND_UP:
-+#if defined(FE_UPWARD)
-         rhost = FE_UPWARD;
-+#else
-+	return;
-+#endif
-         break;
-     case ROUND_TIEAWAY:
-         die_host_rounding(rounding);
diff --git a/srcpkgs/qemu/patches/gcc12.patch b/srcpkgs/qemu/patches/gcc12.patch
deleted file mode 100644
index 2a4b2bd036096..0000000000000
--- a/srcpkgs/qemu/patches/gcc12.patch
+++ /dev/null
@@ -1,72 +0,0 @@
-From 5cb993ff131fca2abef3ce074a20258fd6fce557 Mon Sep 17 00:00:00 2001
-From: Bernhard Beschow <shentey@gmail.com>
-Date: Sat, 18 Mar 2023 19:59:31 +0100
-Subject: [PATCH] qemu/osdep: Switch position of "extern" and "G_NORETURN"
-
-Fixes the Windows build under msys2 using GCC 12 which fails with the following
-error:
-
-  [184/579] Compiling C++ object qga/vss-win32/qga-vss.dll.p/install.cpp.obj
-  FAILED: qga/vss-win32/qga-vss.dll.p/install.cpp.obj
-  "c++" "-m64" "-mcx16" "-Iqga/vss-win32/qga-vss.dll.p" "-Iqga/vss-win32" "-I../src/qga/vss-win32" "-I." "-Iqapi" "-Itrace" "-Iui" "-Iui/shader" "-IC:/msys64/mingw64/include/glib-2.0" "-IC:/msys64/mingw64/lib/glib-2.0/include" "-fdiagnostics-color=auto" "-Wall" "-Winvalid-pch" "-Wnon-virtual-dtor" "-Werror" "-std=gnu++11" "-g" "-iquote" "." "-iquote" "C:/msys64/home/shentey/Projects/qemu/src" "-iquote" "C:/msys64/home/shentey/Projects/qemu/src/include" "-iquote" "C:/msys64/home/shentey/Projects/qemu/src/tcg/i386" "-D__STDC_LIMIT_MACROS" "-D__STDC_CONSTANT_MACROS" "-D__STDC_FORMAT_MACROS" "-fno-pie" "-no-pie" "-D_GNU_SOURCE" "-D_FILE_OFFSET_BITS=64" "-D_LARGEFILE_SOURCE" "-fno-strict-aliasing" "-fno-common" "-fwrapv" "-Wundef" "-Wwrite-strings" "-Wtype-limits" "-Wformat-security" "-Wformat-y2k" "-Winit-self" "-Wignored-qualifiers" "-Wempty-body" "-Wendif-labels" "-Wexpansion-to-defined" "-Wimplicit-fallthrough=2" "-Wmissing-format-attribute" "-Wno-missing-include-dirs" "-Wno-shift-negative-value" "-Wno-psabi" "-fstack-protector-strong" "-Wno-unknown-pragmas" "-Wno-delete-non-virtual-dtor" "-Wno-non-virtual-dtor" -MD -MQ qga/vss-win32/qga-vss.dll.p/install.cpp.obj -MF "qga/vss-win32/qga-vss.dll.p/install.cpp.obj.d" -o qga/vss-win32/qga-vss.dll.p/install.cpp.obj "-c" ../src/qga/vss-win32/install.cpp
-  In file included from C:/msys64/mingw64/lib/glib-2.0/include/glibconfig.h:9,
-              from C:/msys64/mingw64/include/glib-2.0/glib/gtypes.h:34,
-              from C:/msys64/mingw64/include/glib-2.0/glib/galloca.h:34,
-              from C:/msys64/mingw64/include/glib-2.0/glib.h:32,
-              from C:/msys64/home/shentey/Projects/qemu/src/include/glib-compat.h:32,
-              from C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:144,
-              from ../src/qga/vss-win32/install.cpp:13:
-  C:/msys64/mingw64/include/glib-2.0/glib/gmacros.h:1075:21: error: standard attributes in middle of decl-specifiers
-  1075 | # define G_NORETURN [[noreturn]]
-        |                     ^
-  C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:240:8: note: in expansion of macro 'G_NORETURN'
-  240 | extern G_NORETURN
-        |        ^~~~~~~~~~
-  C:/msys64/mingw64/include/glib-2.0/glib/gmacros.h:1075:21: note: standard attributes must precede the decl-specifiers to apply to the declaration, or follow them to apply to the type
-  1075 | # define G_NORETURN [[noreturn]]
-        |                     ^
-  C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:240:8: note: in expansion of macro 'G_NORETURN'
-  240 | extern G_NORETURN
-        |        ^~~~~~~~~~
-  C:/msys64/mingw64/include/glib-2.0/glib/gmacros.h:1075:21: error: attribute ignored [-Werror=attributes]
-  1075 | # define G_NORETURN [[noreturn]]
-        |                     ^
-  C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:240:8: note: in expansion of macro 'G_NORETURN'
-  240 | extern G_NORETURN
-        |        ^~~~~~~~~~
-  C:/msys64/mingw64/include/glib-2.0/glib/gmacros.h:1075:21: note: an attribute that appertains to a type-specifier is ignored
-  1075 | # define G_NORETURN [[noreturn]]
-        |                     ^
-  C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:240:8: note: in expansion of macro 'G_NORETURN'
-  240 | extern G_NORETURN
-        |        ^~~~~~~~~~
-  cc1plus.exe: all warnings being treated as errors
-
-Apparently it also fixes the compilation with Clang 15 (see
-https://gitlab.com/qemu-project/qemu/-/issues/1541 ).
-
-Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1541
-Signed-off-by: Bernhard Beschow <shentey@gmail.com>
-Message-Id: <20230318185931.181659-1-shentey@gmail.com>
-Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
-Signed-off-by: Thomas Huth <thuth@redhat.com>
----
- include/qemu/osdep.h | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
-index f68b5d8708c..9eff0be95bd 100644
---- a/include/qemu/osdep.h
-+++ b/include/qemu/osdep.h
-@@ -237,7 +237,7 @@ extern "C" {
-  * supports QEMU_ERROR, this will be reported at compile time; otherwise
-  * this will be reported at link time due to the missing symbol.
-  */
--extern G_NORETURN
-+G_NORETURN extern
- void QEMU_ERROR("code path is reachable")
-     qemu_build_not_reached_always(void);
- #if defined(__OPTIMIZE__) && !defined(__NO_INLINE__)
--- 
-GitLab
-
diff --git a/srcpkgs/qemu/patches/lfs64.patch b/srcpkgs/qemu/patches/lfs64.patch
new file mode 100644
index 0000000000000..d198ad2ba28ea
--- /dev/null
+++ b/srcpkgs/qemu/patches/lfs64.patch
@@ -0,0 +1,211 @@
+Builds defines -D_FILE_OFFSET_BITS=64 which makes the original functions
+anf macros behave same as their 64 suffixed counterparts. This also
+helps in compiling with latest musl C library, where these macros and
+functions are no more available under _GNU_SOURCE feature macro
+
+source: https://git.alpinelinux.org/aports/plain/community/qemu/lfs64.patch
+--
+diff --git a/linux-user/syscall.c b/linux-user/syscall.c
+index bbba2a6..38fa09a 100644
+--- a/linux-user/syscall.c
++++ b/linux-user/syscall.c
+@@ -6812,13 +6812,13 @@ static int target_to_host_fcntl_cmd(int cmd)
+         ret = cmd;
+         break;
+     case TARGET_F_GETLK:
+-        ret = F_GETLK64;
++        ret = F_GETLK;
+         break;
+     case TARGET_F_SETLK:
+-        ret = F_SETLK64;
++        ret = F_SETLK;
+         break;
+     case TARGET_F_SETLKW:
+-        ret = F_SETLKW64;
++        ret = F_SETLKW;
+         break;
+     case TARGET_F_GETOWN:
+         ret = F_GETOWN;
+@@ -6834,13 +6834,13 @@ static int target_to_host_fcntl_cmd(int cmd)
+         break;
+ #if TARGET_ABI_BITS == 32
+     case TARGET_F_GETLK64:
+-        ret = F_GETLK64;
++        ret = F_GETLK;
+         break;
+     case TARGET_F_SETLK64:
+-        ret = F_SETLK64;
++        ret = F_SETLK;
+         break;
+     case TARGET_F_SETLKW64:
+-        ret = F_SETLKW64;
++        ret = F_SETLKW;
+         break;
+ #endif
+     case TARGET_F_SETLEASE:
+@@ -6894,8 +6894,8 @@ static int target_to_host_fcntl_cmd(int cmd)
+      * them to 5, 6 and 7 before making the syscall(). Since we make the
+      * syscall directly, adjust to what is supported by the kernel.
+      */
+-    if (ret >= F_GETLK64 && ret <= F_SETLKW64) {
+-        ret -= F_GETLK64 - 5;
++    if (ret >= F_GETLK && ret <= F_SETLKW) {
++        ret -= F_GETLK - 5;
+     }
+ #endif
+ 
+@@ -6928,7 +6928,7 @@ static int host_to_target_flock(int type)
+     return type;
+ }
+ 
+-static inline abi_long copy_from_user_flock(struct flock64 *fl,
++static inline abi_long copy_from_user_flock(struct flock *fl,
+                                             abi_ulong target_flock_addr)
+ {
+     struct target_flock *target_fl;
+@@ -6953,7 +6953,7 @@ static inline abi_long copy_from_user_flock(struct flock64 *fl,
+ }
+ 
+ static inline abi_long copy_to_user_flock(abi_ulong target_flock_addr,
+-                                          const struct flock64 *fl)
++                                          const struct flock *fl)
+ {
+     struct target_flock *target_fl;
+     short l_type;
+@@ -6972,8 +6972,8 @@ static inline abi_long copy_to_user_flock(abi_ulong target_flock_addr,
+     return 0;
+ }
+ 
+-typedef abi_long from_flock64_fn(struct flock64 *fl, abi_ulong target_addr);
+-typedef abi_long to_flock64_fn(abi_ulong target_addr, const struct flock64 *fl);
++typedef abi_long from_flock64_fn(struct flock *fl, abi_ulong target_addr);
++typedef abi_long to_flock64_fn(abi_ulong target_addr, const struct flock *fl);
+ 
+ #if defined(TARGET_ARM) && TARGET_ABI_BITS == 32
+ struct target_oabi_flock64 {
+@@ -6984,7 +6984,7 @@ struct target_oabi_flock64 {
+     abi_int   l_pid;
+ } QEMU_PACKED;
+ 
+-static inline abi_long copy_from_user_oabi_flock64(struct flock64 *fl,
++static inline abi_long copy_from_user_oabi_flock64(struct flock *fl,
+                                                    abi_ulong target_flock_addr)
+ {
+     struct target_oabi_flock64 *target_fl;
+@@ -7009,7 +7009,7 @@ static inline abi_long copy_from_user_oabi_flock64(struct flock64 *fl,
+ }
+ 
+ static inline abi_long copy_to_user_oabi_flock64(abi_ulong target_flock_addr,
+-                                                 const struct flock64 *fl)
++                                                 const struct flock *fl)
+ {
+     struct target_oabi_flock64 *target_fl;
+     short l_type;
+@@ -7029,7 +7029,7 @@ static inline abi_long copy_to_user_oabi_flock64(abi_ulong target_flock_addr,
+ }
+ #endif
+ 
+-static inline abi_long copy_from_user_flock64(struct flock64 *fl,
++static inline abi_long copy_from_user_flock64(struct flock *fl,
+                                               abi_ulong target_flock_addr)
+ {
+     struct target_flock64 *target_fl;
+@@ -7054,7 +7054,7 @@ static inline abi_long copy_from_user_flock64(struct flock64 *fl,
+ }
+ 
+ static inline abi_long copy_to_user_flock64(abi_ulong target_flock_addr,
+-                                            const struct flock64 *fl)
++                                            const struct flock *fl)
+ {
+     struct target_flock64 *target_fl;
+     short l_type;
+@@ -7075,7 +7075,7 @@ static inline abi_long copy_to_user_flock64(abi_ulong target_flock_addr,
+ 
+ static abi_long do_fcntl(int fd, int cmd, abi_ulong arg)
+ {
+-    struct flock64 fl64;
++    struct flock fl64;
+ #ifdef F_GETOWN_EX
+     struct f_owner_ex fox;
+     struct target_f_owner_ex *target_fox;
+@@ -7347,7 +7347,7 @@ static inline abi_long target_truncate64(CPUArchState *cpu_env, const char *arg1
+         arg2 = arg3;
+         arg3 = arg4;
+     }
+-    return get_errno(truncate64(arg1, target_offset64(arg2, arg3)));
++    return get_errno(truncate(arg1, target_offset64(arg2, arg3)));
+ }
+ #endif
+ 
+@@ -7361,7 +7361,7 @@ static inline abi_long target_ftruncate64(CPUArchState *cpu_env, abi_long arg1,
+         arg2 = arg3;
+         arg3 = arg4;
+     }
+-    return get_errno(ftruncate64(arg1, target_offset64(arg2, arg3)));
++    return get_errno(ftruncate(arg1, target_offset64(arg2, arg3)));
+ }
+ #endif
+ 
+@@ -8597,7 +8597,7 @@ static int do_getdents(abi_long dirfd, abi_long arg2, abi_long count)
+     void *tdirp;
+     int hlen, hoff, toff;
+     int hreclen, treclen;
+-    off64_t prev_diroff = 0;
++    off_t prev_diroff = 0;
+ 
+     hdirp = g_try_malloc(count);
+     if (!hdirp) {
+@@ -8650,7 +8650,7 @@ static int do_getdents(abi_long dirfd, abi_long arg2, abi_long count)
+              * Return what we have, resetting the file pointer to the
+              * location of the first record not returned.
+              */
+-            lseek64(dirfd, prev_diroff, SEEK_SET);
++            lseek(dirfd, prev_diroff, SEEK_SET);
+             break;
+         }
+ 
+@@ -8684,7 +8684,7 @@ static int do_getdents64(abi_long dirfd, abi_long arg2, abi_long count)
+     void *tdirp;
+     int hlen, hoff, toff;
+     int hreclen, treclen;
+-    off64_t prev_diroff = 0;
++    off_t prev_diroff = 0;
+ 
+     hdirp = g_try_malloc(count);
+     if (!hdirp) {
+@@ -8726,7 +8726,7 @@ static int do_getdents64(abi_long dirfd, abi_long arg2, abi_long count)
+              * Return what we have, resetting the file pointer to the
+              * location of the first record not returned.
+              */
+-            lseek64(dirfd, prev_diroff, SEEK_SET);
++            lseek(dirfd, prev_diroff, SEEK_SET);
+             break;
+         }
+ 
+@@ -11157,7 +11157,7 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,
+                 return -TARGET_EFAULT;
+             }
+         }
+-        ret = get_errno(pread64(arg1, p, arg3, target_offset64(arg4, arg5)));
++        ret = get_errno(pread(arg1, p, arg3, target_offset64(arg4, arg5)));
+         unlock_user(p, arg2, ret);
+         return ret;
+     case TARGET_NR_pwrite64:
+@@ -11174,7 +11174,7 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,
+                 return -TARGET_EFAULT;
+             }
+         }
+-        ret = get_errno(pwrite64(arg1, p, arg3, target_offset64(arg4, arg5)));
++        ret = get_errno(pwrite(arg1, p, arg3, target_offset64(arg4, arg5)));
+         unlock_user(p, arg2, 0);
+         return ret;
+ #endif
+@@ -12034,7 +12034,7 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,
+     case TARGET_NR_fcntl64:
+     {
+         int cmd;
+-        struct flock64 fl;
++        struct flock fl;
+         from_flock64_fn *copyfrom = copy_from_user_flock64;
+         to_flock64_fn *copyto = copy_to_user_flock64;
+
diff --git a/srcpkgs/qemu/patches/mmap-mremap-efault.patch b/srcpkgs/qemu/patches/mmap-mremap-efault.patch
deleted file mode 100644
index 5a70e9658b300..0000000000000
--- a/srcpkgs/qemu/patches/mmap-mremap-efault.patch
+++ /dev/null
@@ -1,42 +0,0 @@
-Source: @pullmoll
-Upstream: no
-Reason: errno=EFAULT when the address passed to mremap(2) is not valid
-
-See Rich Felker's comment at https://www.openwall.com/lists/musl/2017/06/21/2 for
-why we need to return errno as described in man mremap(2) from qemu-user-static.
-Also speed up the loop when checking for increasing the mappings size to go
-in steps of TARGET_PAGE_SIZE and OR-in a check for the very last byte of the range.
-diff --git linux-user/mmap.c linux-user/mmap.c
-index 7e3b245..1e8d0f1 100644
---- a/linux-user/mmap.c
-+++ b/linux-user/mmap.c
-@@ -738,7 +738,7 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size,
-          !guest_range_valid_untagged(new_addr, new_size)) ||
-         ((flags & MREMAP_MAYMOVE) == 0 &&
-          !guest_range_valid_untagged(old_addr, new_size))) {
--        errno = ENOMEM;
-+        errno = EFAULT;
-         return -1;
-     }
- 
-@@ -775,9 +775,10 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size,
-             abi_ulong addr;
-             for (addr = old_addr + old_size;
-                  addr < old_addr + new_size;
--                 addr++) {
-+                 addr += TARGET_PAGE_SIZE) {
-                 prot |= page_get_flags(addr);
-             }
-+				prot |= page_get_flags(old_addr + new_size - 1);
-         }
-         if (prot == 0) {
-             host_addr = mremap(g2h_untagged(old_addr),
-@@ -796,7 +797,7 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size,
-                 }
-             }
-         } else {
--            errno = ENOMEM;
-+            errno = EFAULT;
-             host_addr = MAP_FAILED;
-         }
-     }
diff --git a/srcpkgs/qemu/patches/musl-initialize-msghdr.patch b/srcpkgs/qemu/patches/musl-initialize-msghdr.patch
index 6d96b3511dafe..a88547354c1e5 100644
--- a/srcpkgs/qemu/patches/musl-initialize-msghdr.patch
+++ b/srcpkgs/qemu/patches/musl-initialize-msghdr.patch
@@ -1,10 +1,10 @@
 Source: https://github.com/void-linux/void-packages/issues/23557
 
-diff --git linux-user/syscall.c linux-user/syscall.c
-index 945fc25..8d8b68a 100644
+diff --git a/linux-user/syscall.c b/linux-user/syscall.c
+index 14fdebd..de280af 100644
 --- a/linux-user/syscall.c
 +++ b/linux-user/syscall.c
-@@ -3071,7 +3071,7 @@ static abi_long do_sendrecvmsg_locked(int fd, struct target_msghdr *msgp,
+@@ -3229,7 +3229,7 @@ static abi_long do_sendrecvmsg_locked(int fd, struct target_msghdr *msgp,
                                        int flags, int send)
  {
      abi_long ret, len;
diff --git a/srcpkgs/qemu/patches/musl-ppc.patch b/srcpkgs/qemu/patches/musl-ppc.patch
deleted file mode 100644
index 0b77aa8fc63d4..0000000000000
--- a/srcpkgs/qemu/patches/musl-ppc.patch
+++ /dev/null
@@ -1,25 +0,0 @@
---- a/linux-user/signal.c
-+++ b/linux-user/signal.c
-@@ -21,5 +21,9 @@
- #include "exec/gdbstub.h"
- #include "hw/core/tcg-cpu-ops.h"
- 
-+#if defined(_ARCH_PPC64) && !defined(__GLIBC__) /* musl */
-+#include <asm/ptrace.h>
-+#endif
-+
- #include <sys/ucontext.h>
- #include <sys/resource.h>
---- a/util/mmap-alloc.c
-+++ b/util/mmap-alloc.c
-@@ -25,6 +25,10 @@
- 
- #ifdef CONFIG_LINUX
- #include <sys/vfs.h>
-+/* musl undefs this on ppc and mips */
-+#ifndef MAP_SYNC
-+#define MAP_SYNC 0x80000
-+#endif
- #endif
- 
- size_t qemu_fd_getpagesize(int fd)
diff --git a/srcpkgs/qemu/patches/musl-rlimit-rttime.patch b/srcpkgs/qemu/patches/musl-rlimit-rttime.patch
deleted file mode 100644
index 0cbf9be36a8f1..0000000000000
--- a/srcpkgs/qemu/patches/musl-rlimit-rttime.patch
+++ /dev/null
@@ -1,13 +0,0 @@
---- a/linux-user/syscall.c
-+++ b/linux-user/syscall.c
-@@ -141,6 +141,10 @@
- #include "fd-trans.h"
- #include "tcg/tcg.h"
- 
-+#ifndef RLIMIT_RTTIME
-+#define RLIMIT_RTTIME 15
-+#endif
-+
- #ifndef CLONE_IO
- #define CLONE_IO                0x80000000      /* Clone io context */
- #endif
diff --git a/srcpkgs/qemu/patches/tricore_feature.patch b/srcpkgs/qemu/patches/tricore_feature.patch
deleted file mode 100644
index f7f621f81170b..0000000000000
--- a/srcpkgs/qemu/patches/tricore_feature.patch
+++ /dev/null
@@ -1,60 +0,0 @@
-capstone 5 declares this struct, so we need a different name
---
-diff --git a/target/tricore/cpu.c b/target/tricore/cpu.c
-index d0a9272..6297af9 100644
---- a/target/tricore/cpu.c
-+++ b/target/tricore/cpu.c
-@@ -103,14 +103,14 @@ static void tricore_cpu_realizefn(DeviceState *dev, Error **errp)
-     }
- 
-     /* Some features automatically imply others */
--    if (tricore_feature(env, TRICORE_FEATURE_161)) {
-+    if (tricore_feature_x(env, TRICORE_FEATURE_161)) {
-         set_feature(env, TRICORE_FEATURE_16);
-     }
- 
--    if (tricore_feature(env, TRICORE_FEATURE_16)) {
-+    if (tricore_feature_x(env, TRICORE_FEATURE_16)) {
-         set_feature(env, TRICORE_FEATURE_131);
-     }
--    if (tricore_feature(env, TRICORE_FEATURE_131)) {
-+    if (tricore_feature_x(env, TRICORE_FEATURE_131)) {
-         set_feature(env, TRICORE_FEATURE_13);
-     }
-     cpu_reset(cs);
-diff --git a/target/tricore/cpu.h b/target/tricore/cpu.h
-index 47d0ffb..6fd447c 100644
---- a/target/tricore/cpu.h
-+++ b/target/tricore/cpu.h
-@@ -258,7 +258,7 @@ enum tricore_features {
-     TRICORE_FEATURE_161,
- };
- 
--static inline int tricore_feature(CPUTriCoreState *env, int feature)
-+static inline int tricore_feature_x(CPUTriCoreState *env, int feature)
- {
-     return (env->features & (1ULL << feature)) != 0;
- }
-diff --git a/target/tricore/op_helper.c b/target/tricore/op_helper.c
-index 532ae6b..6a71b5b 100644
---- a/target/tricore/op_helper.c
-+++ b/target/tricore/op_helper.c
-@@ -2528,7 +2528,7 @@ void helper_ret(CPUTriCoreState *env)
-     /* PCXI = new_PCXI; */
-     env->PCXI = new_PCXI;
- 
--    if (tricore_feature(env, TRICORE_FEATURE_13)) {
-+    if (tricore_feature_x(env, TRICORE_FEATURE_13)) {
-         /* PSW = new_PSW */
-         psw_write(env, new_PSW);
-     } else {
-@@ -2639,7 +2639,7 @@ void helper_rfm(CPUTriCoreState *env)
-     env->gpr_a[10] = cpu_ldl_data(env, env->DCX+8);
-     env->gpr_a[11] = cpu_ldl_data(env, env->DCX+12);
- 
--    if (tricore_feature(env, TRICORE_FEATURE_131)) {
-+    if (tricore_feature_x(env, TRICORE_FEATURE_131)) {
-         env->DBGTCR = 0;
-     }
- }
-
diff --git a/srcpkgs/qemu/patches/xxx-ppcle.patch b/srcpkgs/qemu/patches/xxx-ppcle.patch
deleted file mode 100644
index 90b32b5e07cd8..0000000000000
--- a/srcpkgs/qemu/patches/xxx-ppcle.patch
+++ /dev/null
@@ -1,113 +0,0 @@
-From 7ece08d7902d5a8c007deeb0b75cb533a41dd882 Mon Sep 17 00:00:00 2001
-From: Daniel Kolesa <daniel@octaforge.org>
-Date: Sun, 7 Mar 2021 01:47:42 +0100
-Subject: [PATCH] support ppcle architecture
-
----
- configure                            | 14 ++++++++++++--
- configs/targets/ppcle-linux-user.mak |  4 ++++
- linux-user/ppc/target_syscall.h      |  4 ++++
- scripts/qemu-binfmt-conf.sh          |  6 +++++-
- tests/tcg/configure.sh               |  2 ++
- 5 files changed, 27 insertions(+), 3 deletions(-)
- create mode 100644 configs/targets/ppcle-linux-user.mak
-
-diff --git a/configure b/configure
-index 18c26e0..03d3e18 100755
---- a/configure
-+++ b/configure
-@@ -653,7 +653,11 @@ elif check_define _ARCH_PPC ; then
-       cpu="ppc64"
-     fi
-   else
--    cpu="ppc"
-+    if check_define _LITTLE_ENDIAN ; then
-+      cpu="ppcle"
-+    else
-+      cpu="ppc"
-+    fi
-   fi
- elif check_define __mips__ ; then
-   cpu="mips"
-@@ -638,6 +642,9 @@
- 
-   ppc)
-     CPU_CFLAGS="-m32" ;;
-+  ppcle)
-+    cpu="ppc"
-+    CPU_CFLAGS="-m32 -mlittle-endian" ;;
-   ppc64)
-     CPU_CFLAGS="-m64 -mbig-endian" ;;
-   ppc64le)
-diff --git a/configs/targets/ppcle-linux-user.mak b/configs/targets/ppcle-linux-user.mak
-new file mode 100644
-index 0000000..2259243
---- /dev/null
-+++ b/configs/targets/ppcle-linux-user.mak
-@@ -0,0 +1,4 @@
-+TARGET_ARCH=ppc
-+TARGET_SYSTBL_ABI=common,nospu,32
-+TARGET_SYSTBL=syscall.tbl
-+TARGET_XML_FILES= gdb-xml/power-core.xml gdb-xml/power-fpu.xml gdb-xml/power-altivec.xml gdb-xml/power-spe.xml
-diff --git a/linux-user/ppc/target_syscall.h b/linux-user/ppc/target_syscall.h
-index b9c4b81..cf26497 100644
---- a/linux-user/ppc/target_syscall.h
-+++ b/linux-user/ppc/target_syscall.h
-@@ -65,7 +65,11 @@ struct target_revectored_struct {
- #define UNAME_MACHINE "ppc64le"
- #endif
- #else
-+#if TARGET_BIG_ENDIAN
- #define UNAME_MACHINE "ppc"
-+#else
-+#define UNAME_MACHINE "ppcle"
-+#endif
- #endif
- #define UNAME_MINIMUM_RELEASE "2.6.32"
- 
-diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh
-index 9f1580a..393943f 100755
---- a/scripts/qemu-binfmt-conf.sh
-+++ b/scripts/qemu-binfmt-conf.sh
-@@ -46,6 +46,10 @@ ppc_magic='\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x
- ppc_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
- ppc_family=ppc
- 
-+ppcle_magic='\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x14\x00'
-+ppcle_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\x00'
-+ppc_family=ppcle
-+
- ppc64_magic='\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x15'
- ppc64_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
- ppc64_family=ppc
-@@ -148,7 +152,7 @@ qemu_get_family() {
-     "Power Macintosh"|ppc64|powerpc|ppc)
-         echo "ppc"
-         ;;
--    ppc64el|ppc64le)
-+    ppc64el|ppc64le|ppcel|ppcle)
-         echo "ppcle"
-         ;;
-     arm|armel|armhf|arm64|armv[4-9]*l|aarch64)
-diff --git a/configure b/configure
-index 72ab03f11a..0691929d76 100755
---- a/configure
-+++ b/configure
-@@ -1866,6 +1866,7 @@ fi
- : ${cross_prefix_mips="mips-linux-gnu-"}
- : ${cross_prefix_nios2="nios2-linux-gnu-"}
- : ${cross_prefix_ppc="powerpc-linux-gnu-"}
-+: ${cross_prefix_ppcle="powerpcle-linux-gnu-"}
- : ${cross_prefix_ppc64="powerpc64-linux-gnu-"}
- : ${cross_prefix_ppc64le="$cross_prefix_ppc64"}
- : ${cross_prefix_riscv64="riscv64-linux-gnu-"}
-@@ -1883,6 +1884,7 @@ fi
- : ${cross_cc_cflags_hexagon="-mv67 -O2 -static"}
- : ${cross_cc_cflags_i386="-m32"}
- : ${cross_cc_cflags_ppc="-m32 -mbig-endian"}
-+: ${cross_cc_cflags_ppcle="-m32"}
- : ${cross_cc_cflags_ppc64="-m64 -mbig-endian"}
- : ${cross_cc_ppc64le="$cross_cc_ppc64"}
- : ${cross_cc_cflags_ppc64le="-m64 -mlittle-endian"}
-2.30.1
-
diff --git a/srcpkgs/qemu/template b/srcpkgs/qemu/template
index 9793e2f6101a7..d709d264e92db 100644
--- a/srcpkgs/qemu/template
+++ b/srcpkgs/qemu/template
@@ -1,8 +1,8 @@
 # Template file for 'qemu'
 # This package should be updated together with qemu-user-static
 pkgname=qemu
-version=7.1.0
-revision=3
+version=8.1.0
+revision=1
 build_style=configure
 configure_args="--prefix=/usr --sysconfdir=/etc --libexecdir=/usr/libexec --localstatedir=/var
  --disable-glusterfs --disable-xen --enable-docs --enable-kvm --enable-libusb --enable-pie
@@ -10,10 +10,10 @@ configure_args="--prefix=/usr --sysconfdir=/etc --libexecdir=/usr/libexec --loca
  --audio-drv-list=alsa$(vopt_if sdl2 ,sdl)$(vopt_if jack ,jack)$(vopt_if pulseaudio ,pa)
  $(vopt_enable opengl) $(vopt_enable pulseaudio pa) $(vopt_enable sdl2 sdl) $(vopt_enable smartcard)
  $(vopt_enable spice) $(vopt_enable virgl virglrenderer) $(vopt_if gtk3 '--enable-gtk')"
-hostmakedepends="gettext pkg-config perl python3 python3-Sphinx python3-sphinx_rtd_theme ninja"
+hostmakedepends="flex glib-devel gettext pkg-config perl python3 python3-Sphinx python3-sphinx_rtd_theme ninja"
 makedepends="capstone-devel dtc-devel libpng-devel libjpeg-turbo-devel pixman-devel
  snappy-devel libuuid-devel libX11-devel alsa-lib-devel libaio-devel gnutls-devel
- libsasl-devel libglib-devel ncurses-devel libseccomp-devel nss-devel
+ libsasl-devel ncurses-devel libseccomp-devel nss-devel
  libcurl-devel xfsprogs-devel libcap-ng-devel vde2-devel usbredir-devel
  libbluetooth-devel libssh2-devel libusb-devel libnfs-devel libslirp-devel
  libxkbcommon-devel libzstd-devel $(vopt_if sdl2 'SDL2-devel SDL2_image-devel')
@@ -25,18 +25,18 @@ makedepends="capstone-devel dtc-devel libpng-devel libjpeg-turbo-devel pixman-de
  $(vopt_if jack 'jack-devel') $(vopt_if pulseaudio 'pulseaudio-devel')"
 short_desc="Open Source Processor Emulator"
 maintainer="Orphaned <orphan@voidlinux.org>"
-license="GPL-2.0-or-later, LGPL-2.1-or-later"
+license="GPL-2.0-only, LGPL-2.1-only"
 homepage="https://www.qemu.org"
 distfiles="https://wiki.qemu.org/download/qemu-${version}.tar.bz2"
-checksum=f7ac2b85b3f1831e6810b140306e30af91556e15784864b209f3942858947fd0
+checksum=53a2388f4f67d03e94ed7fe192d8828e64c535fadf7bf9dd0bc1d2091eedf624
 ignore_elf_dirs="/usr/share/qemu"
 nostrip_files="hppa-firmware.img openbios-ppc openbios-sparc32 openbios-sparc64
  palcode-clipper s390-ccw.img s390-netboot.img u-boot.e500 opensbi-riscv32-generic-fw_dynamic.elf
  opensbi-riscv64-generic-fw_dynamic.elf"
-make_check=no # capstone5.0: fails 90/95 qemu:unit / test-vmstate (when updating the qemu package this should go away)
+make_check=yes
 
-build_options="gtk3 opengl sdl2 spice virgl smartcard numa iscsi jack pulseaudio"
-build_options_default="opengl gtk3 virgl sdl2 numa iscsi jack pulseaudio"
+build_options="gtk3 iscsi jack numa opengl pulseaudio sdl2 smartcard spice virgl"
+build_options_default="gtk3 iscsi jack numa opengl pulseaudio sdl2 smartcard spice virgl"
 desc_option_sdl2="Enable SDL (2.x) video output"
 desc_option_spice="Enable support for SPICE"
 desc_option_virgl="Enable support for VirGL (A Virtual 3D GPU renderer)"
@@ -44,33 +44,10 @@ desc_option_smartcard="Enable smartcard support"
 desc_option_numa="Enable support for host NUMA"
 desc_option_iscsi="Enable support for iSCSI"
 
-case "$XBPS_TARGET_MACHINE" in
-	aarch64-musl) CFLAGS="-D_LINUX_SYSINFO_H";;
-esac
-
-if [ "$XBPS_TARGET_ENDIAN" = "le" ]; then
-	build_options_default+=" spice"
-fi
-
 if [ "$CROSS_BUILD" ]; then
 	configure_args+=" --cross-prefix=${XBPS_CROSS_TRIPLET}-"
-else
-	build_options_default+=" smartcard"
 fi
 
-post_extract() {
-	if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
-		grep -rl 'Input/output error' tests/qemu-iotests |
-			xargs -n1 sed -i -e 's;Input/output error;I/O error;g'
-		grep -rl 'Operation not supported' tests/qemu-iotests |
-			xargs -n1 sed -i -e 's;Operation not supported;Not supported;g'
-	fi
-}
-
-pre_configure() {
-	unset CPP
-}
-
 post_install() {
 	vdoc "${FILESDIR}/README.voidlinux"
 

From 4a0d8b14115b8e7d8173a3b22675d2b01ddc85eb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Cerqueira?= <acerqueira021@gmail.com>
Date: Sun, 17 Sep 2023 11:21:18 +0100
Subject: [PATCH 2/2] qemu-user-static: update to 8.1.0.

---
 srcpkgs/qemu-user-static/template | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/srcpkgs/qemu-user-static/template b/srcpkgs/qemu-user-static/template
index 2a8da9b53f2d5..504ec5417c94e 100644
--- a/srcpkgs/qemu-user-static/template
+++ b/srcpkgs/qemu-user-static/template
@@ -1,20 +1,20 @@
 # Template file for 'qemu-user-static'
 # This package should be updated together with qemu
 pkgname=qemu-user-static
-version=7.1.0
-revision=3
+version=8.1.0
+revision=1
 build_style=configure
 configure_args="--prefix=/usr --sysconfdir=/etc --libexecdir=/usr/libexec
  --disable-kvm --disable-png --disable-virtfs --disable-fdt --disable-seccomp
  --enable-linux-user --disable-system --static --disable-pie"
-hostmakedepends="pkg-config perl python3 ninja"
-makedepends="dtc-devel libglib-devel pixman-devel libuuid-devel"
+hostmakedepends="flex glib-devel pkg-config perl python3 ninja"
+makedepends="dtc-devel glib-devel pixman-devel libuuid-devel"
 short_desc="QEMU User-mode emulators (statically compiled)"
 maintainer="Orphaned <orphan@voidlinux.org>"
-license="GPL-2.0-or-later, LGPL-2.1-or-later"
+license="GPL-2.0-only, LGPL-2.1-only"
 homepage="https://www.qemu.org"
 distfiles="https://wiki.qemu.org/download/qemu-${version}.tar.bz2"
-checksum=f7ac2b85b3f1831e6810b140306e30af91556e15784864b209f3942858947fd0
+checksum=53a2388f4f67d03e94ed7fe192d8828e64c535fadf7bf9dd0bc1d2091eedf624
 
 _fmts="aarch64 aarch64_be alpha arm armeb cris hppa i386 m68k microblaze
  microblazeel mips mipsel mips64 mips64el mipsn32 mipsn32el or1k
@@ -111,10 +111,6 @@ done
 
 binfmts="${binfmts%?}"
 
-pre_configure() {
-	unset CPP
-}
-
 post_install() {
 	# Remove unneeded stuff.
 	rm -rf ${DESTDIR}/etc ${DESTDIR}/usr/share ${DESTDIR}/usr/libexec

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [PR PATCH] [Updated] qemu: update to 8.1.0.
  2023-07-03 17:50 [PR PATCH] qemu: update to 8.0.2 motorto
                   ` (35 preceding siblings ...)
  2023-09-17 10:30 ` motorto
@ 2023-09-17 13:58 ` motorto
  2023-09-24  7:10 ` AnErrupTion
  2023-09-26 16:28 ` [PR PATCH] [Merged]: " classabbyamp
  38 siblings, 0 replies; 40+ messages in thread
From: motorto @ 2023-09-17 13:58 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1870 bytes --]

There is an updated pull request by motorto against master on the void-packages repository

https://github.com/motorto/void-packages qemu-8.0.2
https://github.com/void-linux/void-packages/pull/44822

qemu: update to 8.1.0.
<!-- Uncomment relevant sections and delete options which are not applicable -->
[ci-skip] 

Draft because of: https://github.com/void-linux/void-packages/pull/44822#issuecomment-1633611714


#### Testing the changes
- I tested the changes in this PR: **YES**, runned a Windows vm machine and it worked fine. 
**DIDN'T Test the qemu-user-static**

Removed a bunch of patches that in my research are no longer needed:

- Removed all ppc related patches since that arch isn't no longer supported.
- gcc12.patch: because it builds fine now in this version
- fix-softfloat-fesetround.patch: don't have a system to try it, but alpine doesn't have any patch related to this)
- mmap-mremap-efaul: not sure about if we should keep this one

Kept this patches:

- musl-initialize-msghdr.patch: just update in order to apply.

Added this ones:

- ~~CVE-2023-2861.patch~~
- ~~keymap.patch: xkeyboard-config 2.39 removed the legacy alias of ar -> ara~~
- ~~fix-brk0.patch: make sure that initial brk(0) is page-aligned~~
- lfs64.patch: Builds defines -D_FILE_OFFSET_BITS=64 which makes the original functions
anf macros behave same as their 64 suffixed counterparts. This also
helps in compiling with latest musl C library, where these macros and
functions are no more available under _GNU_SOURCE feature macro

#### Local build testing
- I built this PR locally for my native architecture, x86-64-glibc
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl (cross)
  - x86_64-musl



A patch file from https://github.com/void-linux/void-packages/pull/44822.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-qemu-8.0.2-44822.patch --]
[-- Type: text/x-diff, Size: 36636 bytes --]

From f56d7adaacb102d686d4e7633f39eefd977d6eac Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Cerqueira?= <acerqueira021@gmail.com>
Date: Fri, 15 Sep 2023 23:38:32 +0100
Subject: [PATCH 1/2] qemu: update to 8.1.0.

---
 .../qemu/patches/fix-linux-user-ppc32.patch   | 117 ----------
 .../patches/fix-softfloat-fesetround.patch    |  39 ----
 srcpkgs/qemu/patches/gcc12.patch              |  72 ------
 srcpkgs/qemu/patches/lfs64.patch              | 211 ++++++++++++++++++
 srcpkgs/qemu/patches/mmap-mremap-efault.patch |  42 ----
 .../qemu/patches/musl-initialize-msghdr.patch |   6 +-
 srcpkgs/qemu/patches/musl-ppc.patch           |  25 ---
 srcpkgs/qemu/patches/musl-rlimit-rttime.patch |  13 --
 srcpkgs/qemu/patches/tricore_feature.patch    |  60 -----
 srcpkgs/qemu/patches/xxx-ppcle.patch          | 113 ----------
 srcpkgs/qemu/template                         |  40 +---
 11 files changed, 222 insertions(+), 516 deletions(-)
 delete mode 100644 srcpkgs/qemu/patches/fix-linux-user-ppc32.patch
 delete mode 100644 srcpkgs/qemu/patches/fix-softfloat-fesetround.patch
 delete mode 100644 srcpkgs/qemu/patches/gcc12.patch
 create mode 100644 srcpkgs/qemu/patches/lfs64.patch
 delete mode 100644 srcpkgs/qemu/patches/mmap-mremap-efault.patch
 delete mode 100644 srcpkgs/qemu/patches/musl-ppc.patch
 delete mode 100644 srcpkgs/qemu/patches/musl-rlimit-rttime.patch
 delete mode 100644 srcpkgs/qemu/patches/tricore_feature.patch
 delete mode 100644 srcpkgs/qemu/patches/xxx-ppcle.patch

diff --git a/srcpkgs/qemu/patches/fix-linux-user-ppc32.patch b/srcpkgs/qemu/patches/fix-linux-user-ppc32.patch
deleted file mode 100644
index cd47435d5aa9a..0000000000000
--- a/srcpkgs/qemu/patches/fix-linux-user-ppc32.patch
+++ /dev/null
@@ -1,117 +0,0 @@
-commit 37814f62c2cc7aba2eea073014d6c53dcd5bf42c
-Author: q66 <daniel@octaforge.org>
-Date:   Fri Jul 1 16:53:55 2022 +0200
-
-    fix linux-user build on 32-bit ppc
-    
-    Partial revert https://gitlab.com/qemu-project/qemu/-/commit/9d1401b79463e74adbfac69d836789d4e103fb61
-    and https://gitlab.com/qemu-project/qemu/-/commit/0a7e01904d407baa73c1baddbdfc9ccf2ace8356
-
-diff --git a/common-user/host/ppc/safe-syscall.inc.S b/common-user/host/ppc/safe-syscall.inc.S
-new file mode 100644
-index 0000000..e69de29
-diff --git a/common-user/safe-syscall-error.c b/common-user/safe-syscall-error.c
-index cf74b50..a36132c 100644
---- a/common-user/safe-syscall-error.c
-+++ b/common-user/safe-syscall-error.c
-@@ -12,6 +12,7 @@
- #include "qemu/osdep.h"
- #include "user/safe-syscall.h"
- 
-+#if !defined(__powerpc__) || defined(__powerpc64__)
- /*
-  * This is intended to be invoked via tail-call on the error path
-  * from the assembly in host/arch/safe-syscall.inc.S.  This takes
-@@ -23,3 +24,4 @@ long safe_syscall_set_errno_tail(int value)
-     errno = value;
-     return -1;
- }
-+#endif
-diff --git a/include/user/safe-syscall.h b/include/user/safe-syscall.h
-index 61a04e2..793fe84 100644
---- a/include/user/safe-syscall.h
-+++ b/include/user/safe-syscall.h
-@@ -125,6 +125,8 @@
-  * kinds of restartability.
-  */
- 
-+#if !defined(__powerpc__) || defined(__powerpc64__)
-+
- /* The core part of this function is implemented in assembly */
- extern long safe_syscall_base(int *pending, long number, ...);
- extern long safe_syscall_set_errno_tail(int value);
-@@ -137,4 +139,10 @@ extern char safe_syscall_end[];
-     safe_syscall_base(&((TaskState *)thread_cpu->opaque)->signal_pending, \
-                       __VA_ARGS__)
- 
-+#else
-+
-+#define safe_syscall syscall
-+
-+#endif
-+
- #endif
-diff --git a/linux-user/include/host/ppc/host-signal.h b/linux-user/include/host/ppc/host-signal.h
-new file mode 100644
-index 0000000..b80384d
---- /dev/null
-+++ b/linux-user/include/host/ppc/host-signal.h
-@@ -0,0 +1,38 @@
-+/*
-+ * host-signal.h: signal info dependent on the host architecture
-+ *
-+ * Copyright (c) 2003-2005 Fabrice Bellard
-+ * Copyright (c) 2021 Linaro Limited
-+ *
-+ * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
-+ * See the COPYING file in the top-level directory.
-+ */
-+
-+#ifndef PPC_HOST_SIGNAL_H
-+#define PPC_HOST_SIGNAL_H
-+
-+/* The third argument to a SA_SIGINFO handler is ucontext_t. */
-+typedef ucontext_t host_sigcontext;
-+
-+static inline uintptr_t host_signal_pc(host_sigcontext *uc)
-+{
-+    return uc->uc_mcontext.regs->nip;
-+}
-+
-+static inline void host_signal_set_pc(host_sigcontext *uc, uintptr_t pc)
-+{
-+    uc->uc_mcontext.regs->nip = pc;
-+}
-+
-+static inline void *host_signal_mask(host_sigcontext *uc)
-+{
-+    return &uc->uc_sigmask;
-+}
-+
-+static inline bool host_signal_write(siginfo_t *info, host_sigcontext *uc)
-+{
-+    return uc->uc_mcontext.regs->trap != 0x400
-+        && (uc->uc_mcontext.regs->dsisr & 0x02000000);
-+}
-+
-+#endif
-diff --git a/linux-user/signal.c b/linux-user/signal.c
-index 092e70b..b8dfa8a 100644
---- a/linux-user/signal.c
-+++ b/linux-user/signal.c
-@@ -800,6 +800,7 @@ void queue_signal(CPUArchState *env, int sig, int si_type,
- /* Adjust the signal context to rewind out of safe-syscall if we're in it */
- static inline void rewind_if_in_safe_syscall(void *puc)
- {
-+#if !defined(__powerpc__) || defined(__powerpc64__)
-     host_sigcontext *uc = (host_sigcontext *)puc;
-     uintptr_t pcreg = host_signal_pc(uc);
- 
-@@ -807,6 +808,7 @@ static inline void rewind_if_in_safe_syscall(void *puc)
-         && pcreg < (uintptr_t)safe_syscall_end) {
-         host_signal_set_pc(uc, (uintptr_t)safe_syscall_start);
-     }
-+#endif
- }
- 
- static void host_signal_handler(int host_sig, siginfo_t *info, void *puc)
diff --git a/srcpkgs/qemu/patches/fix-softfloat-fesetround.patch b/srcpkgs/qemu/patches/fix-softfloat-fesetround.patch
deleted file mode 100644
index ecdd049f79212..0000000000000
--- a/srcpkgs/qemu/patches/fix-softfloat-fesetround.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-Source: @pullmoll
-Upstream: no
-Reason: Target architectures with soft float do not define these constants.
-
---- a/tests/fp/fp-bench.c	2020-12-08 17:59:44.000000000 +0100
-+++ b/tests/fp/fp-bench.c	2020-12-12 20:38:40.702235420 +0100
-@@ -485,16 +485,32 @@
- 
-     switch (rounding) {
-     case ROUND_EVEN:
-+#if defined(FE_TONEAREST)
-         rhost = FE_TONEAREST;
-+#else
-+	return;
-+#endif
-         break;
-     case ROUND_ZERO:
-+#if defined(FE_TOWARDZERO)
-         rhost = FE_TOWARDZERO;
-+#else
-+	return;
-+#endif
-         break;
-     case ROUND_DOWN:
-+#if defined(FE_DOWNWARD)
-         rhost = FE_DOWNWARD;
-+#else
-+	return;
-+#endif
-         break;
-     case ROUND_UP:
-+#if defined(FE_UPWARD)
-         rhost = FE_UPWARD;
-+#else
-+	return;
-+#endif
-         break;
-     case ROUND_TIEAWAY:
-         die_host_rounding(rounding);
diff --git a/srcpkgs/qemu/patches/gcc12.patch b/srcpkgs/qemu/patches/gcc12.patch
deleted file mode 100644
index 2a4b2bd036096..0000000000000
--- a/srcpkgs/qemu/patches/gcc12.patch
+++ /dev/null
@@ -1,72 +0,0 @@
-From 5cb993ff131fca2abef3ce074a20258fd6fce557 Mon Sep 17 00:00:00 2001
-From: Bernhard Beschow <shentey@gmail.com>
-Date: Sat, 18 Mar 2023 19:59:31 +0100
-Subject: [PATCH] qemu/osdep: Switch position of "extern" and "G_NORETURN"
-
-Fixes the Windows build under msys2 using GCC 12 which fails with the following
-error:
-
-  [184/579] Compiling C++ object qga/vss-win32/qga-vss.dll.p/install.cpp.obj
-  FAILED: qga/vss-win32/qga-vss.dll.p/install.cpp.obj
-  "c++" "-m64" "-mcx16" "-Iqga/vss-win32/qga-vss.dll.p" "-Iqga/vss-win32" "-I../src/qga/vss-win32" "-I." "-Iqapi" "-Itrace" "-Iui" "-Iui/shader" "-IC:/msys64/mingw64/include/glib-2.0" "-IC:/msys64/mingw64/lib/glib-2.0/include" "-fdiagnostics-color=auto" "-Wall" "-Winvalid-pch" "-Wnon-virtual-dtor" "-Werror" "-std=gnu++11" "-g" "-iquote" "." "-iquote" "C:/msys64/home/shentey/Projects/qemu/src" "-iquote" "C:/msys64/home/shentey/Projects/qemu/src/include" "-iquote" "C:/msys64/home/shentey/Projects/qemu/src/tcg/i386" "-D__STDC_LIMIT_MACROS" "-D__STDC_CONSTANT_MACROS" "-D__STDC_FORMAT_MACROS" "-fno-pie" "-no-pie" "-D_GNU_SOURCE" "-D_FILE_OFFSET_BITS=64" "-D_LARGEFILE_SOURCE" "-fno-strict-aliasing" "-fno-common" "-fwrapv" "-Wundef" "-Wwrite-strings" "-Wtype-limits" "-Wformat-security" "-Wformat-y2k" "-Winit-self" "-Wignored-qualifiers" "-Wempty-body" "-Wendif-labels" "-Wexpansion-to-defined" "-Wimplicit-fallthrough=2" "-Wmissing-format-attribute" "-Wno-missing-include-dirs" "-Wno-shift-negative-value" "-Wno-psabi" "-fstack-protector-strong" "-Wno-unknown-pragmas" "-Wno-delete-non-virtual-dtor" "-Wno-non-virtual-dtor" -MD -MQ qga/vss-win32/qga-vss.dll.p/install.cpp.obj -MF "qga/vss-win32/qga-vss.dll.p/install.cpp.obj.d" -o qga/vss-win32/qga-vss.dll.p/install.cpp.obj "-c" ../src/qga/vss-win32/install.cpp
-  In file included from C:/msys64/mingw64/lib/glib-2.0/include/glibconfig.h:9,
-              from C:/msys64/mingw64/include/glib-2.0/glib/gtypes.h:34,
-              from C:/msys64/mingw64/include/glib-2.0/glib/galloca.h:34,
-              from C:/msys64/mingw64/include/glib-2.0/glib.h:32,
-              from C:/msys64/home/shentey/Projects/qemu/src/include/glib-compat.h:32,
-              from C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:144,
-              from ../src/qga/vss-win32/install.cpp:13:
-  C:/msys64/mingw64/include/glib-2.0/glib/gmacros.h:1075:21: error: standard attributes in middle of decl-specifiers
-  1075 | # define G_NORETURN [[noreturn]]
-        |                     ^
-  C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:240:8: note: in expansion of macro 'G_NORETURN'
-  240 | extern G_NORETURN
-        |        ^~~~~~~~~~
-  C:/msys64/mingw64/include/glib-2.0/glib/gmacros.h:1075:21: note: standard attributes must precede the decl-specifiers to apply to the declaration, or follow them to apply to the type
-  1075 | # define G_NORETURN [[noreturn]]
-        |                     ^
-  C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:240:8: note: in expansion of macro 'G_NORETURN'
-  240 | extern G_NORETURN
-        |        ^~~~~~~~~~
-  C:/msys64/mingw64/include/glib-2.0/glib/gmacros.h:1075:21: error: attribute ignored [-Werror=attributes]
-  1075 | # define G_NORETURN [[noreturn]]
-        |                     ^
-  C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:240:8: note: in expansion of macro 'G_NORETURN'
-  240 | extern G_NORETURN
-        |        ^~~~~~~~~~
-  C:/msys64/mingw64/include/glib-2.0/glib/gmacros.h:1075:21: note: an attribute that appertains to a type-specifier is ignored
-  1075 | # define G_NORETURN [[noreturn]]
-        |                     ^
-  C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:240:8: note: in expansion of macro 'G_NORETURN'
-  240 | extern G_NORETURN
-        |        ^~~~~~~~~~
-  cc1plus.exe: all warnings being treated as errors
-
-Apparently it also fixes the compilation with Clang 15 (see
-https://gitlab.com/qemu-project/qemu/-/issues/1541 ).
-
-Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1541
-Signed-off-by: Bernhard Beschow <shentey@gmail.com>
-Message-Id: <20230318185931.181659-1-shentey@gmail.com>
-Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
-Signed-off-by: Thomas Huth <thuth@redhat.com>
----
- include/qemu/osdep.h | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
-index f68b5d8708c..9eff0be95bd 100644
---- a/include/qemu/osdep.h
-+++ b/include/qemu/osdep.h
-@@ -237,7 +237,7 @@ extern "C" {
-  * supports QEMU_ERROR, this will be reported at compile time; otherwise
-  * this will be reported at link time due to the missing symbol.
-  */
--extern G_NORETURN
-+G_NORETURN extern
- void QEMU_ERROR("code path is reachable")
-     qemu_build_not_reached_always(void);
- #if defined(__OPTIMIZE__) && !defined(__NO_INLINE__)
--- 
-GitLab
-
diff --git a/srcpkgs/qemu/patches/lfs64.patch b/srcpkgs/qemu/patches/lfs64.patch
new file mode 100644
index 0000000000000..d198ad2ba28ea
--- /dev/null
+++ b/srcpkgs/qemu/patches/lfs64.patch
@@ -0,0 +1,211 @@
+Builds defines -D_FILE_OFFSET_BITS=64 which makes the original functions
+anf macros behave same as their 64 suffixed counterparts. This also
+helps in compiling with latest musl C library, where these macros and
+functions are no more available under _GNU_SOURCE feature macro
+
+source: https://git.alpinelinux.org/aports/plain/community/qemu/lfs64.patch
+--
+diff --git a/linux-user/syscall.c b/linux-user/syscall.c
+index bbba2a6..38fa09a 100644
+--- a/linux-user/syscall.c
++++ b/linux-user/syscall.c
+@@ -6812,13 +6812,13 @@ static int target_to_host_fcntl_cmd(int cmd)
+         ret = cmd;
+         break;
+     case TARGET_F_GETLK:
+-        ret = F_GETLK64;
++        ret = F_GETLK;
+         break;
+     case TARGET_F_SETLK:
+-        ret = F_SETLK64;
++        ret = F_SETLK;
+         break;
+     case TARGET_F_SETLKW:
+-        ret = F_SETLKW64;
++        ret = F_SETLKW;
+         break;
+     case TARGET_F_GETOWN:
+         ret = F_GETOWN;
+@@ -6834,13 +6834,13 @@ static int target_to_host_fcntl_cmd(int cmd)
+         break;
+ #if TARGET_ABI_BITS == 32
+     case TARGET_F_GETLK64:
+-        ret = F_GETLK64;
++        ret = F_GETLK;
+         break;
+     case TARGET_F_SETLK64:
+-        ret = F_SETLK64;
++        ret = F_SETLK;
+         break;
+     case TARGET_F_SETLKW64:
+-        ret = F_SETLKW64;
++        ret = F_SETLKW;
+         break;
+ #endif
+     case TARGET_F_SETLEASE:
+@@ -6894,8 +6894,8 @@ static int target_to_host_fcntl_cmd(int cmd)
+      * them to 5, 6 and 7 before making the syscall(). Since we make the
+      * syscall directly, adjust to what is supported by the kernel.
+      */
+-    if (ret >= F_GETLK64 && ret <= F_SETLKW64) {
+-        ret -= F_GETLK64 - 5;
++    if (ret >= F_GETLK && ret <= F_SETLKW) {
++        ret -= F_GETLK - 5;
+     }
+ #endif
+ 
+@@ -6928,7 +6928,7 @@ static int host_to_target_flock(int type)
+     return type;
+ }
+ 
+-static inline abi_long copy_from_user_flock(struct flock64 *fl,
++static inline abi_long copy_from_user_flock(struct flock *fl,
+                                             abi_ulong target_flock_addr)
+ {
+     struct target_flock *target_fl;
+@@ -6953,7 +6953,7 @@ static inline abi_long copy_from_user_flock(struct flock64 *fl,
+ }
+ 
+ static inline abi_long copy_to_user_flock(abi_ulong target_flock_addr,
+-                                          const struct flock64 *fl)
++                                          const struct flock *fl)
+ {
+     struct target_flock *target_fl;
+     short l_type;
+@@ -6972,8 +6972,8 @@ static inline abi_long copy_to_user_flock(abi_ulong target_flock_addr,
+     return 0;
+ }
+ 
+-typedef abi_long from_flock64_fn(struct flock64 *fl, abi_ulong target_addr);
+-typedef abi_long to_flock64_fn(abi_ulong target_addr, const struct flock64 *fl);
++typedef abi_long from_flock64_fn(struct flock *fl, abi_ulong target_addr);
++typedef abi_long to_flock64_fn(abi_ulong target_addr, const struct flock *fl);
+ 
+ #if defined(TARGET_ARM) && TARGET_ABI_BITS == 32
+ struct target_oabi_flock64 {
+@@ -6984,7 +6984,7 @@ struct target_oabi_flock64 {
+     abi_int   l_pid;
+ } QEMU_PACKED;
+ 
+-static inline abi_long copy_from_user_oabi_flock64(struct flock64 *fl,
++static inline abi_long copy_from_user_oabi_flock64(struct flock *fl,
+                                                    abi_ulong target_flock_addr)
+ {
+     struct target_oabi_flock64 *target_fl;
+@@ -7009,7 +7009,7 @@ static inline abi_long copy_from_user_oabi_flock64(struct flock64 *fl,
+ }
+ 
+ static inline abi_long copy_to_user_oabi_flock64(abi_ulong target_flock_addr,
+-                                                 const struct flock64 *fl)
++                                                 const struct flock *fl)
+ {
+     struct target_oabi_flock64 *target_fl;
+     short l_type;
+@@ -7029,7 +7029,7 @@ static inline abi_long copy_to_user_oabi_flock64(abi_ulong target_flock_addr,
+ }
+ #endif
+ 
+-static inline abi_long copy_from_user_flock64(struct flock64 *fl,
++static inline abi_long copy_from_user_flock64(struct flock *fl,
+                                               abi_ulong target_flock_addr)
+ {
+     struct target_flock64 *target_fl;
+@@ -7054,7 +7054,7 @@ static inline abi_long copy_from_user_flock64(struct flock64 *fl,
+ }
+ 
+ static inline abi_long copy_to_user_flock64(abi_ulong target_flock_addr,
+-                                            const struct flock64 *fl)
++                                            const struct flock *fl)
+ {
+     struct target_flock64 *target_fl;
+     short l_type;
+@@ -7075,7 +7075,7 @@ static inline abi_long copy_to_user_flock64(abi_ulong target_flock_addr,
+ 
+ static abi_long do_fcntl(int fd, int cmd, abi_ulong arg)
+ {
+-    struct flock64 fl64;
++    struct flock fl64;
+ #ifdef F_GETOWN_EX
+     struct f_owner_ex fox;
+     struct target_f_owner_ex *target_fox;
+@@ -7347,7 +7347,7 @@ static inline abi_long target_truncate64(CPUArchState *cpu_env, const char *arg1
+         arg2 = arg3;
+         arg3 = arg4;
+     }
+-    return get_errno(truncate64(arg1, target_offset64(arg2, arg3)));
++    return get_errno(truncate(arg1, target_offset64(arg2, arg3)));
+ }
+ #endif
+ 
+@@ -7361,7 +7361,7 @@ static inline abi_long target_ftruncate64(CPUArchState *cpu_env, abi_long arg1,
+         arg2 = arg3;
+         arg3 = arg4;
+     }
+-    return get_errno(ftruncate64(arg1, target_offset64(arg2, arg3)));
++    return get_errno(ftruncate(arg1, target_offset64(arg2, arg3)));
+ }
+ #endif
+ 
+@@ -8597,7 +8597,7 @@ static int do_getdents(abi_long dirfd, abi_long arg2, abi_long count)
+     void *tdirp;
+     int hlen, hoff, toff;
+     int hreclen, treclen;
+-    off64_t prev_diroff = 0;
++    off_t prev_diroff = 0;
+ 
+     hdirp = g_try_malloc(count);
+     if (!hdirp) {
+@@ -8650,7 +8650,7 @@ static int do_getdents(abi_long dirfd, abi_long arg2, abi_long count)
+              * Return what we have, resetting the file pointer to the
+              * location of the first record not returned.
+              */
+-            lseek64(dirfd, prev_diroff, SEEK_SET);
++            lseek(dirfd, prev_diroff, SEEK_SET);
+             break;
+         }
+ 
+@@ -8684,7 +8684,7 @@ static int do_getdents64(abi_long dirfd, abi_long arg2, abi_long count)
+     void *tdirp;
+     int hlen, hoff, toff;
+     int hreclen, treclen;
+-    off64_t prev_diroff = 0;
++    off_t prev_diroff = 0;
+ 
+     hdirp = g_try_malloc(count);
+     if (!hdirp) {
+@@ -8726,7 +8726,7 @@ static int do_getdents64(abi_long dirfd, abi_long arg2, abi_long count)
+              * Return what we have, resetting the file pointer to the
+              * location of the first record not returned.
+              */
+-            lseek64(dirfd, prev_diroff, SEEK_SET);
++            lseek(dirfd, prev_diroff, SEEK_SET);
+             break;
+         }
+ 
+@@ -11157,7 +11157,7 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,
+                 return -TARGET_EFAULT;
+             }
+         }
+-        ret = get_errno(pread64(arg1, p, arg3, target_offset64(arg4, arg5)));
++        ret = get_errno(pread(arg1, p, arg3, target_offset64(arg4, arg5)));
+         unlock_user(p, arg2, ret);
+         return ret;
+     case TARGET_NR_pwrite64:
+@@ -11174,7 +11174,7 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,
+                 return -TARGET_EFAULT;
+             }
+         }
+-        ret = get_errno(pwrite64(arg1, p, arg3, target_offset64(arg4, arg5)));
++        ret = get_errno(pwrite(arg1, p, arg3, target_offset64(arg4, arg5)));
+         unlock_user(p, arg2, 0);
+         return ret;
+ #endif
+@@ -12034,7 +12034,7 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,
+     case TARGET_NR_fcntl64:
+     {
+         int cmd;
+-        struct flock64 fl;
++        struct flock fl;
+         from_flock64_fn *copyfrom = copy_from_user_flock64;
+         to_flock64_fn *copyto = copy_to_user_flock64;
+
diff --git a/srcpkgs/qemu/patches/mmap-mremap-efault.patch b/srcpkgs/qemu/patches/mmap-mremap-efault.patch
deleted file mode 100644
index 5a70e9658b300..0000000000000
--- a/srcpkgs/qemu/patches/mmap-mremap-efault.patch
+++ /dev/null
@@ -1,42 +0,0 @@
-Source: @pullmoll
-Upstream: no
-Reason: errno=EFAULT when the address passed to mremap(2) is not valid
-
-See Rich Felker's comment at https://www.openwall.com/lists/musl/2017/06/21/2 for
-why we need to return errno as described in man mremap(2) from qemu-user-static.
-Also speed up the loop when checking for increasing the mappings size to go
-in steps of TARGET_PAGE_SIZE and OR-in a check for the very last byte of the range.
-diff --git linux-user/mmap.c linux-user/mmap.c
-index 7e3b245..1e8d0f1 100644
---- a/linux-user/mmap.c
-+++ b/linux-user/mmap.c
-@@ -738,7 +738,7 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size,
-          !guest_range_valid_untagged(new_addr, new_size)) ||
-         ((flags & MREMAP_MAYMOVE) == 0 &&
-          !guest_range_valid_untagged(old_addr, new_size))) {
--        errno = ENOMEM;
-+        errno = EFAULT;
-         return -1;
-     }
- 
-@@ -775,9 +775,10 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size,
-             abi_ulong addr;
-             for (addr = old_addr + old_size;
-                  addr < old_addr + new_size;
--                 addr++) {
-+                 addr += TARGET_PAGE_SIZE) {
-                 prot |= page_get_flags(addr);
-             }
-+				prot |= page_get_flags(old_addr + new_size - 1);
-         }
-         if (prot == 0) {
-             host_addr = mremap(g2h_untagged(old_addr),
-@@ -796,7 +797,7 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size,
-                 }
-             }
-         } else {
--            errno = ENOMEM;
-+            errno = EFAULT;
-             host_addr = MAP_FAILED;
-         }
-     }
diff --git a/srcpkgs/qemu/patches/musl-initialize-msghdr.patch b/srcpkgs/qemu/patches/musl-initialize-msghdr.patch
index 6d96b3511dafe..a88547354c1e5 100644
--- a/srcpkgs/qemu/patches/musl-initialize-msghdr.patch
+++ b/srcpkgs/qemu/patches/musl-initialize-msghdr.patch
@@ -1,10 +1,10 @@
 Source: https://github.com/void-linux/void-packages/issues/23557
 
-diff --git linux-user/syscall.c linux-user/syscall.c
-index 945fc25..8d8b68a 100644
+diff --git a/linux-user/syscall.c b/linux-user/syscall.c
+index 14fdebd..de280af 100644
 --- a/linux-user/syscall.c
 +++ b/linux-user/syscall.c
-@@ -3071,7 +3071,7 @@ static abi_long do_sendrecvmsg_locked(int fd, struct target_msghdr *msgp,
+@@ -3229,7 +3229,7 @@ static abi_long do_sendrecvmsg_locked(int fd, struct target_msghdr *msgp,
                                        int flags, int send)
  {
      abi_long ret, len;
diff --git a/srcpkgs/qemu/patches/musl-ppc.patch b/srcpkgs/qemu/patches/musl-ppc.patch
deleted file mode 100644
index 0b77aa8fc63d4..0000000000000
--- a/srcpkgs/qemu/patches/musl-ppc.patch
+++ /dev/null
@@ -1,25 +0,0 @@
---- a/linux-user/signal.c
-+++ b/linux-user/signal.c
-@@ -21,5 +21,9 @@
- #include "exec/gdbstub.h"
- #include "hw/core/tcg-cpu-ops.h"
- 
-+#if defined(_ARCH_PPC64) && !defined(__GLIBC__) /* musl */
-+#include <asm/ptrace.h>
-+#endif
-+
- #include <sys/ucontext.h>
- #include <sys/resource.h>
---- a/util/mmap-alloc.c
-+++ b/util/mmap-alloc.c
-@@ -25,6 +25,10 @@
- 
- #ifdef CONFIG_LINUX
- #include <sys/vfs.h>
-+/* musl undefs this on ppc and mips */
-+#ifndef MAP_SYNC
-+#define MAP_SYNC 0x80000
-+#endif
- #endif
- 
- size_t qemu_fd_getpagesize(int fd)
diff --git a/srcpkgs/qemu/patches/musl-rlimit-rttime.patch b/srcpkgs/qemu/patches/musl-rlimit-rttime.patch
deleted file mode 100644
index 0cbf9be36a8f1..0000000000000
--- a/srcpkgs/qemu/patches/musl-rlimit-rttime.patch
+++ /dev/null
@@ -1,13 +0,0 @@
---- a/linux-user/syscall.c
-+++ b/linux-user/syscall.c
-@@ -141,6 +141,10 @@
- #include "fd-trans.h"
- #include "tcg/tcg.h"
- 
-+#ifndef RLIMIT_RTTIME
-+#define RLIMIT_RTTIME 15
-+#endif
-+
- #ifndef CLONE_IO
- #define CLONE_IO                0x80000000      /* Clone io context */
- #endif
diff --git a/srcpkgs/qemu/patches/tricore_feature.patch b/srcpkgs/qemu/patches/tricore_feature.patch
deleted file mode 100644
index f7f621f81170b..0000000000000
--- a/srcpkgs/qemu/patches/tricore_feature.patch
+++ /dev/null
@@ -1,60 +0,0 @@
-capstone 5 declares this struct, so we need a different name
---
-diff --git a/target/tricore/cpu.c b/target/tricore/cpu.c
-index d0a9272..6297af9 100644
---- a/target/tricore/cpu.c
-+++ b/target/tricore/cpu.c
-@@ -103,14 +103,14 @@ static void tricore_cpu_realizefn(DeviceState *dev, Error **errp)
-     }
- 
-     /* Some features automatically imply others */
--    if (tricore_feature(env, TRICORE_FEATURE_161)) {
-+    if (tricore_feature_x(env, TRICORE_FEATURE_161)) {
-         set_feature(env, TRICORE_FEATURE_16);
-     }
- 
--    if (tricore_feature(env, TRICORE_FEATURE_16)) {
-+    if (tricore_feature_x(env, TRICORE_FEATURE_16)) {
-         set_feature(env, TRICORE_FEATURE_131);
-     }
--    if (tricore_feature(env, TRICORE_FEATURE_131)) {
-+    if (tricore_feature_x(env, TRICORE_FEATURE_131)) {
-         set_feature(env, TRICORE_FEATURE_13);
-     }
-     cpu_reset(cs);
-diff --git a/target/tricore/cpu.h b/target/tricore/cpu.h
-index 47d0ffb..6fd447c 100644
---- a/target/tricore/cpu.h
-+++ b/target/tricore/cpu.h
-@@ -258,7 +258,7 @@ enum tricore_features {
-     TRICORE_FEATURE_161,
- };
- 
--static inline int tricore_feature(CPUTriCoreState *env, int feature)
-+static inline int tricore_feature_x(CPUTriCoreState *env, int feature)
- {
-     return (env->features & (1ULL << feature)) != 0;
- }
-diff --git a/target/tricore/op_helper.c b/target/tricore/op_helper.c
-index 532ae6b..6a71b5b 100644
---- a/target/tricore/op_helper.c
-+++ b/target/tricore/op_helper.c
-@@ -2528,7 +2528,7 @@ void helper_ret(CPUTriCoreState *env)
-     /* PCXI = new_PCXI; */
-     env->PCXI = new_PCXI;
- 
--    if (tricore_feature(env, TRICORE_FEATURE_13)) {
-+    if (tricore_feature_x(env, TRICORE_FEATURE_13)) {
-         /* PSW = new_PSW */
-         psw_write(env, new_PSW);
-     } else {
-@@ -2639,7 +2639,7 @@ void helper_rfm(CPUTriCoreState *env)
-     env->gpr_a[10] = cpu_ldl_data(env, env->DCX+8);
-     env->gpr_a[11] = cpu_ldl_data(env, env->DCX+12);
- 
--    if (tricore_feature(env, TRICORE_FEATURE_131)) {
-+    if (tricore_feature_x(env, TRICORE_FEATURE_131)) {
-         env->DBGTCR = 0;
-     }
- }
-
diff --git a/srcpkgs/qemu/patches/xxx-ppcle.patch b/srcpkgs/qemu/patches/xxx-ppcle.patch
deleted file mode 100644
index 90b32b5e07cd8..0000000000000
--- a/srcpkgs/qemu/patches/xxx-ppcle.patch
+++ /dev/null
@@ -1,113 +0,0 @@
-From 7ece08d7902d5a8c007deeb0b75cb533a41dd882 Mon Sep 17 00:00:00 2001
-From: Daniel Kolesa <daniel@octaforge.org>
-Date: Sun, 7 Mar 2021 01:47:42 +0100
-Subject: [PATCH] support ppcle architecture
-
----
- configure                            | 14 ++++++++++++--
- configs/targets/ppcle-linux-user.mak |  4 ++++
- linux-user/ppc/target_syscall.h      |  4 ++++
- scripts/qemu-binfmt-conf.sh          |  6 +++++-
- tests/tcg/configure.sh               |  2 ++
- 5 files changed, 27 insertions(+), 3 deletions(-)
- create mode 100644 configs/targets/ppcle-linux-user.mak
-
-diff --git a/configure b/configure
-index 18c26e0..03d3e18 100755
---- a/configure
-+++ b/configure
-@@ -653,7 +653,11 @@ elif check_define _ARCH_PPC ; then
-       cpu="ppc64"
-     fi
-   else
--    cpu="ppc"
-+    if check_define _LITTLE_ENDIAN ; then
-+      cpu="ppcle"
-+    else
-+      cpu="ppc"
-+    fi
-   fi
- elif check_define __mips__ ; then
-   cpu="mips"
-@@ -638,6 +642,9 @@
- 
-   ppc)
-     CPU_CFLAGS="-m32" ;;
-+  ppcle)
-+    cpu="ppc"
-+    CPU_CFLAGS="-m32 -mlittle-endian" ;;
-   ppc64)
-     CPU_CFLAGS="-m64 -mbig-endian" ;;
-   ppc64le)
-diff --git a/configs/targets/ppcle-linux-user.mak b/configs/targets/ppcle-linux-user.mak
-new file mode 100644
-index 0000000..2259243
---- /dev/null
-+++ b/configs/targets/ppcle-linux-user.mak
-@@ -0,0 +1,4 @@
-+TARGET_ARCH=ppc
-+TARGET_SYSTBL_ABI=common,nospu,32
-+TARGET_SYSTBL=syscall.tbl
-+TARGET_XML_FILES= gdb-xml/power-core.xml gdb-xml/power-fpu.xml gdb-xml/power-altivec.xml gdb-xml/power-spe.xml
-diff --git a/linux-user/ppc/target_syscall.h b/linux-user/ppc/target_syscall.h
-index b9c4b81..cf26497 100644
---- a/linux-user/ppc/target_syscall.h
-+++ b/linux-user/ppc/target_syscall.h
-@@ -65,7 +65,11 @@ struct target_revectored_struct {
- #define UNAME_MACHINE "ppc64le"
- #endif
- #else
-+#if TARGET_BIG_ENDIAN
- #define UNAME_MACHINE "ppc"
-+#else
-+#define UNAME_MACHINE "ppcle"
-+#endif
- #endif
- #define UNAME_MINIMUM_RELEASE "2.6.32"
- 
-diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh
-index 9f1580a..393943f 100755
---- a/scripts/qemu-binfmt-conf.sh
-+++ b/scripts/qemu-binfmt-conf.sh
-@@ -46,6 +46,10 @@ ppc_magic='\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x
- ppc_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
- ppc_family=ppc
- 
-+ppcle_magic='\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x14\x00'
-+ppcle_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\x00'
-+ppc_family=ppcle
-+
- ppc64_magic='\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x15'
- ppc64_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
- ppc64_family=ppc
-@@ -148,7 +152,7 @@ qemu_get_family() {
-     "Power Macintosh"|ppc64|powerpc|ppc)
-         echo "ppc"
-         ;;
--    ppc64el|ppc64le)
-+    ppc64el|ppc64le|ppcel|ppcle)
-         echo "ppcle"
-         ;;
-     arm|armel|armhf|arm64|armv[4-9]*l|aarch64)
-diff --git a/configure b/configure
-index 72ab03f11a..0691929d76 100755
---- a/configure
-+++ b/configure
-@@ -1866,6 +1866,7 @@ fi
- : ${cross_prefix_mips="mips-linux-gnu-"}
- : ${cross_prefix_nios2="nios2-linux-gnu-"}
- : ${cross_prefix_ppc="powerpc-linux-gnu-"}
-+: ${cross_prefix_ppcle="powerpcle-linux-gnu-"}
- : ${cross_prefix_ppc64="powerpc64-linux-gnu-"}
- : ${cross_prefix_ppc64le="$cross_prefix_ppc64"}
- : ${cross_prefix_riscv64="riscv64-linux-gnu-"}
-@@ -1883,6 +1884,7 @@ fi
- : ${cross_cc_cflags_hexagon="-mv67 -O2 -static"}
- : ${cross_cc_cflags_i386="-m32"}
- : ${cross_cc_cflags_ppc="-m32 -mbig-endian"}
-+: ${cross_cc_cflags_ppcle="-m32"}
- : ${cross_cc_cflags_ppc64="-m64 -mbig-endian"}
- : ${cross_cc_ppc64le="$cross_cc_ppc64"}
- : ${cross_cc_cflags_ppc64le="-m64 -mlittle-endian"}
-2.30.1
-
diff --git a/srcpkgs/qemu/template b/srcpkgs/qemu/template
index 9793e2f6101a7..11b242fce2b20 100644
--- a/srcpkgs/qemu/template
+++ b/srcpkgs/qemu/template
@@ -1,8 +1,8 @@
 # Template file for 'qemu'
 # This package should be updated together with qemu-user-static
 pkgname=qemu
-version=7.1.0
-revision=3
+version=8.1.0
+revision=1
 build_style=configure
 configure_args="--prefix=/usr --sysconfdir=/etc --libexecdir=/usr/libexec --localstatedir=/var
  --disable-glusterfs --disable-xen --enable-docs --enable-kvm --enable-libusb --enable-pie
@@ -10,10 +10,10 @@ configure_args="--prefix=/usr --sysconfdir=/etc --libexecdir=/usr/libexec --loca
  --audio-drv-list=alsa$(vopt_if sdl2 ,sdl)$(vopt_if jack ,jack)$(vopt_if pulseaudio ,pa)
  $(vopt_enable opengl) $(vopt_enable pulseaudio pa) $(vopt_enable sdl2 sdl) $(vopt_enable smartcard)
  $(vopt_enable spice) $(vopt_enable virgl virglrenderer) $(vopt_if gtk3 '--enable-gtk')"
-hostmakedepends="gettext pkg-config perl python3 python3-Sphinx python3-sphinx_rtd_theme ninja"
+hostmakedepends="flex glib-devel gettext pkg-config perl python3 python3-Sphinx python3-sphinx_rtd_theme ninja"
 makedepends="capstone-devel dtc-devel libpng-devel libjpeg-turbo-devel pixman-devel
  snappy-devel libuuid-devel libX11-devel alsa-lib-devel libaio-devel gnutls-devel
- libsasl-devel libglib-devel ncurses-devel libseccomp-devel nss-devel
+ libsasl-devel ncurses-devel libseccomp-devel nss-devel
  libcurl-devel xfsprogs-devel libcap-ng-devel vde2-devel usbredir-devel
  libbluetooth-devel libssh2-devel libusb-devel libnfs-devel libslirp-devel
  libxkbcommon-devel libzstd-devel $(vopt_if sdl2 'SDL2-devel SDL2_image-devel')
@@ -25,18 +25,17 @@ makedepends="capstone-devel dtc-devel libpng-devel libjpeg-turbo-devel pixman-de
  $(vopt_if jack 'jack-devel') $(vopt_if pulseaudio 'pulseaudio-devel')"
 short_desc="Open Source Processor Emulator"
 maintainer="Orphaned <orphan@voidlinux.org>"
-license="GPL-2.0-or-later, LGPL-2.1-or-later"
+license="GPL-2.0-only, LGPL-2.1-only"
 homepage="https://www.qemu.org"
 distfiles="https://wiki.qemu.org/download/qemu-${version}.tar.bz2"
-checksum=f7ac2b85b3f1831e6810b140306e30af91556e15784864b209f3942858947fd0
+checksum=53a2388f4f67d03e94ed7fe192d8828e64c535fadf7bf9dd0bc1d2091eedf624
 ignore_elf_dirs="/usr/share/qemu"
 nostrip_files="hppa-firmware.img openbios-ppc openbios-sparc32 openbios-sparc64
  palcode-clipper s390-ccw.img s390-netboot.img u-boot.e500 opensbi-riscv32-generic-fw_dynamic.elf
  opensbi-riscv64-generic-fw_dynamic.elf"
-make_check=no # capstone5.0: fails 90/95 qemu:unit / test-vmstate (when updating the qemu package this should go away)
 
-build_options="gtk3 opengl sdl2 spice virgl smartcard numa iscsi jack pulseaudio"
-build_options_default="opengl gtk3 virgl sdl2 numa iscsi jack pulseaudio"
+build_options="gtk3 iscsi jack numa opengl pulseaudio sdl2 smartcard spice virgl"
+build_options_default="gtk3 iscsi jack numa opengl pulseaudio sdl2 smartcard spice virgl"
 desc_option_sdl2="Enable SDL (2.x) video output"
 desc_option_spice="Enable support for SPICE"
 desc_option_virgl="Enable support for VirGL (A Virtual 3D GPU renderer)"
@@ -44,33 +43,10 @@ desc_option_smartcard="Enable smartcard support"
 desc_option_numa="Enable support for host NUMA"
 desc_option_iscsi="Enable support for iSCSI"
 
-case "$XBPS_TARGET_MACHINE" in
-	aarch64-musl) CFLAGS="-D_LINUX_SYSINFO_H";;
-esac
-
-if [ "$XBPS_TARGET_ENDIAN" = "le" ]; then
-	build_options_default+=" spice"
-fi
-
 if [ "$CROSS_BUILD" ]; then
 	configure_args+=" --cross-prefix=${XBPS_CROSS_TRIPLET}-"
-else
-	build_options_default+=" smartcard"
 fi
 
-post_extract() {
-	if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
-		grep -rl 'Input/output error' tests/qemu-iotests |
-			xargs -n1 sed -i -e 's;Input/output error;I/O error;g'
-		grep -rl 'Operation not supported' tests/qemu-iotests |
-			xargs -n1 sed -i -e 's;Operation not supported;Not supported;g'
-	fi
-}
-
-pre_configure() {
-	unset CPP
-}
-
 post_install() {
 	vdoc "${FILESDIR}/README.voidlinux"
 

From fb01f149bd53d254b80495081230484d1449d02b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Cerqueira?= <acerqueira021@gmail.com>
Date: Sun, 17 Sep 2023 11:21:18 +0100
Subject: [PATCH 2/2] qemu-user-static: update to 8.1.0.

---
 srcpkgs/qemu-user-static/template | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/srcpkgs/qemu-user-static/template b/srcpkgs/qemu-user-static/template
index 2a8da9b53f2d5..504ec5417c94e 100644
--- a/srcpkgs/qemu-user-static/template
+++ b/srcpkgs/qemu-user-static/template
@@ -1,20 +1,20 @@
 # Template file for 'qemu-user-static'
 # This package should be updated together with qemu
 pkgname=qemu-user-static
-version=7.1.0
-revision=3
+version=8.1.0
+revision=1
 build_style=configure
 configure_args="--prefix=/usr --sysconfdir=/etc --libexecdir=/usr/libexec
  --disable-kvm --disable-png --disable-virtfs --disable-fdt --disable-seccomp
  --enable-linux-user --disable-system --static --disable-pie"
-hostmakedepends="pkg-config perl python3 ninja"
-makedepends="dtc-devel libglib-devel pixman-devel libuuid-devel"
+hostmakedepends="flex glib-devel pkg-config perl python3 ninja"
+makedepends="dtc-devel glib-devel pixman-devel libuuid-devel"
 short_desc="QEMU User-mode emulators (statically compiled)"
 maintainer="Orphaned <orphan@voidlinux.org>"
-license="GPL-2.0-or-later, LGPL-2.1-or-later"
+license="GPL-2.0-only, LGPL-2.1-only"
 homepage="https://www.qemu.org"
 distfiles="https://wiki.qemu.org/download/qemu-${version}.tar.bz2"
-checksum=f7ac2b85b3f1831e6810b140306e30af91556e15784864b209f3942858947fd0
+checksum=53a2388f4f67d03e94ed7fe192d8828e64c535fadf7bf9dd0bc1d2091eedf624
 
 _fmts="aarch64 aarch64_be alpha arm armeb cris hppa i386 m68k microblaze
  microblazeel mips mipsel mips64 mips64el mipsn32 mipsn32el or1k
@@ -111,10 +111,6 @@ done
 
 binfmts="${binfmts%?}"
 
-pre_configure() {
-	unset CPP
-}
-
 post_install() {
 	# Remove unneeded stuff.
 	rm -rf ${DESTDIR}/etc ${DESTDIR}/usr/share ${DESTDIR}/usr/libexec

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: qemu: update to 8.1.0.
  2023-07-03 17:50 [PR PATCH] qemu: update to 8.0.2 motorto
                   ` (36 preceding siblings ...)
  2023-09-17 13:58 ` motorto
@ 2023-09-24  7:10 ` AnErrupTion
  2023-09-26 16:28 ` [PR PATCH] [Merged]: " classabbyamp
  38 siblings, 0 replies; 40+ messages in thread
From: AnErrupTion @ 2023-09-24  7:10 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 298 bytes --]

New comment by AnErrupTion on void-packages repository

https://github.com/void-linux/void-packages/pull/44822#issuecomment-1732506418

Comment:
I've tested it and it works wonderfully! (Though I've only tested ``qemu``, not ``qemu-user-static``, but I'm pretty sure it'll work just fine as well.)

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [PR PATCH] [Merged]: qemu: update to 8.1.0.
  2023-07-03 17:50 [PR PATCH] qemu: update to 8.0.2 motorto
                   ` (37 preceding siblings ...)
  2023-09-24  7:10 ` AnErrupTion
@ 2023-09-26 16:28 ` classabbyamp
  38 siblings, 0 replies; 40+ messages in thread
From: classabbyamp @ 2023-09-26 16:28 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1595 bytes --]

There's a merged pull request on the void-packages repository

qemu: update to 8.1.0.
https://github.com/void-linux/void-packages/pull/44822

Description:
<!-- Uncomment relevant sections and delete options which are not applicable -->
#### Testing the changes
- I tested the changes in this PR: **YES**, runned a Windows vm machine and it worked fine. 
**DIDN'T Test the qemu-user-static**

Removed a bunch of patches that in my research are no longer needed:

- Removed all ppc related patches since that arch isn't no longer supported.
- gcc12.patch: because it builds fine now in this version
- fix-softfloat-fesetround.patch: don't have a system to try it, but alpine doesn't have any patch related to this)
- mmap-mremap-efaul: not sure about if we should keep this one

Kept this patches:

- musl-initialize-msghdr.patch: just update in order to apply.

Added this ones:

- ~~CVE-2023-2861.patch~~
- ~~keymap.patch: xkeyboard-config 2.39 removed the legacy alias of ar -> ara~~
- ~~fix-brk0.patch: make sure that initial brk(0) is page-aligned~~
- lfs64.patch: Builds defines -D_FILE_OFFSET_BITS=64 which makes the original functions
anf macros behave same as their 64 suffixed counterparts. This also
helps in compiling with latest musl C library, where these macros and
functions are no more available under _GNU_SOURCE feature macro

#### Local build testing
- I built this PR locally for my native architecture, x86-64-glibc
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl (cross)
  - x86_64-musl



^ permalink raw reply	[flat|nested] 40+ messages in thread

end of thread, other threads:[~2023-09-26 16:28 UTC | newest]

Thread overview: 40+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-03 17:50 [PR PATCH] qemu: update to 8.0.2 motorto
2023-07-03 17:55 ` [PR PATCH] [Updated] " motorto
2023-07-03 17:59 ` motorto
2023-07-04 13:28 ` motorto
2023-07-04 13:32 ` motorto
2023-07-10 14:43 ` motorto
2023-07-12 10:30 ` JamiKettunen
2023-07-12 10:37 ` JamiKettunen
2023-07-12 13:05 ` motorto
2023-07-12 13:35 ` JamiKettunen
2023-07-13  6:12 ` JamiKettunen
2023-07-13  6:13 ` JamiKettunen
2023-07-18  7:35 ` JamiKettunen
2023-07-18  7:45 ` JamiKettunen
2023-07-18  8:59 ` JamiKettunen
2023-07-18  9:10 ` JamiKettunen
2023-07-18  9:14 ` JamiKettunen
2023-07-18 14:17 ` [PR PATCH] [Updated] " motorto
2023-07-18 14:23 ` qemu: update to 8.0.3 motorto
2023-07-19 14:49 ` JamiKettunen
2023-07-19 17:02 ` motorto
2023-07-19 17:04 ` [PR PATCH] [Updated] " motorto
2023-07-19 17:13 ` JamiKettunen
2023-07-19 17:15 ` JamiKettunen
2023-07-19 17:16 ` JamiKettunen
2023-07-19 17:17 ` JamiKettunen
2023-07-19 17:21 ` [PR PATCH] [Updated] " motorto
2023-07-19 17:22 ` motorto
2023-07-19 17:22 ` motorto
2023-08-31 10:15 ` JamiKettunen
2023-08-31 10:16 ` JamiKettunen
2023-09-01 17:32 ` [PR PATCH] [Updated] " motorto
2023-09-01 17:33 ` motorto
2023-09-01 22:46 ` [PR PATCH] [Updated] qemu: update to 8.1.0 motorto
2023-09-01 23:34 ` motorto
2023-09-17 10:21 ` motorto
2023-09-17 10:30 ` motorto
2023-09-17 13:58 ` motorto
2023-09-24  7:10 ` AnErrupTion
2023-09-26 16:28 ` [PR PATCH] [Merged]: " classabbyamp

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).