Message ID | 20221004093206.652431-5-berrange@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | linux-user: fix regression with some ioctls with newest glibc | expand |
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>
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;
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(-)