summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2024-01-24 16:32:50 -0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2024-01-27 11:06:34 +0000
commit0f61386628df828c5b1a440a414759e3e60f86a2 (patch)
treeef7b0750ee3c1e8cd86216dbfd89c948596b9a18
parent2ced056c510b697ca6705da9f69855b46b6b753b (diff)
downloadpoky-0f61386628df828c5b1a440a414759e3e60f86a2.tar.gz
qemu: Replace the basename patch with backport
Backport the patch that got applied to fix this issue upstream (From OE-Core rev: 952c94988cf1cf093668e9ac7020485c51cf3a58) 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>
-rw-r--r--meta/recipes-devtools/qemu/qemu.inc2
-rw-r--r--meta/recipes-devtools/qemu/qemu/0001-vfio-Include-libgen.h-for-basename-API.patch57
-rw-r--r--meta/recipes-devtools/qemu/qemu/0001-vfio-container-Replace-basename-with-g_path_get_base.patch50
3 files changed, 51 insertions, 58 deletions
diff --git a/meta/recipes-devtools/qemu/qemu.inc b/meta/recipes-devtools/qemu/qemu.inc
index bc1440249d..0cced6ed32 100644
--- a/meta/recipes-devtools/qemu/qemu.inc
+++ b/meta/recipes-devtools/qemu/qemu.inc
@@ -32,7 +32,7 @@ SRC_URI = "https://download.qemu.org/${BPN}-${PV}.tar.xz \
32 file://0010-hw-pvrdma-Protect-against-buggy-or-malicious-guest-d.patch \ 32 file://0010-hw-pvrdma-Protect-against-buggy-or-malicious-guest-d.patch \
33 file://0002-linux-user-Replace-use-of-lfs64-related-functions-an.patch \ 33 file://0002-linux-user-Replace-use-of-lfs64-related-functions-an.patch \
34 file://fixedmeson.patch \ 34 file://fixedmeson.patch \
35 file://0001-vfio-Include-libgen.h-for-basename-API.patch \ 35 file://0001-vfio-container-Replace-basename-with-g_path_get_base.patch \
36 file://no-pip.patch \ 36 file://no-pip.patch \
37 file://fix_segv.patch \ 37 file://fix_segv.patch \
38 file://qemu-guest-agent.init \ 38 file://qemu-guest-agent.init \
diff --git a/meta/recipes-devtools/qemu/qemu/0001-vfio-Include-libgen.h-for-basename-API.patch b/meta/recipes-devtools/qemu/qemu/0001-vfio-Include-libgen.h-for-basename-API.patch
deleted file mode 100644
index 5b8b638736..0000000000
--- a/meta/recipes-devtools/qemu/qemu/0001-vfio-Include-libgen.h-for-basename-API.patch
+++ /dev/null
@@ -1,57 +0,0 @@
1From e31c67ef65a4217f35f6cd40926251054094dff9 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Mon, 11 Dec 2023 16:44:16 -0800
4Subject: [PATCH v2] vfio: Include libgen.h for basename API
5
6Glibc has two implementation one based on POSIX which is used when
7libgen.h is included and second implementation is GNU implementation
8which is used when string.h is included. The functions are no identical
9in behavior. Musl C library does not implement the GNU version, but it
10has provided a declaration in string.h but this has been corrected in
11latest musl [1] which exposes places where it was being used from
12string.h to error out especially when -Wimplicit-function-declaration is
13treated as error.
14
15| ../qemu-8.1.2/hw/vfio/pci.c:3030:18: error: call to undeclared function 'basename'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
16| 3030 | group_name = basename(group_path);
17
18clang-17 treats this warning as error by default
19
20[1] https://git.musl-libc.org/cgit/musl/commit/?id=725e17ed6dff4d0cd22487bb64470881e86a92e7
21
22Upstream-Status: Submitted [https://lists.nongnu.org/archive/html/qemu-devel/2023-12/msg01438.html]
23Signed-off-by: Khem Raj <raj.khem@gmail.com>
24---
25v2: Add missing link for [1]
26
27 hw/vfio/pci.c | 1 +
28 hw/vfio/platform.c | 1 +
29 2 files changed, 2 insertions(+)
30
31diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
32index c62c02f7b6..f043c93b9e 100644
33--- a/hw/vfio/pci.c
34+++ b/hw/vfio/pci.c
35@@ -19,6 +19,7 @@
36 */
37
38 #include "qemu/osdep.h"
39+#include <libgen.h>
40 #include <linux/vfio.h>
41 #include <sys/ioctl.h>
42
43diff --git a/hw/vfio/platform.c b/hw/vfio/platform.c
44index 8e3d4ac458..a835ab03be 100644
45--- a/hw/vfio/platform.c
46+++ b/hw/vfio/platform.c
47@@ -16,6 +16,7 @@
48
49 #include "qemu/osdep.h"
50 #include "qapi/error.h"
51+#include <libgen.h>
52 #include <sys/ioctl.h>
53 #include <linux/vfio.h>
54
55--
562.43.0
57
diff --git a/meta/recipes-devtools/qemu/qemu/0001-vfio-container-Replace-basename-with-g_path_get_base.patch b/meta/recipes-devtools/qemu/qemu/0001-vfio-container-Replace-basename-with-g_path_get_base.patch
new file mode 100644
index 0000000000..ad4f410178
--- /dev/null
+++ b/meta/recipes-devtools/qemu/qemu/0001-vfio-container-Replace-basename-with-g_path_get_base.patch
@@ -0,0 +1,50 @@
1From 213ae3ffda463c0503e39e0cf827511b5298c314 Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= <clg@redhat.com>
3Date: Wed, 20 Dec 2023 14:53:02 +0100
4Subject: [PATCH] vfio/container: Replace basename with g_path_get_basename
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9g_path_get_basename() is a portable utility function that has the
10advantage of not modifing the string argument. It also fixes a compile
11breakage with the Musl C library reported in [1].
12
13[1] https://lore.kernel.org/all/20231212010228.2701544-1-raj.khem@gmail.com/
14
15Upstream-Status: Backport [https://github.com/qemu/qemu/commit/213ae3ffda463c0503e39e0cf827511b5298c314]
16Reported-by: Khem Raj <raj.khem@gmail.com>
17Reviewed-by: Eric Auger <eric.auger@redhat.com>
18Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
19Reviewed-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
20Signed-off-by: Cédric Le Goater <clg@redhat.com>
21---
22 hw/vfio/container.c | 5 +++--
23 1 file changed, 3 insertions(+), 2 deletions(-)
24
25diff --git a/hw/vfio/container.c b/hw/vfio/container.c
26index 688cf23bab..8d334f52f2 100644
27--- a/hw/vfio/container.c
28+++ b/hw/vfio/container.c
29@@ -869,7 +869,8 @@ static void vfio_put_base_device(VFIODevice *vbasedev)
30
31 static int vfio_device_groupid(VFIODevice *vbasedev, Error **errp)
32 {
33- char *tmp, group_path[PATH_MAX], *group_name;
34+ char *tmp, group_path[PATH_MAX];
35+ g_autofree char *group_name = NULL;
36 int ret, groupid;
37 ssize_t len;
38
39@@ -885,7 +886,7 @@ static int vfio_device_groupid(VFIODevice *vbasedev, Error **errp)
40
41 group_path[len] = 0;
42
43- group_name = basename(group_path);
44+ group_name = g_path_get_basename(group_path);
45 if (sscanf(group_name, "%d", &groupid) != 1) {
46 error_setg_errno(errp, errno, "failed to read %s", group_path);
47 return -errno;
48--
492.43.0
50