diff mbox series

[styhead,17/27] qemu: Fix build on musl/riscv64

Message ID 36b05346e63f9885da45a3c3a06ad5f6a5cd905c.1729686660.git.steve@sakoman.com
State RFC
Delegated to: Steve Sakoman
Headers show
Series [styhead,01/27] wpa-supplicant: Ignore CVE-2024-5290 | expand

Commit Message

Steve Sakoman Oct. 23, 2024, 12:34 p.m. UTC
From: Khem Raj <raj.khem@gmail.com>

musl does not provide strerrorname_np() so do not use it.

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit d7678118af5aa4bfbf6fb72b34f90a1e37b917c3)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
---
 meta/recipes-devtools/qemu/qemu.inc           |  1 +
 .../qemu/qemu/fix-strerrorname_np.patch       | 27 +++++++++++++++++++
 2 files changed, 28 insertions(+)
 create mode 100644 meta/recipes-devtools/qemu/qemu/fix-strerrorname_np.patch
diff mbox series

Patch

diff --git a/meta/recipes-devtools/qemu/qemu.inc b/meta/recipes-devtools/qemu/qemu.inc
index f37b32985b..2786eedd42 100644
--- a/meta/recipes-devtools/qemu/qemu.inc
+++ b/meta/recipes-devtools/qemu/qemu.inc
@@ -21,6 +21,7 @@  LIC_FILES_CHKSUM = "file://COPYING;md5=441c28d2cf86e15a37fa47e15a72fbac \
 SRC_URI = "https://download.qemu.org/${BPN}-${PV}.tar.xz \
            file://powerpc_rom.bin \
            file://run-ptest \
+           file://fix-strerrorname_np.patch \
            file://0001-qemu-Add-addition-environment-space-to-boot-loader-q.patch \
            file://0002-apic-fixup-fallthrough-to-PIC.patch \
            file://0003-configure-Add-pkg-config-handling-for-libgcrypt.patch \
diff --git a/meta/recipes-devtools/qemu/qemu/fix-strerrorname_np.patch b/meta/recipes-devtools/qemu/qemu/fix-strerrorname_np.patch
new file mode 100644
index 0000000000..5098e8a4e5
--- /dev/null
+++ b/meta/recipes-devtools/qemu/qemu/fix-strerrorname_np.patch
@@ -0,0 +1,27 @@ 
+target/riscv/kvm: do not use non-portable strerrorname_np()
+
+strerrorname_np is non-portable and breaks building with musl libc.
+
+Use strerror(errno) instead, like we do other places.
+
+Upstream-Status: Submitted [https://mail.gnu.org/archive/html/qemu-stable/2023-12/msg00069.html]
+
+Cc: qemu-stable@nongnu.org
+Fixes: commit 082e9e4a58ba (target/riscv/kvm: improve 'init_multiext_cfg' error 
+msg)
+Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2041
+Buglink: https://gitlab.alpinelinux.org/alpine/aports/-/issues/15541
+Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
+
+--- a/target/riscv/kvm/kvm-cpu.c
++++ b/target/riscv/kvm/kvm-cpu.c
+@@ -1731,8 +1731,7 @@ static bool kvm_cpu_realize(CPUState *cs
+     if (riscv_has_ext(&cpu->env, RVV)) {
+         ret = prctl(PR_RISCV_V_SET_CONTROL, PR_RISCV_V_VSTATE_CTRL_ON);
+         if (ret) {
+-            error_setg(errp, "Error in prctl PR_RISCV_V_SET_CONTROL, code: %s",
+-                       strerrorname_np(errno));
++            error_setg(errp, "Error in prctl PR_RISCV_V_SET_CONTROL, error %d", errno);
+             return false;
+         }
+     }