Skip to content

Commit bf4b6a7

Browse files
committed
y2038: Remove stat64 family from default syscall set
New architectures should no longer need stat64, which is not y2038 safe and has been replaced by statx(). This removes the 'select __ARCH_WANT_STAT64' statement from asm-generic/unistd.h and instead moves it into the respective asm/unistd.h UAPI header files for each architecture that uses it today. In the generic file, the system call number and entry points are now made conditional, so newly added architectures (e.g. riscv32 or csky) will never need to carry backwards compatiblity for it. arm64 is the only 64-bit architecture using the asm-generic/unistd.h file, and it already sets __ARCH_WANT_NEW_STAT in its headers, and I use the same #ifdef here: future 64-bit architectures therefore won't see newstat or stat64 any more. They don't suffer from the y2038 time_t overflow, but for consistency it seems best to also let them use statx(). Signed-off-by: Arnd Bergmann <arnd@arndb.de>
1 parent 82b355d commit bf4b6a7

File tree

10 files changed

+10
-1
lines changed

10 files changed

+10
-1
lines changed

arch/arc/include/uapi/asm/unistd.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#define _UAPI_ASM_ARC_UNISTD_H
1818

1919
#define __ARCH_WANT_RENAMEAT
20+
#define __ARCH_WANT_STAT64
2021
#define __ARCH_WANT_SYS_EXECVE
2122
#define __ARCH_WANT_SYS_CLONE
2223
#define __ARCH_WANT_SYS_VFORK

arch/c6x/include/uapi/asm/unistd.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
*/
1717

1818
#define __ARCH_WANT_RENAMEAT
19+
#define __ARCH_WANT_STAT64
1920
#define __ARCH_WANT_SYS_CLONE
2021

2122
/* Use the standard ABI for syscalls. */

arch/h8300/include/uapi/asm/unistd.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#define __ARCH_NOMMU
22

33
#define __ARCH_WANT_RENAMEAT
4+
#define __ARCH_WANT_STAT64
45

56
#include <asm-generic/unistd.h>

arch/hexagon/include/uapi/asm/unistd.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929

3030
#define sys_mmap2 sys_mmap_pgoff
3131
#define __ARCH_WANT_RENAMEAT
32+
#define __ARCH_WANT_STAT64
3233
#define __ARCH_WANT_SYS_EXECVE
3334
#define __ARCH_WANT_SYS_CLONE
3435
#define __ARCH_WANT_SYS_VFORK

arch/nds32/include/uapi/asm/unistd.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// SPDX-License-Identifier: GPL-2.0
22
// Copyright (C) 2005-2017 Andes Technology Corporation
33

4+
#define __ARCH_WANT_STAT64
45
#define __ARCH_WANT_SYNC_FILE_RANGE2
56

67
/* Use the standard ABI for syscalls */

arch/nios2/include/uapi/asm/unistd.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#define sys_mmap2 sys_mmap_pgoff
2020

2121
#define __ARCH_WANT_RENAMEAT
22+
#define __ARCH_WANT_STAT64
2223

2324
/* Use the standard ABI for syscalls */
2425
#include <asm-generic/unistd.h>

arch/openrisc/include/uapi/asm/unistd.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#define sys_mmap2 sys_mmap_pgoff
2121

2222
#define __ARCH_WANT_RENAMEAT
23+
#define __ARCH_WANT_STAT64
2324
#define __ARCH_WANT_SYS_FORK
2425
#define __ARCH_WANT_SYS_CLONE
2526

arch/unicore32/include/uapi/asm/unistd.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@
1515

1616
/* Use the standard ABI for syscalls. */
1717
#include <asm-generic/unistd.h>
18+
#define __ARCH_WANT_STAT64
1819
#define __ARCH_WANT_SYS_CLONE

include/asm-generic/unistd.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,5 @@
88
* be selected by default.
99
*/
1010
#if __BITS_PER_LONG == 32
11-
#define __ARCH_WANT_STAT64
1211
#define __ARCH_WANT_SYS_LLSEEK
1312
#endif

include/uapi/asm-generic/unistd.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,10 +242,12 @@ __SYSCALL(__NR_tee, sys_tee)
242242
/* fs/stat.c */
243243
#define __NR_readlinkat 78
244244
__SYSCALL(__NR_readlinkat, sys_readlinkat)
245+
#if defined(__ARCH_WANT_NEW_STAT) || defined(__ARCH_WANT_STAT64)
245246
#define __NR3264_fstatat 79
246247
__SC_3264(__NR3264_fstatat, sys_fstatat64, sys_newfstatat)
247248
#define __NR3264_fstat 80
248249
__SC_3264(__NR3264_fstat, sys_fstat64, sys_newfstat)
250+
#endif
249251

250252
/* fs/sync.c */
251253
#define __NR_sync 81

0 commit comments

Comments
 (0)