| From 6aa2f6aaca0afba79b362b40cea9501260a7e9ba Mon Sep 17 00:00:00 2001 |
| From: Arnd Bergmann <arnd@arndb.de> |
| Date: Thu, 10 Jan 2019 12:45:11 +0100 |
| Subject: [PATCH] BACKPORT: y2038: add 64-bit time_t syscalls to all 32-bit |
| architectures |
| |
| This adds 21 new system calls on each ABI that has 32-bit time_t |
| today. All of these have the exact same semantics as their existing |
| counterparts, and the new ones all have macro names that end in 'time64' |
| for clarification. |
| |
| This gets us to the point of being able to safely use a C library |
| that has 64-bit time_t in user space. There are still a couple of |
| loose ends to tie up in various areas of the code, but this is the |
| big one, and should be entirely uncontroversial at this point. |
| |
| In particular, there are four system calls (getitimer, setitimer, |
| waitid, and getrusage) that don't have a 64-bit counterpart yet, |
| but these can all be safely implemented in the C library by wrapping |
| around the existing system calls because the 32-bit time_t they |
| pass only counts elapsed time, not time since the epoch. They |
| will be dealt with later. |
| |
| Signed-off-by: Arnd Bergmann <arnd@arndb.de> |
| Acked-by: Heiko Carstens <heiko.carstens@de.ibm.com> |
| Acked-by: Geert Uytterhoeven <geert@linux-m68k.org> |
| Acked-by: Catalin Marinas <catalin.marinas@arm.com> |
| --- |
| arch/arm/tools/syscall.tbl | 21 ++++++++++++ |
| arch/arm64/include/asm/unistd32.h | 42 ++++++++++++++++++++++++ |
| arch/x86/entry/syscalls/syscall_32.tbl | 21 ++++++++++++ |
| include/uapi/asm-generic/unistd.h | 44 ++++++++++++++++++++++++++ |
| scripts/checksyscalls.sh | 40 +++++++++++++++++++++++ |
| 5 files changed, 168 insertions(+) |
| |
| diff --git a/arch/arm/tools/syscall.tbl b/arch/arm/tools/syscall.tbl |
| index f58885d46d8f..9d87127f33e8 100644 |
| --- a/arch/arm/tools/syscall.tbl |
| +++ b/arch/arm/tools/syscall.tbl |
| @@ -412,5 +412,26 @@ |
| 395 common pkey_alloc sys_pkey_alloc |
| 396 common pkey_free sys_pkey_free |
| 397 common statx sys_statx |
| +# 398-402 unused |
| +403 common clock_gettime64 sys_clock_gettime |
| +404 common clock_settime64 sys_clock_settime |
| +405 common clock_adjtime64 sys_clock_adjtime |
| +406 common clock_getres_time64 sys_clock_getres |
| +407 common clock_nanosleep_time64 sys_clock_nanosleep |
| +408 common timer_gettime64 sys_timer_gettime |
| +409 common timer_settime64 sys_timer_settime |
| +410 common timerfd_gettime64 sys_timerfd_gettime |
| +411 common timerfd_settime64 sys_timerfd_settime |
| +412 common utimensat_time64 sys_utimensat |
| +413 common pselect6_time64 sys_pselect6 |
| +414 common ppoll_time64 sys_ppoll |
| +416 common io_pgetevents_time64 sys_io_pgetevents |
| +417 common recvmmsg_time64 sys_recvmmsg |
| +418 common mq_timedsend_time64 sys_mq_timedsend |
| +419 common mq_timedreceive_time64 sys_mq_timedreceive |
| +420 common semtimedop_time64 sys_semtimedop |
| +421 common rt_sigtimedwait_time64 sys_rt_sigtimedwait |
| +422 common futex_time64 sys_futex |
| +423 common sched_rr_get_interval_time64 sys_sched_rr_get_interval |
| 425 common io_uring_setup sys_io_uring_setup |
| 426 common io_uring_enter sys_io_uring_enter |
| diff --git a/arch/arm64/include/asm/unistd32.h b/arch/arm64/include/asm/unistd32.h |
| index 39c43e6c0350..ba9554572592 100644 |
| --- a/arch/arm64/include/asm/unistd32.h |
| +++ b/arch/arm64/include/asm/unistd32.h |
| @@ -817,6 +817,48 @@ __SYSCALL(__NR_pkey_alloc, sys_pkey_alloc) |
| __SYSCALL(__NR_pkey_free, sys_pkey_free) |
| #define __NR_statx 397 |
| __SYSCALL(__NR_statx, sys_statx) |
| +/* 398-402 is unused */ |
| +#define __NR_clock_gettime64 403 |
| +__SYSCALL(__NR_clock_gettime64, sys_clock_gettime) |
| +#define __NR_clock_settime64 404 |
| +__SYSCALL(__NR_clock_settime64, sys_clock_settime) |
| +#define __NR_clock_adjtime64 405 |
| +__SYSCALL(__NR_clock_adjtime64, sys_clock_adjtime) |
| +#define __NR_clock_getres_time64 406 |
| +__SYSCALL(__NR_clock_getres_time64, sys_clock_getres) |
| +#define __NR_clock_nanosleep_time64 407 |
| +__SYSCALL(__NR_clock_nanosleep_time64, sys_clock_nanosleep) |
| +#define __NR_timer_gettime64 408 |
| +__SYSCALL(__NR_timer_gettime64, sys_timer_gettime) |
| +#define __NR_timer_settime64 409 |
| +__SYSCALL(__NR_timer_settime64, sys_timer_settime) |
| +#define __NR_timerfd_gettime64 410 |
| +__SYSCALL(__NR_timerfd_gettime64, sys_timerfd_gettime) |
| +#define __NR_timerfd_settime64 411 |
| +__SYSCALL(__NR_timerfd_settime64, sys_timerfd_settime) |
| +#define __NR_utimensat_time64 412 |
| +__SYSCALL(__NR_utimensat_time64, sys_utimensat) |
| +#define __NR_pselect6_time64 413 |
| +__SYSCALL(__NR_pselect6_time64, compat_sys_pselect6_time64) |
| +#define __NR_ppoll_time64 414 |
| +__SYSCALL(__NR_ppoll_time64, compat_sys_ppoll_time64) |
| +#define __NR_io_pgetevents_time64 416 |
| +__SYSCALL(__NR_io_pgetevents_time64, sys_io_pgetevents) |
| +#define __NR_recvmmsg_time64 417 |
| +__SYSCALL(__NR_recvmmsg_time64, compat_sys_recvmmsg_time64) |
| +#define __NR_mq_timedsend_time64 418 |
| +__SYSCALL(__NR_mq_timedsend_time64, sys_mq_timedsend) |
| +#define __NR_mq_timedreceive_time64 419 |
| +__SYSCALL(__NR_mq_timedreceive_time64, sys_mq_timedreceive) |
| +#define __NR_semtimedop_time64 420 |
| +__SYSCALL(__NR_semtimedop_time64, sys_semtimedop) |
| +#define __NR_rt_sigtimedwait_time64 421 |
| +__SYSCALL(__NR_rt_sigtimedwait_time64, compat_sys_rt_sigtimedwait_time64) |
| +#define __NR_futex_time64 422 |
| +__SYSCALL(__NR_futex_time64, sys_futex) |
| +#define __NR_sched_rr_get_interval_time64 423 |
| +__SYSCALL(__NR_sched_rr_get_interval_time64, sys_sched_rr_get_interval) |
| +/* 424 is unused */ |
| #define __NR_io_uring_setup 425 |
| __SYSCALL(__NR_io_uring_setup, sys_io_uring_setup) |
| #define __NR_io_uring_enter 426 |
| diff --git a/arch/x86/entry/syscalls/syscall_32.tbl b/arch/x86/entry/syscalls/syscall_32.tbl |
| index 8f09b3d99eca..b056050a44ba 100644 |
| --- a/arch/x86/entry/syscalls/syscall_32.tbl |
| +++ b/arch/x86/entry/syscalls/syscall_32.tbl |
| @@ -391,5 +391,26 @@ |
| 382 i386 pkey_free sys_pkey_free |
| 383 i386 statx sys_statx |
| 384 i386 arch_prctl sys_arch_prctl compat_sys_arch_prctl |
| +# don't use numbers 387 through 392, add new calls at the end |
| +403 i386 clock_gettime64 sys_clock_gettime __ia32_sys_clock_gettime |
| +404 i386 clock_settime64 sys_clock_settime __ia32_sys_clock_settime |
| +405 i386 clock_adjtime64 sys_clock_adjtime __ia32_sys_clock_adjtime |
| +406 i386 clock_getres_time64 sys_clock_getres __ia32_sys_clock_getres |
| +407 i386 clock_nanosleep_time64 sys_clock_nanosleep __ia32_sys_clock_nanosleep |
| +408 i386 timer_gettime64 sys_timer_gettime __ia32_sys_timer_gettime |
| +409 i386 timer_settime64 sys_timer_settime __ia32_sys_timer_settime |
| +410 i386 timerfd_gettime64 sys_timerfd_gettime __ia32_sys_timerfd_gettime |
| +411 i386 timerfd_settime64 sys_timerfd_settime __ia32_sys_timerfd_settime |
| +412 i386 utimensat_time64 sys_utimensat __ia32_sys_utimensat |
| +413 i386 pselect6_time64 sys_pselect6 __ia32_compat_sys_pselect6_time64 |
| +414 i386 ppoll_time64 sys_ppoll __ia32_compat_sys_ppoll_time64 |
| +416 i386 io_pgetevents_time64 sys_io_pgetevents __ia32_sys_io_pgetevents |
| +417 i386 recvmmsg_time64 sys_recvmmsg __ia32_compat_sys_recvmmsg_time64 |
| +418 i386 mq_timedsend_time64 sys_mq_timedsend __ia32_sys_mq_timedsend |
| +419 i386 mq_timedreceive_time64 sys_mq_timedreceive __ia32_sys_mq_timedreceive |
| +420 i386 semtimedop_time64 sys_semtimedop __ia32_sys_semtimedop |
| +421 i386 rt_sigtimedwait_time64 sys_rt_sigtimedwait __ia32_compat_sys_rt_sigtimedwait_time64 |
| +422 i386 futex_time64 sys_futex __ia32_sys_futex |
| +423 i386 sched_rr_get_interval_time64 sys_sched_rr_get_interval __ia32_sys_sched_rr_get_interval |
| 425 i386 io_uring_setup sys_io_uring_setup __ia32_sys_io_uring_setup |
| 426 i386 io_uring_enter sys_io_uring_enter __ia32_sys_io_uring_enter |
| diff --git a/include/uapi/asm-generic/unistd.h b/include/uapi/asm-generic/unistd.h |
| index cd1b40f29c5f..fb577f978ddb 100644 |
| --- a/include/uapi/asm-generic/unistd.h |
| +++ b/include/uapi/asm-generic/unistd.h |
| @@ -732,6 +732,50 @@ __SYSCALL(__NR_pkey_alloc, sys_pkey_alloc) |
| __SYSCALL(__NR_pkey_free, sys_pkey_free) |
| #define __NR_kexec_file_load 291 |
| __SYSCALL(__NR_statx, sys_statx) |
| +/* 292 through 402 are unassigned to sync up with generic numbers, don't use */ |
| +#if __BITS_PER_LONG == 32 |
| +#define __NR_clock_gettime64 403 |
| +__SYSCALL(__NR_clock_gettime64, sys_clock_gettime) |
| +#define __NR_clock_settime64 404 |
| +__SYSCALL(__NR_clock_settime64, sys_clock_settime) |
| +#define __NR_clock_adjtime64 405 |
| +__SYSCALL(__NR_clock_adjtime64, sys_clock_adjtime) |
| +#define __NR_clock_getres_time64 406 |
| +__SYSCALL(__NR_clock_getres_time64, sys_clock_getres) |
| +#define __NR_clock_nanosleep_time64 407 |
| +__SYSCALL(__NR_clock_nanosleep_time64, sys_clock_nanosleep) |
| +#define __NR_timer_gettime64 408 |
| +__SYSCALL(__NR_timer_gettime64, sys_timer_gettime) |
| +#define __NR_timer_settime64 409 |
| +__SYSCALL(__NR_timer_settime64, sys_timer_settime) |
| +#define __NR_timerfd_gettime64 410 |
| +__SYSCALL(__NR_timerfd_gettime64, sys_timerfd_gettime) |
| +#define __NR_timerfd_settime64 411 |
| +__SYSCALL(__NR_timerfd_settime64, sys_timerfd_settime) |
| +#define __NR_utimensat_time64 412 |
| +__SYSCALL(__NR_utimensat_time64, sys_utimensat) |
| +#define __NR_pselect6_time64 413 |
| +__SC_COMP(__NR_pselect6_time64, sys_pselect6, compat_sys_pselect6_time64) |
| +#define __NR_ppoll_time64 414 |
| +__SC_COMP(__NR_ppoll_time64, sys_ppoll, compat_sys_ppoll_time64) |
| +#define __NR_io_pgetevents_time64 416 |
| +__SYSCALL(__NR_io_pgetevents_time64, sys_io_pgetevents) |
| +#define __NR_recvmmsg_time64 417 |
| +__SC_COMP(__NR_recvmmsg_time64, sys_recvmmsg, compat_sys_recvmmsg_time64) |
| +#define __NR_mq_timedsend_time64 418 |
| +__SYSCALL(__NR_mq_timedsend_time64, sys_mq_timedsend) |
| +#define __NR_mq_timedreceive_time64 419 |
| +__SYSCALL(__NR_mq_timedreceive_time64, sys_mq_timedreceive) |
| +#define __NR_semtimedop_time64 420 |
| +__SYSCALL(__NR_semtimedop_time64, sys_semtimedop) |
| +#define __NR_rt_sigtimedwait_time64 421 |
| +__SC_COMP(__NR_rt_sigtimedwait_time64, sys_rt_sigtimedwait, compat_sys_rt_sigtimedwait_time64) |
| +#define __NR_futex_time64 422 |
| +__SYSCALL(__NR_futex_time64, sys_futex) |
| +#define __NR_sched_rr_get_interval_time64 423 |
| +__SYSCALL(__NR_sched_rr_get_interval_time64, sys_sched_rr_get_interval) |
| +#endif |
| +/* 424 is unused */ |
| #define __NR_io_uring_setup 425 |
| __SYSCALL(__NR_io_uring_setup, sys_io_uring_setup) |
| #define __NR_io_uring_enter 426 |
| diff --git a/scripts/checksyscalls.sh b/scripts/checksyscalls.sh |
| index ee3dfb5be6cd..b7f01867bf7e 100755 |
| --- a/scripts/checksyscalls.sh |
| +++ b/scripts/checksyscalls.sh |
| @@ -84,6 +84,26 @@ cat << EOF |
| #define __IGNORE_statfs64 |
| #define __IGNORE_llseek |
| #define __IGNORE_mmap2 |
| +#define __IGNORE_clock_gettime64 |
| +#define __IGNORE_clock_settime64 |
| +#define __IGNORE_clock_adjtime64 |
| +#define __IGNORE_clock_getres_time64 |
| +#define __IGNORE_clock_nanosleep_time64 |
| +#define __IGNORE_timer_gettime64 |
| +#define __IGNORE_timer_settime64 |
| +#define __IGNORE_timerfd_gettime64 |
| +#define __IGNORE_timerfd_settime64 |
| +#define __IGNORE_utimensat_time64 |
| +#define __IGNORE_pselect6_time64 |
| +#define __IGNORE_ppoll_time64 |
| +#define __IGNORE_io_pgetevents_time64 |
| +#define __IGNORE_recvmmsg_time64 |
| +#define __IGNORE_mq_timedsend_time64 |
| +#define __IGNORE_mq_timedreceive_time64 |
| +#define __IGNORE_semtimedop_time64 |
| +#define __IGNORE_rt_sigtimedwait_time64 |
| +#define __IGNORE_futex_time64 |
| +#define __IGNORE_sched_rr_get_interval_time64 |
| #else |
| #define __IGNORE_sendfile |
| #define __IGNORE_ftruncate |
| @@ -98,6 +118,26 @@ cat << EOF |
| #define __IGNORE_statfs |
| #define __IGNORE_lseek |
| #define __IGNORE_mmap |
| +#define __IGNORE_clock_gettime |
| +#define __IGNORE_clock_settime |
| +#define __IGNORE_clock_adjtime |
| +#define __IGNORE_clock_getres |
| +#define __IGNORE_clock_nanosleep |
| +#define __IGNORE_timer_gettime |
| +#define __IGNORE_timer_settime |
| +#define __IGNORE_timerfd_gettime |
| +#define __IGNORE_timerfd_settime |
| +#define __IGNORE_utimensat |
| +#define __IGNORE_pselect6 |
| +#define __IGNORE_ppoll |
| +#define __IGNORE_io_pgetevents |
| +#define __IGNORE_recvmmsg |
| +#define __IGNORE_mq_timedsend |
| +#define __IGNORE_mq_timedreceiv |
| +#define __IGNORE_semtimedop |
| +#define __IGNORE_rt_sigtimedwait |
| +#define __IGNORE_futex |
| +#define __IGNORE_sched_rr_get_interval |
| #endif |
| |
| /* i386-specific or historical system calls */ |
| -- |
| 2.30.1 |
| |