From c59732e734abe4f9d56442be1903f022c50602ad Mon Sep 17 00:00:00 2001 From: Daniel P. Berrangé Date: Jan 10 2023 18:03:55 +0000 Subject: Fix compat with linux > 6.1 headers In file included from /usr/include/linux/btrfs.h:29, from ../linux-user/syscall.c:163: /usr/include/linux/fs.h:50:8: error: redefinition of 'struct file_clone_range' 50 | struct file_clone_range { | ^~~~~~~~~~~~~~~~ ../linux-user/syscall.c:129:8: note: originally defined here 129 | struct file_clone_range { | ^~~~~~~~~~~~~~~~ was caused by btrfs.h gaining an include of linux/fs.h, which clashed with QEMU's workaround for glibc compat with linux/mount.h. GLibc huas fixed their sys/mount.h so we can drop the QEMU workaround, thus fixing the btrfs.h problem. Signed-off-by: Daniel P. Berrangé --- diff --git a/0003-Revert-linux-user-add-more-compat-ioctl-definitions.patch b/0003-Revert-linux-user-add-more-compat-ioctl-definitions.patch new file mode 100644 index 0000000..e263067 --- /dev/null +++ b/0003-Revert-linux-user-add-more-compat-ioctl-definitions.patch @@ -0,0 +1,67 @@ +From ebff02a43374c1138d4f8b2c07d2088a3921c288 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= +Date: Tue, 10 Jan 2023 12:37:14 -0500 +Subject: [PATCH 1/2] Revert "linux-user: add more compat ioctl definitions" +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This reverts commit c5495f4ecb0cdaaf2e9dddeb48f1689cdb520ca0. + +glibc has fixed (in 2.36.9000-40-g774058d729) the problem +that caused a clash when both sys/mount.h annd linux/mount.h +are included, and backported this to the 2.36 stable release +too: + + https://sourceware.org/glibc/wiki/Release/2.36#Usage_of_.3Clinux.2Fmount.h.3E_and_.3Csys.2Fmount.h.3E + +It is saner for QEMU to remove the workaround it applied for +glibc 2.36 and expect distros to ship the 2.36 maint release +with the fix. This avoids needing to add a further workaround +to QEMU to deal with the fact that linux/brtfs.h now also pulls +in linux/mount.h via linux/fs.h since Linux 6.1 + +Signed-off-by: Daniel P. Berrangé +--- + linux-user/syscall.c | 25 ------------------------- + 1 file changed, 25 deletions(-) + +diff --git a/linux-user/syscall.c b/linux-user/syscall.c +index 1f8c10f8ef..9c1e9555e1 100644 +--- a/linux-user/syscall.c ++++ b/linux-user/syscall.c +@@ -111,31 +111,6 @@ + #define FS_IOC32_SETFLAGS _IOW('f', 2, int) + #define FS_IOC32_GETVERSION _IOR('v', 1, int) + #define FS_IOC32_SETVERSION _IOW('v', 2, int) +- +-#define BLKGETSIZE64 _IOR(0x12,114,size_t) +-#define BLKDISCARD _IO(0x12,119) +-#define BLKIOMIN _IO(0x12,120) +-#define BLKIOOPT _IO(0x12,121) +-#define BLKALIGNOFF _IO(0x12,122) +-#define BLKPBSZGET _IO(0x12,123) +-#define BLKDISCARDZEROES _IO(0x12,124) +-#define BLKSECDISCARD _IO(0x12,125) +-#define BLKROTATIONAL _IO(0x12,126) +-#define BLKZEROOUT _IO(0x12,127) +- +-#define FIBMAP _IO(0x00,1) +-#define FIGETBSZ _IO(0x00,2) +- +-struct file_clone_range { +- __s64 src_fd; +- __u64 src_offset; +- __u64 src_length; +- __u64 dest_offset; +-}; +- +-#define FICLONE _IOW(0x94, 9, int) +-#define FICLONERANGE _IOW(0x94, 13, struct file_clone_range) +- + #else + #include + #endif +-- +2.38.1 + diff --git a/0004-Revert-linux-user-fix-compat-with-glibc-2.36-sys-mou.patch b/0004-Revert-linux-user-fix-compat-with-glibc-2.36-sys-mou.patch new file mode 100644 index 0000000..08f5180 --- /dev/null +++ b/0004-Revert-linux-user-fix-compat-with-glibc-2.36-sys-mou.patch @@ -0,0 +1,76 @@ +From f0f11a1435802b5c8ee8337a7b0c0f337d8f9936 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= +Date: Tue, 10 Jan 2023 12:37:25 -0500 +Subject: [PATCH 2/2] Revert "linux-user: fix compat with glibc >= 2.36 + sys/mount.h" +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This reverts commit 3cd3df2a9584e6f753bb62a0028bd67124ab5532. + +glibc has fixed (in 2.36.9000-40-g774058d729) the problem +that caused a clash when both sys/mount.h annd linux/mount.h +are included, and backported this to the 2.36 stable release +too: + + https://sourceware.org/glibc/wiki/Release/2.36#Usage_of_.3Clinux.2Fmount.h.3E_and_.3Csys.2Fmount.h.3E + +It is saner for QEMU to remove the workaround it applied for +glibc 2.36 and expect distros to ship the 2.36 maint release +with the fix. This avoids needing to add a further workaround +to QEMU to deal with the fact that linux/brtfs.h now also pulls +in linux/mount.h via linux/fs.h since Linux 6.1 + +Signed-off-by: Daniel P. Berrangé +--- + linux-user/syscall.c | 18 ------------------ + meson.build | 2 -- + 2 files changed, 20 deletions(-) + +diff --git a/linux-user/syscall.c b/linux-user/syscall.c +index 9c1e9555e1..f2b7634f5e 100644 +--- a/linux-user/syscall.c ++++ b/linux-user/syscall.c +@@ -95,25 +95,7 @@ + #include + #include + #include +- +-#ifdef HAVE_SYS_MOUNT_FSCONFIG +-/* +- * glibc >= 2.36 linux/mount.h conflicts with sys/mount.h, +- * which in turn prevents use of linux/fs.h. So we have to +- * define the constants ourselves for now. +- */ +-#define FS_IOC_GETFLAGS _IOR('f', 1, long) +-#define FS_IOC_SETFLAGS _IOW('f', 2, long) +-#define FS_IOC_GETVERSION _IOR('v', 1, long) +-#define FS_IOC_SETVERSION _IOW('v', 2, long) +-#define FS_IOC_FIEMAP _IOWR('f', 11, struct fiemap) +-#define FS_IOC32_GETFLAGS _IOR('f', 1, int) +-#define FS_IOC32_SETFLAGS _IOW('f', 2, int) +-#define FS_IOC32_GETVERSION _IOR('v', 1, int) +-#define FS_IOC32_SETVERSION _IOW('v', 2, int) +-#else + #include +-#endif + #include + #if defined(CONFIG_FIEMAP) + #include +diff --git a/meson.build b/meson.build +index 175517eafd..32fed7ea6e 100644 +--- a/meson.build ++++ b/meson.build +@@ -2039,8 +2039,6 @@ config_host_data.set('HAVE_OPTRESET', + cc.has_header_symbol('getopt.h', 'optreset')) + config_host_data.set('HAVE_IPPROTO_MPTCP', + cc.has_header_symbol('netinet/in.h', 'IPPROTO_MPTCP')) +-config_host_data.set('HAVE_SYS_MOUNT_FSCONFIG', +- cc.has_header_symbol('sys/mount.h', 'FSCONFIG_SET_FLAG')) + + # has_member + config_host_data.set('HAVE_SIGEV_NOTIFY_THREAD_ID', +-- +2.38.1 + diff --git a/qemu.spec b/qemu.spec index 2f6d242..49c0aa5 100644 --- a/qemu.spec +++ b/qemu.spec @@ -310,7 +310,7 @@ Obsoletes: %{name}-system-unicore32-core <= %{epoch}:%{version}-%{release} %endif # To prevent rpmdev-bumpspec breakage -%global baserelease 2 +%global baserelease 3 Summary: QEMU is a FAST! processor emulator Name: qemu @@ -336,6 +336,9 @@ Source36: README.tests # Fix SGX assert Patch: 0001-target-i386-the-sgx_epc_get_section-stub-is-reachabl.patch Patch: 0001-tests-Disable-pci_virtio_vga-for-ppc64.patch +# Fix compat with kernel-headers >= 6.1 +Patch: 0003-Revert-linux-user-add-more-compat-ioctl-definitions.patch +Patch: 0004-Revert-linux-user-fix-compat-with-glibc-2.36-sys-mou.patch Patch: 0010-Skip-iotests-entirely.patch BuildRequires: meson >= %{meson_version} @@ -2744,6 +2747,9 @@ useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin \ %changelog +* Tue Jan 10 2023 Daniel P. Berrangé - 7.2.0-3 +- Fix compat with linux > 6.1 headers + * Tue Jan 03 2023 Richard W.M. Jones - 2:7.2.0-2 - Rebuild for xen-4.17.0