* [PATCH 0/4] linux-user: fix regression with some ioctls with newest glibc
@ 2022-10-04 9:32 Daniel P. Berrangé
2022-10-04 9:32 ` [PATCH 1/4] linux-user: add more compat ioctl definitions Daniel P. Berrangé
` (3 more replies)
0 siblings, 4 replies; 19+ messages in thread
From: Daniel P. Berrangé @ 2022-10-04 9:32 UTC (permalink / raw)
To: qemu-devel
Cc: Laurent Vivier, Eduardo Habkost, Richard Henderson,
Paolo Bonzini, Daniel P. Berrangé
This fixes a problem where some ioctls lost their definition when we
build with latest glibc that prevents use using linux/fs.h It further
does some cleanup of conditionals to mitigate against such problems
in future.
Daniel P. Berrangé (4):
linux-user: add more compat ioctl definitions
linux-user: remove conditionals for many fs.h ioctls
meson: enforce a minimum Linux kernel headers version >= 4.18
linux-user: drop conditionals for obsolete kernel header versions
linux-user/ioctls.h | 24 -----------------------
linux-user/linux_loop.h | 4 ----
linux-user/syscall.c | 39 ++++++++++++++++++++++++++------------
meson.build | 12 ++++++++++++
tests/tcg/i386/test-i386.c | 10 +++-------
5 files changed, 42 insertions(+), 47 deletions(-)
--
2.37.3
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH 1/4] linux-user: add more compat ioctl definitions
2022-10-04 9:32 [PATCH 0/4] linux-user: fix regression with some ioctls with newest glibc Daniel P. Berrangé
@ 2022-10-04 9:32 ` Daniel P. Berrangé
2022-10-21 14:21 ` Laurent Vivier
2022-10-21 15:17 ` Laurent Vivier
2022-10-04 9:32 ` [PATCH 2/4] linux-user: remove conditionals for many fs.h ioctls Daniel P. Berrangé
` (2 subsequent siblings)
3 siblings, 2 replies; 19+ messages in thread
From: Daniel P. Berrangé @ 2022-10-04 9:32 UTC (permalink / raw)
To: qemu-devel
Cc: Laurent Vivier, Eduardo Habkost, Richard Henderson,
Paolo Bonzini, Daniel P. Berrangé
GLibc changes prevent us from including linux/fs.h anymore,
and we previously adjusted to this in
commit 3cd3df2a9584e6f753bb62a0028bd67124ab5532
Author: Daniel P. Berrangé <berrange@redhat.com>
Date: Tue Aug 2 12:41:34 2022 -0400
linux-user: fix compat with glibc >= 2.36 sys/mount.h
That change required adding compat ioctl definitions on the
QEMU side for any ioctls that we would otherwise obtain
from linux/fs.h. This commit adds more that were initially
missed, due to their usage being conditionalized in QEMU.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
linux-user/syscall.c | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 2e954d8dbd..f6a15df69d 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -111,6 +111,31 @@
#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 <linux/fs.h>
#endif
--
2.37.3
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 2/4] linux-user: remove conditionals for many fs.h ioctls
2022-10-04 9:32 [PATCH 0/4] linux-user: fix regression with some ioctls with newest glibc Daniel P. Berrangé
2022-10-04 9:32 ` [PATCH 1/4] linux-user: add more compat ioctl definitions Daniel P. Berrangé
@ 2022-10-04 9:32 ` Daniel P. Berrangé
2022-10-21 14:21 ` Laurent Vivier
2022-10-21 15:17 ` Laurent Vivier
2022-10-04 9:32 ` [PATCH 3/4] meson: enforce a minimum Linux kernel headers version >= 4.18 Daniel P. Berrangé
2022-10-04 9:32 ` [PATCH 4/4] linux-user: drop conditionals for obsolete kernel header versions Daniel P. Berrangé
3 siblings, 2 replies; 19+ messages in thread
From: Daniel P. Berrangé @ 2022-10-04 9:32 UTC (permalink / raw)
To: qemu-devel
Cc: Laurent Vivier, Eduardo Habkost, Richard Henderson,
Paolo Bonzini, Daniel P. Berrangé
These ioctls have been defined in linux/fs.h for a long time
* BLKGETSIZE64 - <2.6.12 (linux.git epoch)
* BLKDISCARD - 2.6.28 (d30a2605be9d5132d95944916e8f578fcfe4f976)
* BLKIOMIN - 2.6.32 (ac481c20ef8f6c6f2be75d581863f40c43874ef7)
* BLKIOOPT - 2.6.32 (ac481c20ef8f6c6f2be75d581863f40c43874ef7)
* BLKALIGNOFF - 2.6.32 (ac481c20ef8f6c6f2be75d581863f40c43874ef7)
* BLKPBSZGET - 2.6.32 (ac481c20ef8f6c6f2be75d581863f40c43874ef7)
* BLKDISCARDZEROES - 2.6.32 (98262f2762f0067375f83824d81ea929e37e6bfe)
* BLKSECDISCARD - 2.6.36 (8d57a98ccd0b4489003473979da8f5a1363ba7a3)
* BLKROTATIONAL - 3.2 (ef00f59c95fe6e002e7c6e3663cdea65e253f4cc)
* BLKZEROOUT - 3.6 (66ba32dc167202c3cf8c86806581a9393ec7f488)
* FIBMAP - <2.6.12 (linux.git epoch)
* FIGETBSZ - <2.6.12 (linux.git epoch)
and when building with latest glibc, we'll see compat definitions
in syscall.c anyway thanks to the previous patch. Thus we can
assume they always exist and remove the conditional checks.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
linux-user/ioctls.h | 24 ------------------------
1 file changed, 24 deletions(-)
diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h
index f182d40190..071f7ca253 100644
--- a/linux-user/ioctls.h
+++ b/linux-user/ioctls.h
@@ -96,9 +96,7 @@
IOCTL(BLKROGET, IOC_R, MK_PTR(TYPE_INT))
IOCTL(BLKRRPART, 0, TYPE_NULL)
IOCTL(BLKGETSIZE, IOC_R, MK_PTR(TYPE_ULONG))
-#ifdef BLKGETSIZE64
IOCTL(BLKGETSIZE64, IOC_R, MK_PTR(TYPE_ULONGLONG))
-#endif
IOCTL(BLKFLSBUF, 0, TYPE_NULL)
IOCTL(BLKRASET, 0, TYPE_INT)
IOCTL(BLKRAGET, IOC_R, MK_PTR(TYPE_LONG))
@@ -107,33 +105,15 @@
IOCTL_SPECIAL(BLKPG, IOC_W, do_ioctl_blkpg,
MK_PTR(MK_STRUCT(STRUCT_blkpg_ioctl_arg)))
-#ifdef BLKDISCARD
IOCTL(BLKDISCARD, IOC_W, MK_PTR(MK_ARRAY(TYPE_ULONGLONG, 2)))
-#endif
-#ifdef BLKIOMIN
IOCTL(BLKIOMIN, IOC_R, MK_PTR(TYPE_INT))
-#endif
-#ifdef BLKIOOPT
IOCTL(BLKIOOPT, IOC_R, MK_PTR(TYPE_INT))
-#endif
-#ifdef BLKALIGNOFF
IOCTL(BLKALIGNOFF, IOC_R, MK_PTR(TYPE_INT))
-#endif
-#ifdef BLKPBSZGET
IOCTL(BLKPBSZGET, IOC_R, MK_PTR(TYPE_INT))
-#endif
-#ifdef BLKDISCARDZEROES
IOCTL(BLKDISCARDZEROES, IOC_R, MK_PTR(TYPE_INT))
-#endif
-#ifdef BLKSECDISCARD
IOCTL(BLKSECDISCARD, IOC_W, MK_PTR(MK_ARRAY(TYPE_ULONGLONG, 2)))
-#endif
-#ifdef BLKROTATIONAL
IOCTL(BLKROTATIONAL, IOC_R, MK_PTR(TYPE_SHORT))
-#endif
-#ifdef BLKZEROOUT
IOCTL(BLKZEROOUT, IOC_W, MK_PTR(MK_ARRAY(TYPE_ULONGLONG, 2)))
-#endif
IOCTL(FDMSGON, 0, TYPE_NULL)
IOCTL(FDMSGOFF, 0, TYPE_NULL)
@@ -149,17 +129,13 @@
IOCTL(FDTWADDLE, 0, TYPE_NULL)
IOCTL(FDEJECT, 0, TYPE_NULL)
-#ifdef FIBMAP
IOCTL(FIBMAP, IOC_W | IOC_R, MK_PTR(TYPE_LONG))
-#endif
#ifdef FICLONE
IOCTL(FICLONE, IOC_W, TYPE_INT)
IOCTL(FICLONERANGE, IOC_W, MK_PTR(MK_STRUCT(STRUCT_file_clone_range)))
#endif
-#ifdef FIGETBSZ
IOCTL(FIGETBSZ, IOC_R, MK_PTR(TYPE_LONG))
-#endif
#ifdef CONFIG_FIEMAP
IOCTL_SPECIAL(FS_IOC_FIEMAP, IOC_W | IOC_R, do_ioctl_fs_ioc_fiemap,
MK_PTR(MK_STRUCT(STRUCT_fiemap)))
--
2.37.3
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 3/4] meson: enforce a minimum Linux kernel headers version >= 4.18
2022-10-04 9:32 [PATCH 0/4] linux-user: fix regression with some ioctls with newest glibc Daniel P. Berrangé
2022-10-04 9:32 ` [PATCH 1/4] linux-user: add more compat ioctl definitions Daniel P. Berrangé
2022-10-04 9:32 ` [PATCH 2/4] linux-user: remove conditionals for many fs.h ioctls Daniel P. Berrangé
@ 2022-10-04 9:32 ` Daniel P. Berrangé
2022-10-04 9:49 ` Peter Maydell
` (2 more replies)
2022-10-04 9:32 ` [PATCH 4/4] linux-user: drop conditionals for obsolete kernel header versions Daniel P. Berrangé
3 siblings, 3 replies; 19+ messages in thread
From: Daniel P. Berrangé @ 2022-10-04 9:32 UTC (permalink / raw)
To: qemu-devel
Cc: Laurent Vivier, Eduardo Habkost, Richard Henderson,
Paolo Bonzini, Daniel P. Berrangé
Various areas of QEMU have a dependency on Linux kernel header
definitions. This falls under the scope of our supported platforms
matrix, but historically we've not checked for a minimum kernel
headers version. This has made it unclear when we can drop support
for older kernel headers.
* Alpine 3.14: 5.10
* CentOS 8: 4.18
* CentOS 9: 5.14
* Debian 10: 4.19
* Debian 11: 5.10
* Fedora 35: 5.19
* Fedora 36: 5.19
* OpenSUSE 15.3: 5.3.0
* Ubuntu 20.04: 5.4
* Ubuntu 22.04: 5.15
The above ignores the 3rd version digit since distros update their
packages periodically and such updates don't generally affect public
APIs to the extent that it matters for our build time check.
Overall, we can set the baseline to 4.18 currently.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
meson.build | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/meson.build b/meson.build
index 8dc661363f..ea434767ac 100644
--- a/meson.build
+++ b/meson.build
@@ -248,6 +248,18 @@ if targetos == 'linux'
add_project_arguments('-isystem', meson.current_source_dir() / 'linux-headers',
'-isystem', 'linux-headers',
language: ['c', 'cpp'])
+
+ if not cc.compiles('''
+ #include <linux/version.h>
+ int main(void) {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 18, 0)
+#error "QEMU requires Linux kernel headers version >= 4.18.0"
+#endif
+ return 0;
+ }''')
+ error('QEMU requires Linux kernel headers version >= 4.18.0')
+endif
+
endif
add_project_arguments('-iquote', '.',
--
2.37.3
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 4/4] linux-user: drop conditionals for obsolete kernel header versions
2022-10-04 9:32 [PATCH 0/4] linux-user: fix regression with some ioctls with newest glibc Daniel P. Berrangé
` (2 preceding siblings ...)
2022-10-04 9:32 ` [PATCH 3/4] meson: enforce a minimum Linux kernel headers version >= 4.18 Daniel P. Berrangé
@ 2022-10-04 9:32 ` Daniel P. Berrangé
2022-10-21 14:32 ` Laurent Vivier
3 siblings, 1 reply; 19+ messages in thread
From: Daniel P. Berrangé @ 2022-10-04 9:32 UTC (permalink / raw)
To: qemu-devel
Cc: Laurent Vivier, Eduardo Habkost, Richard Henderson,
Paolo Bonzini, Daniel P. Berrangé
Given our newly enforced 4.18 baseline for the kernel headers version,
we can drop any conditional checks for older versions.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
linux-user/linux_loop.h | 4 ----
linux-user/syscall.c | 14 ++------------
tests/tcg/i386/test-i386.c | 10 +++-------
3 files changed, 5 insertions(+), 23 deletions(-)
diff --git a/linux-user/linux_loop.h b/linux-user/linux_loop.h
index f80b96f1ff..5a9e0edef2 100644
--- a/linux-user/linux_loop.h
+++ b/linux-user/linux_loop.h
@@ -31,10 +31,6 @@ enum {
#include <asm/posix_types.h> /* for __kernel_old_dev_t */
#include <asm/types.h> /* for __u64 */
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) /* This is a guess. */
-#define __kernel_old_dev_t __kernel_dev_t
-#endif
-
/* Backwards compatibility version */
struct loop_info {
int lo_number; /* ioctl r/o */
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index f6a15df69d..377867907a 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -2540,16 +2540,12 @@ set_timeout:
case NETLINK_DROP_MEMBERSHIP:
case NETLINK_BROADCAST_ERROR:
case NETLINK_NO_ENOBUFS:
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
case NETLINK_LISTEN_ALL_NSID:
case NETLINK_CAP_ACK:
-#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0) */
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
case NETLINK_EXT_ACK:
-#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0)
case NETLINK_GET_STRICT_CHK:
-#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) */
+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0) */
break;
default:
goto unimplemented;
@@ -2918,16 +2914,12 @@ get_timeout:
case NETLINK_PKTINFO:
case NETLINK_BROADCAST_ERROR:
case NETLINK_NO_ENOBUFS:
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
case NETLINK_LISTEN_ALL_NSID:
case NETLINK_CAP_ACK:
-#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0) */
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
case NETLINK_EXT_ACK:
-#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0)
case NETLINK_GET_STRICT_CHK:
-#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) */
+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0) */
if (get_user_u32(len, optlen)) {
return -TARGET_EFAULT;
}
@@ -2944,7 +2936,6 @@ get_timeout:
return -TARGET_EFAULT;
}
break;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
case NETLINK_LIST_MEMBERSHIPS:
{
uint32_t *results;
@@ -2975,7 +2966,6 @@ get_timeout:
unlock_user(results, optval_addr, 0);
break;
}
-#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0) */
default:
goto unimplemented;
}
diff --git a/tests/tcg/i386/test-i386.c b/tests/tcg/i386/test-i386.c
index 864c4e620d..881b45cd19 100644
--- a/tests/tcg/i386/test-i386.c
+++ b/tests/tcg/i386/test-i386.c
@@ -1224,10 +1224,6 @@ static inline int modify_ldt(int func, void * ptr, unsigned long bytecount)
return syscall(__NR_modify_ldt, func, ptr, bytecount);
}
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 66)
-#define modify_ldt_ldt_s user_desc
-#endif
-
#define MK_SEL(n) (((n) << 3) | 7)
uint8_t seg_data1[4096];
@@ -1265,7 +1261,7 @@ uint8_t seg_data2[4096];
/* NOTE: we use Linux modify_ldt syscall */
void test_segs(void)
{
- struct modify_ldt_ldt_s ldt;
+ struct user_desc ldt;
long long ldt_table[3];
int res, res2;
char tmp;
@@ -1367,7 +1363,7 @@ extern char code16_func3;
void test_code16(void)
{
- struct modify_ldt_ldt_s ldt;
+ struct user_desc ldt;
int res, res2;
/* build a code segment */
@@ -1774,7 +1770,7 @@ void test_exceptions(void)
}
{
- struct modify_ldt_ldt_s ldt;
+ struct user_desc ldt;
ldt.entry_number = 1;
ldt.base_addr = (unsigned long)&seg_data1;
ldt.limit = (sizeof(seg_data1) + 0xfff) >> 12;
--
2.37.3
^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: [PATCH 3/4] meson: enforce a minimum Linux kernel headers version >= 4.18
2022-10-04 9:32 ` [PATCH 3/4] meson: enforce a minimum Linux kernel headers version >= 4.18 Daniel P. Berrangé
@ 2022-10-04 9:49 ` Peter Maydell
2022-10-04 10:00 ` Daniel P. Berrangé
2022-10-21 14:30 ` Laurent Vivier
2022-10-27 10:50 ` Daniel P. Berrangé
2 siblings, 1 reply; 19+ messages in thread
From: Peter Maydell @ 2022-10-04 9:49 UTC (permalink / raw)
To: Daniel P. Berrangé
Cc: qemu-devel, Laurent Vivier, Eduardo Habkost, Richard Henderson,
Paolo Bonzini
On Tue, 4 Oct 2022 at 10:46, Daniel P. Berrangé <berrange@redhat.com> wrote:
>
> Various areas of QEMU have a dependency on Linux kernel header
> definitions. This falls under the scope of our supported platforms
> matrix, but historically we've not checked for a minimum kernel
> headers version. This has made it unclear when we can drop support
> for older kernel headers.
>
> * Alpine 3.14: 5.10
> * CentOS 8: 4.18
> * CentOS 9: 5.14
> * Debian 10: 4.19
> * Debian 11: 5.10
> * Fedora 35: 5.19
> * Fedora 36: 5.19
> * OpenSUSE 15.3: 5.3.0
> * Ubuntu 20.04: 5.4
> * Ubuntu 22.04: 5.15
>
> The above ignores the 3rd version digit since distros update their
> packages periodically and such updates don't generally affect public
> APIs to the extent that it matters for our build time check.
>
> Overall, we can set the baseline to 4.18 currently.
I wonder if we want to be a bit more conservative about this
than we would for other library-type dependency setting ?
At the moment, even if you don't meet our minimum distro
baseline, you can still build by, for instance, building
local copies of newer versions of our dependencies and using
those. That seems harder to do for the system header files.
-- PMM
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 3/4] meson: enforce a minimum Linux kernel headers version >= 4.18
2022-10-04 9:49 ` Peter Maydell
@ 2022-10-04 10:00 ` Daniel P. Berrangé
0 siblings, 0 replies; 19+ messages in thread
From: Daniel P. Berrangé @ 2022-10-04 10:00 UTC (permalink / raw)
To: Peter Maydell
Cc: qemu-devel, Laurent Vivier, Eduardo Habkost, Richard Henderson,
Paolo Bonzini
On Tue, Oct 04, 2022 at 10:49:44AM +0100, Peter Maydell wrote:
> On Tue, 4 Oct 2022 at 10:46, Daniel P. Berrangé <berrange@redhat.com> wrote:
> >
> > Various areas of QEMU have a dependency on Linux kernel header
> > definitions. This falls under the scope of our supported platforms
> > matrix, but historically we've not checked for a minimum kernel
> > headers version. This has made it unclear when we can drop support
> > for older kernel headers.
> >
> > * Alpine 3.14: 5.10
> > * CentOS 8: 4.18
> > * CentOS 9: 5.14
> > * Debian 10: 4.19
> > * Debian 11: 5.10
> > * Fedora 35: 5.19
> > * Fedora 36: 5.19
> > * OpenSUSE 15.3: 5.3.0
> > * Ubuntu 20.04: 5.4
> > * Ubuntu 22.04: 5.15
> >
> > The above ignores the 3rd version digit since distros update their
> > packages periodically and such updates don't generally affect public
> > APIs to the extent that it matters for our build time check.
> >
> > Overall, we can set the baseline to 4.18 currently.
>
> I wonder if we want to be a bit more conservative about this
> than we would for other library-type dependency setting ?
> At the moment, even if you don't meet our minimum distro
> baseline, you can still build by, for instance, building
> local copies of newer versions of our dependencies and using
> those. That seems harder to do for the system header files.
In theory it ought to be possible to install a newer version of the
linux kernel headers too, as there's no need for them to actually
match the kernel being run. Depending on the age difference of
distro vs newer kernel headers though, I guess there's a small risk
of incompatibility between the new kernel headers and original glibc.
Personally I think we're already pretty generous though in terms of
backcompat though, and at least for the user emulators, people can
do a static build on a newer install and run it on an older install.
With regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 1/4] linux-user: add more compat ioctl definitions
2022-10-04 9:32 ` [PATCH 1/4] linux-user: add more compat ioctl definitions Daniel P. Berrangé
@ 2022-10-21 14:21 ` Laurent Vivier
2022-10-21 15:17 ` Laurent Vivier
1 sibling, 0 replies; 19+ messages in thread
From: Laurent Vivier @ 2022-10-21 14:21 UTC (permalink / raw)
To: Daniel P. Berrangé, qemu-devel
Cc: Eduardo Habkost, Richard Henderson, Paolo Bonzini
Le 04/10/2022 à 11:32, Daniel P. Berrangé a écrit :
> GLibc changes prevent us from including linux/fs.h anymore,
> and we previously adjusted to this in
>
> commit 3cd3df2a9584e6f753bb62a0028bd67124ab5532
> Author: Daniel P. Berrangé <berrange@redhat.com>
> Date: Tue Aug 2 12:41:34 2022 -0400
>
> linux-user: fix compat with glibc >= 2.36 sys/mount.h
>
> That change required adding compat ioctl definitions on the
> QEMU side for any ioctls that we would otherwise obtain
> from linux/fs.h. This commit adds more that were initially
> missed, due to their usage being conditionalized in QEMU.
>
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
> linux-user/syscall.c | 25 +++++++++++++++++++++++++
> 1 file changed, 25 insertions(+)
>
> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index 2e954d8dbd..f6a15df69d 100644
> --- a/linux-user/syscall.c
> +++ b/linux-user/syscall.c
> @@ -111,6 +111,31 @@
> #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 <linux/fs.h>
> #endif
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 2/4] linux-user: remove conditionals for many fs.h ioctls
2022-10-04 9:32 ` [PATCH 2/4] linux-user: remove conditionals for many fs.h ioctls Daniel P. Berrangé
@ 2022-10-21 14:21 ` Laurent Vivier
2022-10-21 15:17 ` Laurent Vivier
1 sibling, 0 replies; 19+ messages in thread
From: Laurent Vivier @ 2022-10-21 14:21 UTC (permalink / raw)
To: Daniel P. Berrangé, qemu-devel
Cc: Eduardo Habkost, Richard Henderson, Paolo Bonzini
Le 04/10/2022 à 11:32, Daniel P. Berrangé a écrit :
> These ioctls have been defined in linux/fs.h for a long time
>
> * BLKGETSIZE64 - <2.6.12 (linux.git epoch)
> * BLKDISCARD - 2.6.28 (d30a2605be9d5132d95944916e8f578fcfe4f976)
> * BLKIOMIN - 2.6.32 (ac481c20ef8f6c6f2be75d581863f40c43874ef7)
> * BLKIOOPT - 2.6.32 (ac481c20ef8f6c6f2be75d581863f40c43874ef7)
> * BLKALIGNOFF - 2.6.32 (ac481c20ef8f6c6f2be75d581863f40c43874ef7)
> * BLKPBSZGET - 2.6.32 (ac481c20ef8f6c6f2be75d581863f40c43874ef7)
> * BLKDISCARDZEROES - 2.6.32 (98262f2762f0067375f83824d81ea929e37e6bfe)
> * BLKSECDISCARD - 2.6.36 (8d57a98ccd0b4489003473979da8f5a1363ba7a3)
> * BLKROTATIONAL - 3.2 (ef00f59c95fe6e002e7c6e3663cdea65e253f4cc)
> * BLKZEROOUT - 3.6 (66ba32dc167202c3cf8c86806581a9393ec7f488)
> * FIBMAP - <2.6.12 (linux.git epoch)
> * FIGETBSZ - <2.6.12 (linux.git epoch)
>
> and when building with latest glibc, we'll see compat definitions
> in syscall.c anyway thanks to the previous patch. Thus we can
> assume they always exist and remove the conditional checks.
>
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
> linux-user/ioctls.h | 24 ------------------------
> 1 file changed, 24 deletions(-)
>
> diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h
> index f182d40190..071f7ca253 100644
> --- a/linux-user/ioctls.h
> +++ b/linux-user/ioctls.h
> @@ -96,9 +96,7 @@
> IOCTL(BLKROGET, IOC_R, MK_PTR(TYPE_INT))
> IOCTL(BLKRRPART, 0, TYPE_NULL)
> IOCTL(BLKGETSIZE, IOC_R, MK_PTR(TYPE_ULONG))
> -#ifdef BLKGETSIZE64
> IOCTL(BLKGETSIZE64, IOC_R, MK_PTR(TYPE_ULONGLONG))
> -#endif
> IOCTL(BLKFLSBUF, 0, TYPE_NULL)
> IOCTL(BLKRASET, 0, TYPE_INT)
> IOCTL(BLKRAGET, IOC_R, MK_PTR(TYPE_LONG))
> @@ -107,33 +105,15 @@
> IOCTL_SPECIAL(BLKPG, IOC_W, do_ioctl_blkpg,
> MK_PTR(MK_STRUCT(STRUCT_blkpg_ioctl_arg)))
>
> -#ifdef BLKDISCARD
> IOCTL(BLKDISCARD, IOC_W, MK_PTR(MK_ARRAY(TYPE_ULONGLONG, 2)))
> -#endif
> -#ifdef BLKIOMIN
> IOCTL(BLKIOMIN, IOC_R, MK_PTR(TYPE_INT))
> -#endif
> -#ifdef BLKIOOPT
> IOCTL(BLKIOOPT, IOC_R, MK_PTR(TYPE_INT))
> -#endif
> -#ifdef BLKALIGNOFF
> IOCTL(BLKALIGNOFF, IOC_R, MK_PTR(TYPE_INT))
> -#endif
> -#ifdef BLKPBSZGET
> IOCTL(BLKPBSZGET, IOC_R, MK_PTR(TYPE_INT))
> -#endif
> -#ifdef BLKDISCARDZEROES
> IOCTL(BLKDISCARDZEROES, IOC_R, MK_PTR(TYPE_INT))
> -#endif
> -#ifdef BLKSECDISCARD
> IOCTL(BLKSECDISCARD, IOC_W, MK_PTR(MK_ARRAY(TYPE_ULONGLONG, 2)))
> -#endif
> -#ifdef BLKROTATIONAL
> IOCTL(BLKROTATIONAL, IOC_R, MK_PTR(TYPE_SHORT))
> -#endif
> -#ifdef BLKZEROOUT
> IOCTL(BLKZEROOUT, IOC_W, MK_PTR(MK_ARRAY(TYPE_ULONGLONG, 2)))
> -#endif
>
> IOCTL(FDMSGON, 0, TYPE_NULL)
> IOCTL(FDMSGOFF, 0, TYPE_NULL)
> @@ -149,17 +129,13 @@
> IOCTL(FDTWADDLE, 0, TYPE_NULL)
> IOCTL(FDEJECT, 0, TYPE_NULL)
>
> -#ifdef FIBMAP
> IOCTL(FIBMAP, IOC_W | IOC_R, MK_PTR(TYPE_LONG))
> -#endif
> #ifdef FICLONE
> IOCTL(FICLONE, IOC_W, TYPE_INT)
> IOCTL(FICLONERANGE, IOC_W, MK_PTR(MK_STRUCT(STRUCT_file_clone_range)))
> #endif
>
> -#ifdef FIGETBSZ
> IOCTL(FIGETBSZ, IOC_R, MK_PTR(TYPE_LONG))
> -#endif
> #ifdef CONFIG_FIEMAP
> IOCTL_SPECIAL(FS_IOC_FIEMAP, IOC_W | IOC_R, do_ioctl_fs_ioc_fiemap,
> MK_PTR(MK_STRUCT(STRUCT_fiemap)))
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 3/4] meson: enforce a minimum Linux kernel headers version >= 4.18
2022-10-04 9:32 ` [PATCH 3/4] meson: enforce a minimum Linux kernel headers version >= 4.18 Daniel P. Berrangé
2022-10-04 9:49 ` Peter Maydell
@ 2022-10-21 14:30 ` Laurent Vivier
2022-10-21 14:38 ` Peter Maydell
2022-10-27 10:50 ` Daniel P. Berrangé
2 siblings, 1 reply; 19+ messages in thread
From: Laurent Vivier @ 2022-10-21 14:30 UTC (permalink / raw)
To: Daniel P. Berrangé, qemu-devel
Cc: Eduardo Habkost, Richard Henderson, Paolo Bonzini, Peter Maydell
Le 04/10/2022 à 11:32, Daniel P. Berrangé a écrit :
> Various areas of QEMU have a dependency on Linux kernel header
> definitions. This falls under the scope of our supported platforms
> matrix, but historically we've not checked for a minimum kernel
> headers version. This has made it unclear when we can drop support
> for older kernel headers.
>
> * Alpine 3.14: 5.10
> * CentOS 8: 4.18
> * CentOS 9: 5.14
> * Debian 10: 4.19
> * Debian 11: 5.10
> * Fedora 35: 5.19
> * Fedora 36: 5.19
> * OpenSUSE 15.3: 5.3.0
> * Ubuntu 20.04: 5.4
> * Ubuntu 22.04: 5.15
>
> The above ignores the 3rd version digit since distros update their
> packages periodically and such updates don't generally affect public
> APIs to the extent that it matters for our build time check.
>
> Overall, we can set the baseline to 4.18 currently.
As this change affects entire QEMU build, I'd prefer to have some "Acked-by" before merging it via
linux-user branch.
Thanks,
Laurent
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 4/4] linux-user: drop conditionals for obsolete kernel header versions
2022-10-04 9:32 ` [PATCH 4/4] linux-user: drop conditionals for obsolete kernel header versions Daniel P. Berrangé
@ 2022-10-21 14:32 ` Laurent Vivier
0 siblings, 0 replies; 19+ messages in thread
From: Laurent Vivier @ 2022-10-21 14:32 UTC (permalink / raw)
To: Daniel P. Berrangé, qemu-devel
Cc: Eduardo Habkost, Richard Henderson, Paolo Bonzini
Le 04/10/2022 à 11:32, Daniel P. Berrangé a écrit :
> Given our newly enforced 4.18 baseline for the kernel headers version,
> we can drop any conditional checks for older versions.
>
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
> linux-user/linux_loop.h | 4 ----
> linux-user/syscall.c | 14 ++------------
> tests/tcg/i386/test-i386.c | 10 +++-------
> 3 files changed, 5 insertions(+), 23 deletions(-)
>
> diff --git a/linux-user/linux_loop.h b/linux-user/linux_loop.h
> index f80b96f1ff..5a9e0edef2 100644
> --- a/linux-user/linux_loop.h
> +++ b/linux-user/linux_loop.h
> @@ -31,10 +31,6 @@ enum {
> #include <asm/posix_types.h> /* for __kernel_old_dev_t */
> #include <asm/types.h> /* for __u64 */
>
> -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) /* This is a guess. */
> -#define __kernel_old_dev_t __kernel_dev_t
> -#endif
> -
> /* Backwards compatibility version */
> struct loop_info {
> int lo_number; /* ioctl r/o */
> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index f6a15df69d..377867907a 100644
> --- a/linux-user/syscall.c
> +++ b/linux-user/syscall.c
> @@ -2540,16 +2540,12 @@ set_timeout:
> case NETLINK_DROP_MEMBERSHIP:
> case NETLINK_BROADCAST_ERROR:
> case NETLINK_NO_ENOBUFS:
> -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
> case NETLINK_LISTEN_ALL_NSID:
> case NETLINK_CAP_ACK:
> -#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0) */
> -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
> case NETLINK_EXT_ACK:
> -#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) */
> #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0)
> case NETLINK_GET_STRICT_CHK:
> -#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) */
> +#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0) */
> break;
> default:
> goto unimplemented;
> @@ -2918,16 +2914,12 @@ get_timeout:
> case NETLINK_PKTINFO:
> case NETLINK_BROADCAST_ERROR:
> case NETLINK_NO_ENOBUFS:
> -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
> case NETLINK_LISTEN_ALL_NSID:
> case NETLINK_CAP_ACK:
> -#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0) */
> -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
> case NETLINK_EXT_ACK:
> -#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) */
> #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0)
> case NETLINK_GET_STRICT_CHK:
> -#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) */
> +#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0) */
> if (get_user_u32(len, optlen)) {
> return -TARGET_EFAULT;
> }
> @@ -2944,7 +2936,6 @@ get_timeout:
> return -TARGET_EFAULT;
> }
> break;
> -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
> case NETLINK_LIST_MEMBERSHIPS:
> {
> uint32_t *results;
> @@ -2975,7 +2966,6 @@ get_timeout:
> unlock_user(results, optval_addr, 0);
> break;
> }
> -#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0) */
> default:
> goto unimplemented;
> }
> diff --git a/tests/tcg/i386/test-i386.c b/tests/tcg/i386/test-i386.c
> index 864c4e620d..881b45cd19 100644
> --- a/tests/tcg/i386/test-i386.c
> +++ b/tests/tcg/i386/test-i386.c
> @@ -1224,10 +1224,6 @@ static inline int modify_ldt(int func, void * ptr, unsigned long bytecount)
> return syscall(__NR_modify_ldt, func, ptr, bytecount);
> }
>
> -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 66)
> -#define modify_ldt_ldt_s user_desc
> -#endif
> -
> #define MK_SEL(n) (((n) << 3) | 7)
>
> uint8_t seg_data1[4096];
> @@ -1265,7 +1261,7 @@ uint8_t seg_data2[4096];
> /* NOTE: we use Linux modify_ldt syscall */
> void test_segs(void)
> {
> - struct modify_ldt_ldt_s ldt;
> + struct user_desc ldt;
> long long ldt_table[3];
> int res, res2;
> char tmp;
> @@ -1367,7 +1363,7 @@ extern char code16_func3;
>
> void test_code16(void)
> {
> - struct modify_ldt_ldt_s ldt;
> + struct user_desc ldt;
> int res, res2;
>
> /* build a code segment */
> @@ -1774,7 +1770,7 @@ void test_exceptions(void)
> }
>
> {
> - struct modify_ldt_ldt_s ldt;
> + struct user_desc ldt;
> ldt.entry_number = 1;
> ldt.base_addr = (unsigned long)&seg_data1;
> ldt.limit = (sizeof(seg_data1) + 0xfff) >> 12;
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 3/4] meson: enforce a minimum Linux kernel headers version >= 4.18
2022-10-21 14:30 ` Laurent Vivier
@ 2022-10-21 14:38 ` Peter Maydell
2022-10-21 14:50 ` Daniel P. Berrangé
0 siblings, 1 reply; 19+ messages in thread
From: Peter Maydell @ 2022-10-21 14:38 UTC (permalink / raw)
To: Laurent Vivier
Cc: Daniel P. Berrangé,
qemu-devel, Eduardo Habkost, Richard Henderson, Paolo Bonzini
On Fri, 21 Oct 2022 at 15:30, Laurent Vivier <laurent@vivier.eu> wrote:
>
> Le 04/10/2022 à 11:32, Daniel P. Berrangé a écrit :
> > Various areas of QEMU have a dependency on Linux kernel header
> > definitions. This falls under the scope of our supported platforms
> > matrix, but historically we've not checked for a minimum kernel
> > headers version. This has made it unclear when we can drop support
> > for older kernel headers.
> >
> > * Alpine 3.14: 5.10
> > * CentOS 8: 4.18
> > * CentOS 9: 5.14
> > * Debian 10: 4.19
> > * Debian 11: 5.10
> > * Fedora 35: 5.19
> > * Fedora 36: 5.19
> > * OpenSUSE 15.3: 5.3.0
> > * Ubuntu 20.04: 5.4
> > * Ubuntu 22.04: 5.15
> >
> > The above ignores the 3rd version digit since distros update their
> > packages periodically and such updates don't generally affect public
> > APIs to the extent that it matters for our build time check.
> >
> > Overall, we can set the baseline to 4.18 currently.
>
> As this change affects entire QEMU build, I'd prefer to have some "Acked-by" before merging it via
> linux-user branch.
I still think we should be more conservative about kernel header
requirements than we are for other dependencies.
thanks
-- PMM
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 3/4] meson: enforce a minimum Linux kernel headers version >= 4.18
2022-10-21 14:38 ` Peter Maydell
@ 2022-10-21 14:50 ` Daniel P. Berrangé
2022-10-21 15:05 ` Peter Maydell
2022-10-21 16:50 ` Alex Bennée
0 siblings, 2 replies; 19+ messages in thread
From: Daniel P. Berrangé @ 2022-10-21 14:50 UTC (permalink / raw)
To: Peter Maydell
Cc: Laurent Vivier, qemu-devel, Eduardo Habkost, Richard Henderson,
Paolo Bonzini
On Fri, Oct 21, 2022 at 03:38:38PM +0100, Peter Maydell wrote:
> On Fri, 21 Oct 2022 at 15:30, Laurent Vivier <laurent@vivier.eu> wrote:
> >
> > Le 04/10/2022 à 11:32, Daniel P. Berrangé a écrit :
> > > Various areas of QEMU have a dependency on Linux kernel header
> > > definitions. This falls under the scope of our supported platforms
> > > matrix, but historically we've not checked for a minimum kernel
> > > headers version. This has made it unclear when we can drop support
> > > for older kernel headers.
> > >
> > > * Alpine 3.14: 5.10
> > > * CentOS 8: 4.18
> > > * CentOS 9: 5.14
> > > * Debian 10: 4.19
> > > * Debian 11: 5.10
> > > * Fedora 35: 5.19
> > > * Fedora 36: 5.19
> > > * OpenSUSE 15.3: 5.3.0
> > > * Ubuntu 20.04: 5.4
> > > * Ubuntu 22.04: 5.15
> > >
> > > The above ignores the 3rd version digit since distros update their
> > > packages periodically and such updates don't generally affect public
> > > APIs to the extent that it matters for our build time check.
> > >
> > > Overall, we can set the baseline to 4.18 currently.
> >
> > As this change affects entire QEMU build, I'd prefer to have some "Acked-by" before merging it via
> > linux-user branch.
>
> I still think we should be more conservative about kernel header
> requirements than we are for other dependencies.
How much more though ? What other distros do we want to target that
we don't already cover with our targetted platforms ?
With regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 3/4] meson: enforce a minimum Linux kernel headers version >= 4.18
2022-10-21 14:50 ` Daniel P. Berrangé
@ 2022-10-21 15:05 ` Peter Maydell
2022-10-21 15:28 ` Daniel P. Berrangé
2022-10-21 16:50 ` Alex Bennée
1 sibling, 1 reply; 19+ messages in thread
From: Peter Maydell @ 2022-10-21 15:05 UTC (permalink / raw)
To: Daniel P. Berrangé
Cc: Laurent Vivier, qemu-devel, Eduardo Habkost, Richard Henderson,
Paolo Bonzini
On Fri, 21 Oct 2022 at 15:50, Daniel P. Berrangé <berrange@redhat.com> wrote:
>
> On Fri, Oct 21, 2022 at 03:38:38PM +0100, Peter Maydell wrote:
> > On Fri, 21 Oct 2022 at 15:30, Laurent Vivier <laurent@vivier.eu> wrote:
> > >
> > > Le 04/10/2022 à 11:32, Daniel P. Berrangé a écrit :
> > > > Various areas of QEMU have a dependency on Linux kernel header
> > > > definitions. This falls under the scope of our supported platforms
> > > > matrix, but historically we've not checked for a minimum kernel
> > > > headers version. This has made it unclear when we can drop support
> > > > for older kernel headers.
> > > >
> > > > * Alpine 3.14: 5.10
> > > > * CentOS 8: 4.18
> > > > * CentOS 9: 5.14
> > > > * Debian 10: 4.19
> > > > * Debian 11: 5.10
> > > > * Fedora 35: 5.19
> > > > * Fedora 36: 5.19
> > > > * OpenSUSE 15.3: 5.3.0
> > > > * Ubuntu 20.04: 5.4
> > > > * Ubuntu 22.04: 5.15
> > > >
> > > > The above ignores the 3rd version digit since distros update their
> > > > packages periodically and such updates don't generally affect public
> > > > APIs to the extent that it matters for our build time check.
> > > >
> > > > Overall, we can set the baseline to 4.18 currently.
> > >
> > > As this change affects entire QEMU build, I'd prefer to have some "Acked-by" before merging it via
> > > linux-user branch.
> >
> > I still think we should be more conservative about kernel header
> > requirements than we are for other dependencies.
>
> How much more though ? What other distros do we want to target that
> we don't already cover with our targetted platforms ?
I don't want to target them. I just don't want to leave them
completely stuck. I think system headers are significantly
different from just needing to build a local version of some
dependency library.
Alternatively if we really need recent kernel headers to build
linux-user then we should come up with some scheme for using
a local copy of the relevant headers, as we do for KVM...
-- PMM
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 1/4] linux-user: add more compat ioctl definitions
2022-10-04 9:32 ` [PATCH 1/4] linux-user: add more compat ioctl definitions Daniel P. Berrangé
2022-10-21 14:21 ` Laurent Vivier
@ 2022-10-21 15:17 ` Laurent Vivier
1 sibling, 0 replies; 19+ messages in thread
From: Laurent Vivier @ 2022-10-21 15:17 UTC (permalink / raw)
To: Daniel P. Berrangé, qemu-devel
Cc: Eduardo Habkost, Richard Henderson, Paolo Bonzini
Le 04/10/2022 à 11:32, Daniel P. Berrangé a écrit :
> GLibc changes prevent us from including linux/fs.h anymore,
> and we previously adjusted to this in
>
> commit 3cd3df2a9584e6f753bb62a0028bd67124ab5532
> Author: Daniel P. Berrangé <berrange@redhat.com>
> Date: Tue Aug 2 12:41:34 2022 -0400
>
> linux-user: fix compat with glibc >= 2.36 sys/mount.h
>
> That change required adding compat ioctl definitions on the
> QEMU side for any ioctls that we would otherwise obtain
> from linux/fs.h. This commit adds more that were initially
> missed, due to their usage being conditionalized in QEMU.
>
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
> linux-user/syscall.c | 25 +++++++++++++++++++++++++
> 1 file changed, 25 insertions(+)
>
> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index 2e954d8dbd..f6a15df69d 100644
> --- a/linux-user/syscall.c
> +++ b/linux-user/syscall.c
> @@ -111,6 +111,31 @@
> #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 <linux/fs.h>
> #endif
Applied to my linux-user-for-7.2 branch.
Thanks,
Laurent
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 2/4] linux-user: remove conditionals for many fs.h ioctls
2022-10-04 9:32 ` [PATCH 2/4] linux-user: remove conditionals for many fs.h ioctls Daniel P. Berrangé
2022-10-21 14:21 ` Laurent Vivier
@ 2022-10-21 15:17 ` Laurent Vivier
1 sibling, 0 replies; 19+ messages in thread
From: Laurent Vivier @ 2022-10-21 15:17 UTC (permalink / raw)
To: Daniel P. Berrangé, qemu-devel
Cc: Eduardo Habkost, Richard Henderson, Paolo Bonzini
Le 04/10/2022 à 11:32, Daniel P. Berrangé a écrit :
> These ioctls have been defined in linux/fs.h for a long time
>
> * BLKGETSIZE64 - <2.6.12 (linux.git epoch)
> * BLKDISCARD - 2.6.28 (d30a2605be9d5132d95944916e8f578fcfe4f976)
> * BLKIOMIN - 2.6.32 (ac481c20ef8f6c6f2be75d581863f40c43874ef7)
> * BLKIOOPT - 2.6.32 (ac481c20ef8f6c6f2be75d581863f40c43874ef7)
> * BLKALIGNOFF - 2.6.32 (ac481c20ef8f6c6f2be75d581863f40c43874ef7)
> * BLKPBSZGET - 2.6.32 (ac481c20ef8f6c6f2be75d581863f40c43874ef7)
> * BLKDISCARDZEROES - 2.6.32 (98262f2762f0067375f83824d81ea929e37e6bfe)
> * BLKSECDISCARD - 2.6.36 (8d57a98ccd0b4489003473979da8f5a1363ba7a3)
> * BLKROTATIONAL - 3.2 (ef00f59c95fe6e002e7c6e3663cdea65e253f4cc)
> * BLKZEROOUT - 3.6 (66ba32dc167202c3cf8c86806581a9393ec7f488)
> * FIBMAP - <2.6.12 (linux.git epoch)
> * FIGETBSZ - <2.6.12 (linux.git epoch)
>
> and when building with latest glibc, we'll see compat definitions
> in syscall.c anyway thanks to the previous patch. Thus we can
> assume they always exist and remove the conditional checks.
>
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
> linux-user/ioctls.h | 24 ------------------------
> 1 file changed, 24 deletions(-)
>
> diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h
> index f182d40190..071f7ca253 100644
> --- a/linux-user/ioctls.h
> +++ b/linux-user/ioctls.h
> @@ -96,9 +96,7 @@
> IOCTL(BLKROGET, IOC_R, MK_PTR(TYPE_INT))
> IOCTL(BLKRRPART, 0, TYPE_NULL)
> IOCTL(BLKGETSIZE, IOC_R, MK_PTR(TYPE_ULONG))
> -#ifdef BLKGETSIZE64
> IOCTL(BLKGETSIZE64, IOC_R, MK_PTR(TYPE_ULONGLONG))
> -#endif
> IOCTL(BLKFLSBUF, 0, TYPE_NULL)
> IOCTL(BLKRASET, 0, TYPE_INT)
> IOCTL(BLKRAGET, IOC_R, MK_PTR(TYPE_LONG))
> @@ -107,33 +105,15 @@
> IOCTL_SPECIAL(BLKPG, IOC_W, do_ioctl_blkpg,
> MK_PTR(MK_STRUCT(STRUCT_blkpg_ioctl_arg)))
>
> -#ifdef BLKDISCARD
> IOCTL(BLKDISCARD, IOC_W, MK_PTR(MK_ARRAY(TYPE_ULONGLONG, 2)))
> -#endif
> -#ifdef BLKIOMIN
> IOCTL(BLKIOMIN, IOC_R, MK_PTR(TYPE_INT))
> -#endif
> -#ifdef BLKIOOPT
> IOCTL(BLKIOOPT, IOC_R, MK_PTR(TYPE_INT))
> -#endif
> -#ifdef BLKALIGNOFF
> IOCTL(BLKALIGNOFF, IOC_R, MK_PTR(TYPE_INT))
> -#endif
> -#ifdef BLKPBSZGET
> IOCTL(BLKPBSZGET, IOC_R, MK_PTR(TYPE_INT))
> -#endif
> -#ifdef BLKDISCARDZEROES
> IOCTL(BLKDISCARDZEROES, IOC_R, MK_PTR(TYPE_INT))
> -#endif
> -#ifdef BLKSECDISCARD
> IOCTL(BLKSECDISCARD, IOC_W, MK_PTR(MK_ARRAY(TYPE_ULONGLONG, 2)))
> -#endif
> -#ifdef BLKROTATIONAL
> IOCTL(BLKROTATIONAL, IOC_R, MK_PTR(TYPE_SHORT))
> -#endif
> -#ifdef BLKZEROOUT
> IOCTL(BLKZEROOUT, IOC_W, MK_PTR(MK_ARRAY(TYPE_ULONGLONG, 2)))
> -#endif
>
> IOCTL(FDMSGON, 0, TYPE_NULL)
> IOCTL(FDMSGOFF, 0, TYPE_NULL)
> @@ -149,17 +129,13 @@
> IOCTL(FDTWADDLE, 0, TYPE_NULL)
> IOCTL(FDEJECT, 0, TYPE_NULL)
>
> -#ifdef FIBMAP
> IOCTL(FIBMAP, IOC_W | IOC_R, MK_PTR(TYPE_LONG))
> -#endif
> #ifdef FICLONE
> IOCTL(FICLONE, IOC_W, TYPE_INT)
> IOCTL(FICLONERANGE, IOC_W, MK_PTR(MK_STRUCT(STRUCT_file_clone_range)))
> #endif
>
> -#ifdef FIGETBSZ
> IOCTL(FIGETBSZ, IOC_R, MK_PTR(TYPE_LONG))
> -#endif
> #ifdef CONFIG_FIEMAP
> IOCTL_SPECIAL(FS_IOC_FIEMAP, IOC_W | IOC_R, do_ioctl_fs_ioc_fiemap,
> MK_PTR(MK_STRUCT(STRUCT_fiemap)))
Applied to my linux-user-for-7.2 branch.
Thanks,
Laurent
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 3/4] meson: enforce a minimum Linux kernel headers version >= 4.18
2022-10-21 15:05 ` Peter Maydell
@ 2022-10-21 15:28 ` Daniel P. Berrangé
0 siblings, 0 replies; 19+ messages in thread
From: Daniel P. Berrangé @ 2022-10-21 15:28 UTC (permalink / raw)
To: Peter Maydell
Cc: Laurent Vivier, qemu-devel, Eduardo Habkost, Richard Henderson,
Paolo Bonzini
On Fri, Oct 21, 2022 at 04:05:27PM +0100, Peter Maydell wrote:
> On Fri, 21 Oct 2022 at 15:50, Daniel P. Berrangé <berrange@redhat.com> wrote:
> >
> > On Fri, Oct 21, 2022 at 03:38:38PM +0100, Peter Maydell wrote:
> > > On Fri, 21 Oct 2022 at 15:30, Laurent Vivier <laurent@vivier.eu> wrote:
> > > >
> > > > Le 04/10/2022 à 11:32, Daniel P. Berrangé a écrit :
> > > > > Various areas of QEMU have a dependency on Linux kernel header
> > > > > definitions. This falls under the scope of our supported platforms
> > > > > matrix, but historically we've not checked for a minimum kernel
> > > > > headers version. This has made it unclear when we can drop support
> > > > > for older kernel headers.
> > > > >
> > > > > * Alpine 3.14: 5.10
> > > > > * CentOS 8: 4.18
> > > > > * CentOS 9: 5.14
> > > > > * Debian 10: 4.19
> > > > > * Debian 11: 5.10
> > > > > * Fedora 35: 5.19
> > > > > * Fedora 36: 5.19
> > > > > * OpenSUSE 15.3: 5.3.0
> > > > > * Ubuntu 20.04: 5.4
> > > > > * Ubuntu 22.04: 5.15
> > > > >
> > > > > The above ignores the 3rd version digit since distros update their
> > > > > packages periodically and such updates don't generally affect public
> > > > > APIs to the extent that it matters for our build time check.
> > > > >
> > > > > Overall, we can set the baseline to 4.18 currently.
> > > >
> > > > As this change affects entire QEMU build, I'd prefer to have some "Acked-by" before merging it via
> > > > linux-user branch.
> > >
> > > I still think we should be more conservative about kernel header
> > > requirements than we are for other dependencies.
> >
> > How much more though ? What other distros do we want to target that
> > we don't already cover with our targetted platforms ?
>
> I don't want to target them. I just don't want to leave them
> completely stuck. I think system headers are significantly
> different from just needing to build a local version of some
> dependency library.
>
> Alternatively if we really need recent kernel headers to build
> linux-user then we should come up with some scheme for using
> a local copy of the relevant headers, as we do for KVM...
This wasn't so much about needing recent headers, rather it was
about removing conditionals that are not likely to be needed by
anyone. I wanted to set a min kernel version to make it clearer
to future authors how far back they need to care about compat
for.
The next patch removed conditions for:
2.5.66 (??)
2.6.0 (Dec 2003)
4.2 (Aug 2015)
4.12 (Jul 2017)
I can't imagine anyone needs 2.6.x support. Perhaps 4.x if
someone is still using RHEL-7 though
With regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 3/4] meson: enforce a minimum Linux kernel headers version >= 4.18
2022-10-21 14:50 ` Daniel P. Berrangé
2022-10-21 15:05 ` Peter Maydell
@ 2022-10-21 16:50 ` Alex Bennée
1 sibling, 0 replies; 19+ messages in thread
From: Alex Bennée @ 2022-10-21 16:50 UTC (permalink / raw)
To: Daniel P. Berrangé
Cc: Peter Maydell, Laurent Vivier, Eduardo Habkost,
Richard Henderson, Paolo Bonzini, qemu-devel
Daniel P. Berrangé <berrange@redhat.com> writes:
> On Fri, Oct 21, 2022 at 03:38:38PM +0100, Peter Maydell wrote:
>> On Fri, 21 Oct 2022 at 15:30, Laurent Vivier <laurent@vivier.eu> wrote:
>> >
>> > Le 04/10/2022 à 11:32, Daniel P. Berrangé a écrit :
>> > > Various areas of QEMU have a dependency on Linux kernel header
>> > > definitions. This falls under the scope of our supported platforms
>> > > matrix, but historically we've not checked for a minimum kernel
>> > > headers version. This has made it unclear when we can drop support
>> > > for older kernel headers.
>> > >
>> > > * Alpine 3.14: 5.10
>> > > * CentOS 8: 4.18
>> > > * CentOS 9: 5.14
>> > > * Debian 10: 4.19
>> > > * Debian 11: 5.10
>> > > * Fedora 35: 5.19
>> > > * Fedora 36: 5.19
>> > > * OpenSUSE 15.3: 5.3.0
>> > > * Ubuntu 20.04: 5.4
>> > > * Ubuntu 22.04: 5.15
>> > >
>> > > The above ignores the 3rd version digit since distros update their
>> > > packages periodically and such updates don't generally affect public
>> > > APIs to the extent that it matters for our build time check.
>> > >
>> > > Overall, we can set the baseline to 4.18 currently.
>> >
>> > As this change affects entire QEMU build, I'd prefer to have some "Acked-by" before merging it via
>> > linux-user branch.
>>
>> I still think we should be more conservative about kernel header
>> requirements than we are for other dependencies.
>
> How much more though ? What other distros do we want to target that
> we don't already cover with our targetted platforms ?
Well purely selfishly the big build box I have access to is still on
18.04 which is currently running 4.15.0-191-generic. It will hopefully
get upgraded before 18.04 goes out of support from Canonical. From a
practical point of view it will be a pain if I can't bisect on it in the
meantime.
>
>
> With regards,
> Daniel
--
Alex Bennée
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 3/4] meson: enforce a minimum Linux kernel headers version >= 4.18
2022-10-04 9:32 ` [PATCH 3/4] meson: enforce a minimum Linux kernel headers version >= 4.18 Daniel P. Berrangé
2022-10-04 9:49 ` Peter Maydell
2022-10-21 14:30 ` Laurent Vivier
@ 2022-10-27 10:50 ` Daniel P. Berrangé
2 siblings, 0 replies; 19+ messages in thread
From: Daniel P. Berrangé @ 2022-10-27 10:50 UTC (permalink / raw)
To: qemu-devel
Cc: Laurent Vivier, Eduardo Habkost, Richard Henderson, Paolo Bonzini
On Tue, Oct 04, 2022 at 10:32:05AM +0100, Daniel P. Berrangé wrote:
> Various areas of QEMU have a dependency on Linux kernel header
> definitions. This falls under the scope of our supported platforms
> matrix, but historically we've not checked for a minimum kernel
> headers version. This has made it unclear when we can drop support
> for older kernel headers.
>
> * Alpine 3.14: 5.10
> * CentOS 8: 4.18
> * CentOS 9: 5.14
> * Debian 10: 4.19
> * Debian 11: 5.10
> * Fedora 35: 5.19
> * Fedora 36: 5.19
> * OpenSUSE 15.3: 5.3.0
> * Ubuntu 20.04: 5.4
> * Ubuntu 22.04: 5.15
>
> The above ignores the 3rd version digit since distros update their
> packages periodically and such updates don't generally affect public
> APIs to the extent that it matters for our build time check.
>
> Overall, we can set the baseline to 4.18 currently.
>
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
> meson.build | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
Since there's no agreement, I'll just consider this patch discarded,
along with the next one. I won't repost since Laurent has already
queued the first two patches.
With regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
^ permalink raw reply [flat|nested] 19+ messages in thread
end of thread, other threads:[~2022-10-27 10:53 UTC | newest]
Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-04 9:32 [PATCH 0/4] linux-user: fix regression with some ioctls with newest glibc Daniel P. Berrangé
2022-10-04 9:32 ` [PATCH 1/4] linux-user: add more compat ioctl definitions Daniel P. Berrangé
2022-10-21 14:21 ` Laurent Vivier
2022-10-21 15:17 ` Laurent Vivier
2022-10-04 9:32 ` [PATCH 2/4] linux-user: remove conditionals for many fs.h ioctls Daniel P. Berrangé
2022-10-21 14:21 ` Laurent Vivier
2022-10-21 15:17 ` Laurent Vivier
2022-10-04 9:32 ` [PATCH 3/4] meson: enforce a minimum Linux kernel headers version >= 4.18 Daniel P. Berrangé
2022-10-04 9:49 ` Peter Maydell
2022-10-04 10:00 ` Daniel P. Berrangé
2022-10-21 14:30 ` Laurent Vivier
2022-10-21 14:38 ` Peter Maydell
2022-10-21 14:50 ` Daniel P. Berrangé
2022-10-21 15:05 ` Peter Maydell
2022-10-21 15:28 ` Daniel P. Berrangé
2022-10-21 16:50 ` Alex Bennée
2022-10-27 10:50 ` Daniel P. Berrangé
2022-10-04 9:32 ` [PATCH 4/4] linux-user: drop conditionals for obsolete kernel header versions Daniel P. Berrangé
2022-10-21 14:32 ` Laurent Vivier
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.