Skip to content

Commit

Permalink
Merge tag 'y2038-syscall-cleanup' of git://git.kernel.org:/pub/scm/li…
Browse files Browse the repository at this point in the history
…nux/kernel/git/arnd/playground into timers/2038

Pull preparatory work for y2038 changes from Arnd Bergmann:

System call unification and cleanup

The system call tables have diverged a bit over the years, and a number of
the recent additions never made it into all architectures, for one reason
or another.

This is an attempt to clean it up as far as we can without breaking
compatibility, doing a number of steps:

 - Add system calls that have not yet been integrated into all architectures
   but that we definitely want there. This includes {,f}statfs64() and
   get{eg,eu,g,p,u,pp}id() on alpha, which have been missing traditionally.

 - The s390 compat syscall handling is cleaned up to be more like what we
   do on other architectures, while keeping the 31-bit pointer
   extension. This was merged as a shared branch by the s390 maintainers
   and is included here in order to base the other patches on top.

 - Add the separate ipc syscalls on all architectures that traditionally
   only had sys_ipc(). This version is done without support for IPC_OLD
   that is we have in sys_ipc. The new semtimedop_time64 syscall will only
   be added here, not in sys_ipc

 - Add syscall numbers for a couple of syscalls that we probably don't need
   everywhere, in particular pkey_* and rseq, for the purpose of symmetry:
   if it's in asm-generic/unistd.h, it makes sense to have it everywhere. I
   expect that any future system calls will get assigned on all platforms
   together, even when they appear to be specific to a single architecture.

 - Prepare for having the same system call numbers for any future calls. In
   combination with the generated tables, this hopefully makes it easier to
   add new calls across all architectures together.

All of the above are technically separate from the y2038 work, but are done
as preparation before we add the new 64-bit time_t system calls everywhere,
providing a common baseline set of system calls.

I expect that glibc and other libraries that want to use 64-bit time_t will
require linux-5.1 kernel headers for building in the future, and at a much
later point may also require linux-5.1 or a later version as the minimum
kernel at runtime. Having a common baseline then allows the removal of many
architecture or kernel version specific workarounds.
  • Loading branch information
Thomas Gleixner committed Feb 10, 2019
2 parents 74e9671 + 805089c commit fd659cc
Show file tree
Hide file tree
Showing 46 changed files with 608 additions and 1,118 deletions.
21 changes: 0 additions & 21 deletions arch/alpha/include/asm/unistd.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,4 @@
#define __ARCH_WANT_SYS_VFORK
#define __ARCH_WANT_SYS_CLONE

/*
* Ignore legacy syscalls that we don't use.
*/
#define __IGNORE_alarm
#define __IGNORE_creat
#define __IGNORE_getegid
#define __IGNORE_geteuid
#define __IGNORE_getgid
#define __IGNORE_getpid
#define __IGNORE_getppid
#define __IGNORE_getuid
#define __IGNORE_pause
#define __IGNORE_time
#define __IGNORE_utime
#define __IGNORE_umount2

/* Alpha doesn't have protection keys. */
#define __IGNORE_pkey_mprotect
#define __IGNORE_pkey_alloc
#define __IGNORE_pkey_free

#endif /* _ALPHA_UNISTD_H */
10 changes: 10 additions & 0 deletions arch/alpha/include/uapi/asm/unistd.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@
#ifndef _UAPI_ALPHA_UNISTD_H
#define _UAPI_ALPHA_UNISTD_H

/* These are traditionally the names linux-alpha uses for
* the two otherwise generic system calls */
#define __NR_umount __NR_umount2
#define __NR_osf_shmat __NR_shmat

/* These return an extra value but can be used as aliases */
#define __NR_getpid __NR_getxpid
#define __NR_getuid __NR_getxuid
#define __NR_getgid __NR_getxgid

#include <asm/unistd_32.h>

#endif /* _UAPI_ALPHA_UNISTD_H */
20 changes: 15 additions & 5 deletions arch/alpha/kernel/syscalls/syscall.tbl
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
19 common lseek sys_lseek
20 common getxpid sys_getxpid
21 common osf_mount sys_osf_mount
22 common umount sys_umount
22 common umount2 sys_umount
23 common setuid sys_setuid
24 common getxuid sys_getxuid
25 common exec_with_loader sys_ni_syscall
Expand Down Expand Up @@ -174,17 +174,17 @@
187 common osf_alt_sigpending sys_ni_syscall
188 common osf_alt_setsid sys_ni_syscall
199 common osf_swapon sys_swapon
200 common msgctl sys_msgctl
200 common msgctl sys_old_msgctl
201 common msgget sys_msgget
202 common msgrcv sys_msgrcv
203 common msgsnd sys_msgsnd
204 common semctl sys_semctl
204 common semctl sys_old_semctl
205 common semget sys_semget
206 common semop sys_semop
207 common osf_utsname sys_osf_utsname
208 common lchown sys_lchown
209 common osf_shmat sys_shmat
210 common shmctl sys_shmctl
209 common shmat sys_shmat
210 common shmctl sys_old_shmctl
211 common shmdt sys_shmdt
212 common shmget sys_shmget
213 common osf_mvalid sys_ni_syscall
Expand Down Expand Up @@ -451,3 +451,13 @@
520 common preadv2 sys_preadv2
521 common pwritev2 sys_pwritev2
522 common statx sys_statx
523 common io_pgetevents sys_io_pgetevents
524 common pkey_mprotect sys_pkey_mprotect
525 common pkey_alloc sys_pkey_alloc
526 common pkey_free sys_pkey_free
527 common rseq sys_rseq
528 common statfs64 sys_statfs64
529 common fstatfs64 sys_fstatfs64
530 common getegid sys_getegid
531 common geteuid sys_geteuid
532 common getppid sys_getppid
1 change: 0 additions & 1 deletion arch/arm/include/asm/unistd.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
* Unimplemented (or alternatively implemented) syscalls
*/
#define __IGNORE_fadvise64_64
#define __IGNORE_migrate_pages

#ifdef __ARM_EABI__
/*
Expand Down
8 changes: 5 additions & 3 deletions arch/arm/tools/syscall.tbl
Original file line number Diff line number Diff line change
Expand Up @@ -314,15 +314,15 @@
297 common recvmsg sys_recvmsg
298 common semop sys_semop sys_oabi_semop
299 common semget sys_semget
300 common semctl sys_semctl
300 common semctl sys_old_semctl
301 common msgsnd sys_msgsnd
302 common msgrcv sys_msgrcv
303 common msgget sys_msgget
304 common msgctl sys_msgctl
304 common msgctl sys_old_msgctl
305 common shmat sys_shmat
306 common shmdt sys_shmdt
307 common shmget sys_shmget
308 common shmctl sys_shmctl
308 common shmctl sys_old_shmctl
309 common add_key sys_add_key
310 common request_key sys_request_key
311 common keyctl sys_keyctl
Expand Down Expand Up @@ -414,3 +414,5 @@
397 common statx sys_statx
398 common rseq sys_rseq
399 common io_pgetevents sys_io_pgetevents
400 common migrate_pages sys_migrate_pages
401 common kexec_file_load sys_kexec_file_load
2 changes: 1 addition & 1 deletion arch/arm64/include/asm/unistd.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
#define __ARM_NR_compat_set_tls (__ARM_NR_COMPAT_BASE + 5)
#define __ARM_NR_COMPAT_END (__ARM_NR_COMPAT_BASE + 0x800)

#define __NR_compat_syscalls 400
#define __NR_compat_syscalls 402
#endif

#define __ARCH_WANT_SYS_CLONE
Expand Down
10 changes: 7 additions & 3 deletions arch/arm64/include/asm/unistd32.h
Original file line number Diff line number Diff line change
Expand Up @@ -622,23 +622,23 @@ __SYSCALL(__NR_semop, sys_semop)
#define __NR_semget 299
__SYSCALL(__NR_semget, sys_semget)
#define __NR_semctl 300
__SYSCALL(__NR_semctl, compat_sys_semctl)
__SYSCALL(__NR_semctl, compat_sys_old_semctl)
#define __NR_msgsnd 301
__SYSCALL(__NR_msgsnd, compat_sys_msgsnd)
#define __NR_msgrcv 302
__SYSCALL(__NR_msgrcv, compat_sys_msgrcv)
#define __NR_msgget 303
__SYSCALL(__NR_msgget, sys_msgget)
#define __NR_msgctl 304
__SYSCALL(__NR_msgctl, compat_sys_msgctl)
__SYSCALL(__NR_msgctl, compat_sys_old_msgctl)
#define __NR_shmat 305
__SYSCALL(__NR_shmat, compat_sys_shmat)
#define __NR_shmdt 306
__SYSCALL(__NR_shmdt, sys_shmdt)
#define __NR_shmget 307
__SYSCALL(__NR_shmget, sys_shmget)
#define __NR_shmctl 308
__SYSCALL(__NR_shmctl, compat_sys_shmctl)
__SYSCALL(__NR_shmctl, compat_sys_old_shmctl)
#define __NR_add_key 309
__SYSCALL(__NR_add_key, sys_add_key)
#define __NR_request_key 310
Expand Down Expand Up @@ -821,6 +821,10 @@ __SYSCALL(__NR_statx, sys_statx)
__SYSCALL(__NR_rseq, sys_rseq)
#define __NR_io_pgetevents 399
__SYSCALL(__NR_io_pgetevents, compat_sys_io_pgetevents)
#define __NR_migrate_pages 400
__SYSCALL(__NR_migrate_pages, compat_sys_migrate_pages)
#define __NR_kexec_file_load 401
__SYSCALL(__NR_kexec_file_load, sys_kexec_file_load)

/*
* Please add new compat syscalls above this comment and update
Expand Down
14 changes: 0 additions & 14 deletions arch/ia64/include/asm/unistd.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,6 @@

#define NR_syscalls __NR_syscalls /* length of syscall table */

/*
* The following defines stop scripts/checksyscalls.sh from complaining about
* unimplemented system calls. Glibc provides for each of these by using
* more modern equivalent system calls.
*/
#define __IGNORE_fork /* clone() */
#define __IGNORE_time /* gettimeofday() */
#define __IGNORE_alarm /* setitimer(ITIMER_REAL, ... */
#define __IGNORE_pause /* rt_sigprocmask(), rt_sigsuspend() */
#define __IGNORE_utime /* utimes() */
#define __IGNORE_getpgrp /* getpgid() */
#define __IGNORE_vfork /* clone() */
#define __IGNORE_umount2 /* umount() */

#define __ARCH_WANT_NEW_STAT
#define __ARCH_WANT_SYS_UTIME

Expand Down
2 changes: 2 additions & 0 deletions arch/ia64/include/uapi/asm/unistd.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

#define __NR_Linux 1024

#define __NR_umount __NR_umount2

#include <asm/unistd_64.h>

#endif /* _UAPI_ASM_IA64_UNISTD_H */
10 changes: 9 additions & 1 deletion arch/ia64/kernel/syscalls/syscall.tbl
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
17 common getpid sys_getpid
18 common getppid sys_getppid
19 common mount sys_mount
20 common umount sys_umount
20 common umount2 sys_umount
21 common setuid sys_setuid
22 common getuid sys_getuid
23 common geteuid sys_geteuid
Expand Down Expand Up @@ -335,3 +335,11 @@
323 common copy_file_range sys_copy_file_range
324 common preadv2 sys_preadv2
325 common pwritev2 sys_pwritev2
326 common statx sys_statx
327 common io_pgetevents sys_io_pgetevents
328 common perf_event_open sys_perf_event_open
329 common seccomp sys_seccomp
330 common pkey_mprotect sys_pkey_mprotect
331 common pkey_alloc sys_pkey_alloc
332 common pkey_free sys_pkey_free
333 common rseq sys_rseq
16 changes: 16 additions & 0 deletions arch/m68k/kernel/syscalls/syscall.tbl
Original file line number Diff line number Diff line change
Expand Up @@ -387,3 +387,19 @@
377 common preadv2 sys_preadv2
378 common pwritev2 sys_pwritev2
379 common statx sys_statx
380 common seccomp sys_seccomp
381 common pkey_mprotect sys_pkey_mprotect
382 common pkey_alloc sys_pkey_alloc
383 common pkey_free sys_pkey_free
384 common rseq sys_rseq
# room for arch specific calls
393 common semget sys_semget
394 common semctl sys_semctl
395 common shmget sys_shmget
396 common shmctl sys_shmctl
397 common shmat sys_shmat
398 common shmdt sys_shmdt
399 common msgget sys_msgget
400 common msgsnd sys_msgsnd
401 common msgrcv sys_msgrcv
402 common msgctl sys_msgctl
6 changes: 3 additions & 3 deletions arch/microblaze/kernel/syscalls/syscall.tbl
Original file line number Diff line number Diff line change
Expand Up @@ -335,15 +335,15 @@
325 common semtimedop sys_semtimedop
326 common timerfd_settime sys_timerfd_settime
327 common timerfd_gettime sys_timerfd_gettime
328 common semctl sys_semctl
328 common semctl sys_old_semctl
329 common semget sys_semget
330 common semop sys_semop
331 common msgctl sys_msgctl
331 common msgctl sys_old_msgctl
332 common msgget sys_msgget
333 common msgrcv sys_msgrcv
334 common msgsnd sys_msgsnd
335 common shmat sys_shmat
336 common shmctl sys_shmctl
336 common shmctl sys_old_shmctl
337 common shmdt sys_shmdt
338 common shmget sys_shmget
339 common signalfd4 sys_signalfd4
Expand Down
13 changes: 0 additions & 13 deletions arch/mips/include/asm/unistd.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,20 +54,7 @@
#define __ARCH_WANT_SYS_CLONE

/* whitelists for checksyscalls */
#define __IGNORE_select
#define __IGNORE_vfork
#define __IGNORE_time
#define __IGNORE_uselib
#define __IGNORE_fadvise64_64
#define __IGNORE_getdents64
#if _MIPS_SIM == _MIPS_SIM_NABI32
#define __IGNORE_truncate64
#define __IGNORE_ftruncate64
#define __IGNORE_stat64
#define __IGNORE_lstat64
#define __IGNORE_fstat64
#define __IGNORE_fstatat64
#endif

#endif /* !__ASSEMBLY__ */

Expand Down
6 changes: 3 additions & 3 deletions arch/mips/kernel/syscalls/syscall_n32.tbl
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
27 n32 madvise sys_madvise
28 n32 shmget sys_shmget
29 n32 shmat sys_shmat
30 n32 shmctl compat_sys_shmctl
30 n32 shmctl compat_sys_old_shmctl
31 n32 dup sys_dup
32 n32 dup2 sys_dup2
33 n32 pause sys_pause
Expand Down Expand Up @@ -71,12 +71,12 @@
61 n32 uname sys_newuname
62 n32 semget sys_semget
63 n32 semop sys_semop
64 n32 semctl compat_sys_semctl
64 n32 semctl compat_sys_old_semctl
65 n32 shmdt sys_shmdt
66 n32 msgget sys_msgget
67 n32 msgsnd compat_sys_msgsnd
68 n32 msgrcv compat_sys_msgrcv
69 n32 msgctl compat_sys_msgctl
69 n32 msgctl compat_sys_old_msgctl
70 n32 fcntl compat_sys_fcntl
71 n32 flock sys_flock
72 n32 fsync sys_fsync
Expand Down
6 changes: 3 additions & 3 deletions arch/mips/kernel/syscalls/syscall_n64.tbl
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
27 n64 madvise sys_madvise
28 n64 shmget sys_shmget
29 n64 shmat sys_shmat
30 n64 shmctl sys_shmctl
30 n64 shmctl sys_old_shmctl
31 n64 dup sys_dup
32 n64 dup2 sys_dup2
33 n64 pause sys_pause
Expand Down Expand Up @@ -71,12 +71,12 @@
61 n64 uname sys_newuname
62 n64 semget sys_semget
63 n64 semop sys_semop
64 n64 semctl sys_semctl
64 n64 semctl sys_old_semctl
65 n64 shmdt sys_shmdt
66 n64 msgget sys_msgget
67 n64 msgsnd sys_msgsnd
68 n64 msgrcv sys_msgrcv
69 n64 msgctl sys_msgctl
69 n64 msgctl sys_old_msgctl
70 n64 fcntl sys_fcntl
71 n64 flock sys_flock
72 n64 fsync sys_fsync
Expand Down
11 changes: 11 additions & 0 deletions arch/mips/kernel/syscalls/syscall_o32.tbl
Original file line number Diff line number Diff line change
Expand Up @@ -380,3 +380,14 @@
366 o32 statx sys_statx
367 o32 rseq sys_rseq
368 o32 io_pgetevents sys_io_pgetevents compat_sys_io_pgetevents
# room for arch specific calls
393 o32 semget sys_semget
394 o32 semctl sys_semctl compat_sys_semctl
395 o32 shmget sys_shmget
396 o32 shmctl sys_shmctl compat_sys_shmctl
397 o32 shmat sys_shmat compat_sys_shmat
398 o32 shmdt sys_shmdt
399 o32 msgget sys_msgget
400 o32 msgsnd sys_msgsnd compat_sys_msgsnd
401 o32 msgrcv sys_msgrcv compat_sys_msgrcv
402 o32 msgctl sys_msgctl compat_sys_msgctl
4 changes: 0 additions & 4 deletions arch/parisc/include/asm/unistd.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,7 @@

#define SYS_ify(syscall_name) __NR_##syscall_name

#define __IGNORE_select /* newselect */
#define __IGNORE_fadvise64 /* fadvise64_64 */
#define __IGNORE_pkey_mprotect
#define __IGNORE_pkey_alloc
#define __IGNORE_pkey_free

#ifndef ASM_LINE_SEP
# define ASM_LINE_SEP ;
Expand Down
4 changes: 4 additions & 0 deletions arch/parisc/kernel/syscalls/syscall.tbl
Original file line number Diff line number Diff line change
Expand Up @@ -367,3 +367,7 @@
348 common pwritev2 sys_pwritev2 compat_sys_pwritev2
349 common statx sys_statx
350 common io_pgetevents sys_io_pgetevents compat_sys_io_pgetevents
351 common pkey_mprotect sys_pkey_mprotect
352 common pkey_alloc sys_pkey_alloc
353 common pkey_free sys_pkey_free
354 common rseq sys_rseq
13 changes: 13 additions & 0 deletions arch/powerpc/kernel/syscalls/syscall.tbl
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,7 @@
363 spu switch_endian sys_ni_syscall
364 common userfaultfd sys_userfaultfd
365 common membarrier sys_membarrier
# 366-377 originally left for IPC, now unused
378 nospu mlock2 sys_mlock2
379 nospu copy_file_range sys_copy_file_range
380 common preadv2 sys_preadv2 compat_sys_preadv2
Expand All @@ -425,3 +426,15 @@
386 nospu pkey_mprotect sys_pkey_mprotect
387 nospu rseq sys_rseq
388 nospu io_pgetevents sys_io_pgetevents compat_sys_io_pgetevents
# room for arch specific syscalls
392 64 semtimedop sys_semtimedop
393 common semget sys_semget
394 common semctl sys_semctl compat_sys_semctl
395 common shmget sys_shmget
396 common shmctl sys_shmctl compat_sys_shmctl
397 common shmat sys_shmat compat_sys_shmat
398 common shmdt sys_shmdt
399 common msgget sys_msgget
400 common msgsnd sys_msgsnd compat_sys_msgsnd
401 common msgrcv sys_msgrcv compat_sys_msgrcv
402 common msgctl sys_msgctl compat_sys_msgctl
Loading

0 comments on commit fd659cc

Please sign in to comment.