Gentoo Archives: gentoo-commits

From: Sam James <sam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-emulation/qemu/files/, app-emulation/qemu/
Date: Wed, 03 Aug 2022 18:21:41
Message-Id: 1659550885.db2a2bbc7edbb87b7c179b8cc61bef689a5211c5.sam@gentoo
1 commit: db2a2bbc7edbb87b7c179b8cc61bef689a5211c5
2 Author: Sam James <sam <AT> gentoo <DOT> org>
3 AuthorDate: Wed Aug 3 18:21:19 2022 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Wed Aug 3 18:21:25 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=db2a2bbc
7
8 app-emulation/qemu: fix build w/ glibc 2.36
9
10 Closes: https://bugs.gentoo.org/863443
11 Signed-off-by: Sam James <sam <AT> gentoo.org>
12
13 .../qemu/files/qemu-7.0.0-glibc-2.36.patch | 90 ++++++++++++++++++++++
14 app-emulation/qemu/qemu-7.0.0-r3.ebuild | 1 +
15 2 files changed, 91 insertions(+)
16
17 diff --git a/app-emulation/qemu/files/qemu-7.0.0-glibc-2.36.patch b/app-emulation/qemu/files/qemu-7.0.0-glibc-2.36.patch
18 new file mode 100644
19 index 000000000000..85343c4d00e7
20 --- /dev/null
21 +++ b/app-emulation/qemu/files/qemu-7.0.0-glibc-2.36.patch
22 @@ -0,0 +1,90 @@
23 +https://lore.kernel.org/all/20220802183409.GB2040@××××××.com/T/
24 +https://bugs.gentoo.org/863443
25 +
26 +From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@××××××.com>
27 +To: qemu-devel@××××××.org
28 +Cc: Laurent Vivier <laurent@××××××.eu>,
29 + =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@××××××.com>
30 +Subject: [PATCH for 7.1] linux-user: fix compat with glibc >= 2.36 sys/mount.h
31 +Date: Tue, 2 Aug 2022 12:41:34 -0400
32 +
33 +The latest glibc 2.36 has extended sys/mount.h so that it
34 +defines the FSCONFIG_* enum constants. These are historically
35 +defined in linux/mount.h, and thus if you include both headers
36 +the compiler complains:
37 +
38 +In file included from /usr/include/linux/fs.h:19,
39 + from ../linux-user/syscall.c:98:
40 +/usr/include/linux/mount.h:95:6: error: redeclaration of 'enum fsconfig_command'
41 + 95 | enum fsconfig_command {
42 + | ^~~~~~~~~~~~~~~~
43 +In file included from ../linux-user/syscall.c:31:
44 +/usr/include/sys/mount.h:189:6: note: originally defined here
45 + 189 | enum fsconfig_command
46 + | ^~~~~~~~~~~~~~~~
47 +/usr/include/linux/mount.h:96:9: error: redeclaration of enumerator 'FSCONFIG_SET_FLAG'
48 + 96 | FSCONFIG_SET_FLAG = 0, /* Set parameter, supplying no value */
49 + | ^~~~~~~~~~~~~~~~~
50 +/usr/include/sys/mount.h:191:3: note: previous definition of 'FSCONFIG_SET_FLAG' with type 'enum fsconfig_command'
51 + 191 | FSCONFIG_SET_FLAG = 0, /* Set parameter, supplying no value */
52 + | ^~~~~~~~~~~~~~~~~
53 +...snip...
54 +
55 +QEMU doesn't include linux/mount.h, but it does use
56 +linux/fs.h and thus gets linux/mount.h indirectly.
57 +
58 +glibc acknowledges this problem but does not appear to
59 +be intending to fix it in the forseeable future, simply
60 +documenting it as a known incompatibility with no
61 +workaround:
62 +
63 + https://sourceware.org/glibc/wiki/Release/2.36#Usage_of_.3Clinux.2Fmount.h.3E_and_.3Csys.2Fmount.h.3E
64 + https://sourceware.org/glibc/wiki/Synchronizing_Headers
65 +
66 +To address this requires either removing use of sys/mount.h
67 +or linux/fs.h, despite QEMU needing declarations from
68 +both.
69 +
70 +This patch removes linux/fs.h, meaning we have to define
71 +various FS_IOC constants that are now unavailable.
72 +
73 +Signed-off-by: Daniel P. Berrangé <berrange@××××××.com>
74 +--- a/linux-user/syscall.c
75 ++++ b/linux-user/syscall.c
76 +@@ -95,7 +95,25 @@
77 + #include <linux/soundcard.h>
78 + #include <linux/kd.h>
79 + #include <linux/mtio.h>
80 ++
81 ++#ifdef HAVE_SYS_MOUNT_FSCONFIG
82 ++/*
83 ++ * glibc >= 2.36 linux/mount.h conflicts with sys/mount.h,
84 ++ * which in turn prevents use of linux/fs.h. So we have to
85 ++ * define the constants ourselves for now.
86 ++ */
87 ++#define FS_IOC_GETFLAGS _IOR('f', 1, long)
88 ++#define FS_IOC_SETFLAGS _IOW('f', 2, long)
89 ++#define FS_IOC_GETVERSION _IOR('v', 1, long)
90 ++#define FS_IOC_SETVERSION _IOW('v', 2, long)
91 ++#define FS_IOC_FIEMAP _IOWR('f', 11, struct fiemap)
92 ++#define FS_IOC32_GETFLAGS _IOR('f', 1, int)
93 ++#define FS_IOC32_SETFLAGS _IOW('f', 2, int)
94 ++#define FS_IOC32_GETVERSION _IOR('v', 1, int)
95 ++#define FS_IOC32_SETVERSION _IOW('v', 2, int)
96 ++#else
97 + #include <linux/fs.h>
98 ++#endif
99 + #include <linux/fd.h>
100 + #if defined(CONFIG_FIEMAP)
101 + #include <linux/fiemap.h>
102 +--- a/meson.build
103 ++++ b/meson.build
104 +@@ -1963,6 +1963,8 @@ config_host_data.set('HAVE_OPTRESET',
105 + cc.has_header_symbol('getopt.h', 'optreset'))
106 + config_host_data.set('HAVE_IPPROTO_MPTCP',
107 + cc.has_header_symbol('netinet/in.h', 'IPPROTO_MPTCP'))
108 ++config_host_data.set('HAVE_SYS_MOUNT_FSCONFIG',
109 ++ cc.has_header_symbol('sys/mount.h', 'FSCONFIG_SET_FLAG'))
110 +
111 + # has_member
112 + config_host_data.set('HAVE_SIGEV_NOTIFY_THREAD_ID',
113
114 diff --git a/app-emulation/qemu/qemu-7.0.0-r3.ebuild b/app-emulation/qemu/qemu-7.0.0-r3.ebuild
115 index d79b2ecdb29b..09762b74b160 100644
116 --- a/app-emulation/qemu/qemu-7.0.0-r3.ebuild
117 +++ b/app-emulation/qemu/qemu-7.0.0-r3.ebuild
118 @@ -300,6 +300,7 @@ PATCHES=(
119 "${FILESDIR}"/${PN}-7.0.0-also-build-virtfs-proxy-helper.patch
120 "${FILESDIR}"/${P}-virtio-scsi-fixes.patch
121 "${FILESDIR}"/${P}-pci-overflow-fortify-source-3.patch
122 + "${FILESDIR}"/${P}-glibc-2.36.patch
123 )
124
125 QA_PREBUILT="