Patchwork Update kernel-features.h files for Linux 5.1

login
register
mail settings
Submitter Joseph Myers
Date May 13, 2019, 9:33 p.m.
Message ID <alpine.DEB.2.21.1905132132440.14012@digraph.polyomino.org.uk>
Download mbox | patch
Permalink /patch/32665/
State New
Headers show

Comments

Joseph Myers - May 13, 2019, 9:33 p.m.
On Fri, 10 May 2019, Stepan Golosunov wrote:

> The newly added direct ipc syscalls are different from the old ones:

Thanks for pointing this out.  Here's a revised patch version with the 
__ASSUME_DIRECT_SYSVIPC_SYSCALLS changes removed.


Update kernel-features.h files for Linux 5.1.

Linux 5.1 adds missing syscalls to the syscall table for many Linux
kernel architectures.  This patch updates the kernel-features.h
headers accordingly.  __ASSUME_DIRECT_SYSVIPC_SYSCALLS is not updated
because of the differences between new and old syscalls described in
<https://sourceware.org/ml/libc-alpha/2019-05/msg00235.html>.  I
believe the statfs64 structure used by alpha matches what the new
kernel syscalls use, but that should be reviewed carefully.

Tested with build-many-glibcs.py.

2019-05-13  Joseph Myers  <joseph@codesourcery.com>

	* sysdeps/unix/sysv/linux/alpha/kernel-features.h
	(__ASSUME_STATFS64): Only undefine if [__LINUX_KERNEL_VERSION <
	0x050100].
	* sysdeps/unix/sysv/linux/ia64/kernel-features.h (__ASSUME_STATX):
	Likewise.
	* sysdeps/unix/sysv/linux/sh/kernel-features.h
	(__ASSUME_STATX): Likewise.
Adhemerval Zanella Netto - May 16, 2019, 3:06 p.m.
On 13/05/2019 18:33, Joseph Myers wrote:
> On Fri, 10 May 2019, Stepan Golosunov wrote:
> 
>> The newly added direct ipc syscalls are different from the old ones:
> 
> Thanks for pointing this out.  Here's a revised patch version with the 
> __ASSUME_DIRECT_SYSVIPC_SYSCALLS changes removed.
> 
> 
> Update kernel-features.h files for Linux 5.1.
> 
> Linux 5.1 adds missing syscalls to the syscall table for many Linux
> kernel architectures.  This patch updates the kernel-features.h
> headers accordingly.  __ASSUME_DIRECT_SYSVIPC_SYSCALLS is not updated
> because of the differences between new and old syscalls described in
> <https://sourceware.org/ml/libc-alpha/2019-05/msg00235.html>.  I
> believe the statfs64 structure used by alpha matches what the new
> kernel syscalls use, but that should be reviewed carefully.
> 
> Tested with build-many-glibcs.py.

LGTM.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>

> 
> 2019-05-13  Joseph Myers  <joseph@codesourcery.com>
> 
> 	* sysdeps/unix/sysv/linux/alpha/kernel-features.h
> 	(__ASSUME_STATFS64): Only undefine if [__LINUX_KERNEL_VERSION <
> 	0x050100].
> 	* sysdeps/unix/sysv/linux/ia64/kernel-features.h (__ASSUME_STATX):
> 	Likewise.
> 	* sysdeps/unix/sysv/linux/sh/kernel-features.h
> 	(__ASSUME_STATX): Likewise.
> 
> diff --git a/sysdeps/unix/sysv/linux/alpha/kernel-features.h b/sysdeps/unix/sysv/linux/alpha/kernel-features.h
> index f3298b234e..4a5d029c1d 100644
> --- a/sysdeps/unix/sysv/linux/alpha/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/alpha/kernel-features.h
> @@ -22,9 +22,11 @@
>  
>  #include_next <kernel-features.h>
>  
> -/* There never has been support for fstat64.  */
> -#undef __ASSUME_STATFS64
> -#define __ASSUME_STATFS64 0
> +/* Support for statfs64 was added in 5.1.  */
> +#if __LINUX_KERNEL_VERSION < 0x050100
> +# undef __ASSUME_STATFS64
> +# define __ASSUME_STATFS64 0
> +#endif

Ok, alpha statfs64 used on syscall entry points defines the structure as

--
typedef unsigned int __u32;
__extension__ typedef unsigned long long __u64;

typedef struct {
 int val[2];
} __kernel_fsid_t;

struct statfs64 {
 __u32 f_type;
 __u32 f_bsize;
 __u64 f_blocks;
 __u64 f_bfree;
 __u64 f_bavail;
 __u64 f_files;
 __u64 f_ffree;
 __kernel_fsid_t f_fsid;
 __u32 f_namelen;
 __u32 f_frsize;
 __u32 f_flags;
 __u32 f_spare[4];
} ;
--

While glibc does:

--

#define __S64_TYPE             long int
#define __FSBLKCNT64_T_TYPE    __S64_TYPE
__STD_TYPE __FSBLKCNT64_T_TYPE __fsblkcnt64_t;

#define __FSID_T_TYPE          struct { int __val[2]; }
__STD_TYPE __FSID_T_TYPE       __fsid_t;

struct statfs64
  { 
    int f_type;
    int f_bsize;
    __fsblkcnt64_t f_blocks;
    __fsblkcnt64_t f_bfree;
    __fsblkcnt64_t f_bavail;
    __fsfilcnt64_t f_files;
    __fsfilcnt64_t f_ffree;
    __fsid_t f_fsid;
    int f_namelen;
    int f_frsize;
    int f_flags;
    int f_spare[4];
  };
--

My understanding is __u64 and __fsblkcnt64_t should have identical sizes on
alpha.

>  
>  /* Alpha used to define SysV ipc shmat syscall with a different name.  */
>  #ifndef __NR_shmat
> diff --git a/sysdeps/unix/sysv/linux/ia64/kernel-features.h b/sysdeps/unix/sysv/linux/ia64/kernel-features.h
> index 0f4948b8e0..333947931d 100644
> --- a/sysdeps/unix/sysv/linux/ia64/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/ia64/kernel-features.h
> @@ -26,8 +26,10 @@
>  #define __ASSUME_SEND_SYSCALL		1
>  #define __ASSUME_ACCEPT4_SYSCALL	1
>  
> -/* No statx system call on ia64 yet.  */
> -#undef __ASSUME_STATX
> +/* Support for statx was added in 5.1.  */
> +#if __LINUX_KERNEL_VERSION < 0x050100
> +# undef __ASSUME_STATX
> +#endif
>  
>  #undef __ASSUME_CLONE_DEFAULT
>  #define __ASSUME_CLONE2

Ok (commit 7349ee3a97edbec60ada97e81b26b9c20e96156b).

> diff --git a/sysdeps/unix/sysv/linux/sh/kernel-features.h b/sysdeps/unix/sysv/linux/sh/kernel-features.h
> index 767df721b8..b11a5cb544 100644
> --- a/sysdeps/unix/sysv/linux/sh/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/sh/kernel-features.h
> @@ -52,7 +52,9 @@
>  # undef __ASSUME_COPY_FILE_RANGE
>  #endif
>  
> -/* sh does not support the statx system call.  */
> -#undef __ASSUME_STATX
> +/* sh does not support the statx system call before 5.1.  */
> +#if __LINUX_KERNEL_VERSION < 0x050100
> +# undef __ASSUME_STATX
> +#endif
>  
>  #endif
> 

Ok (commit d25a122afd4374071bb8489a980051da37136ee1).

Patch

diff --git a/sysdeps/unix/sysv/linux/alpha/kernel-features.h b/sysdeps/unix/sysv/linux/alpha/kernel-features.h
index f3298b234e..4a5d029c1d 100644
--- a/sysdeps/unix/sysv/linux/alpha/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/alpha/kernel-features.h
@@ -22,9 +22,11 @@ 
 
 #include_next <kernel-features.h>
 
-/* There never has been support for fstat64.  */
-#undef __ASSUME_STATFS64
-#define __ASSUME_STATFS64 0
+/* Support for statfs64 was added in 5.1.  */
+#if __LINUX_KERNEL_VERSION < 0x050100
+# undef __ASSUME_STATFS64
+# define __ASSUME_STATFS64 0
+#endif
 
 /* Alpha used to define SysV ipc shmat syscall with a different name.  */
 #ifndef __NR_shmat
diff --git a/sysdeps/unix/sysv/linux/ia64/kernel-features.h b/sysdeps/unix/sysv/linux/ia64/kernel-features.h
index 0f4948b8e0..333947931d 100644
--- a/sysdeps/unix/sysv/linux/ia64/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/ia64/kernel-features.h
@@ -26,8 +26,10 @@ 
 #define __ASSUME_SEND_SYSCALL		1
 #define __ASSUME_ACCEPT4_SYSCALL	1
 
-/* No statx system call on ia64 yet.  */
-#undef __ASSUME_STATX
+/* Support for statx was added in 5.1.  */
+#if __LINUX_KERNEL_VERSION < 0x050100
+# undef __ASSUME_STATX
+#endif
 
 #undef __ASSUME_CLONE_DEFAULT
 #define __ASSUME_CLONE2
diff --git a/sysdeps/unix/sysv/linux/sh/kernel-features.h b/sysdeps/unix/sysv/linux/sh/kernel-features.h
index 767df721b8..b11a5cb544 100644
--- a/sysdeps/unix/sysv/linux/sh/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/sh/kernel-features.h
@@ -52,7 +52,9 @@ 
 # undef __ASSUME_COPY_FILE_RANGE
 #endif
 
-/* sh does not support the statx system call.  */
-#undef __ASSUME_STATX
+/* sh does not support the statx system call before 5.1.  */
+#if __LINUX_KERNEL_VERSION < 0x050100
+# undef __ASSUME_STATX
+#endif
 
 #endif