syscalls: fix compat_sys_io_pgetevents_time64 usage
authorArnd Bergmann <arnd@arndb.de>
Thu, 20 Jun 2024 12:16:37 +0000 (14:16 +0200)
committerArnd Bergmann <arnd@arndb.de>
Tue, 25 Jun 2024 13:57:20 +0000 (15:57 +0200)
Using sys_io_pgetevents() as the entry point for compat mode tasks
works almost correctly, but misses the sign extension for the min_nr
and nr arguments.

This was addressed on parisc by switching to
compat_sys_io_pgetevents_time64() in commit 6431e92fc827 ("parisc:
io_pgetevents_time64() needs compat syscall in 32-bit compat mode"),
as well as by using more sophisticated system call wrappers on x86 and
s390. However, arm64, mips, powerpc, sparc and riscv still have the
same bug.

Change all of them over to use compat_sys_io_pgetevents_time64()
like parisc already does. This was clearly the intention when the
function was originally added, but it got hooked up incorrectly in
the tables.

Cc: stable@vger.kernel.org
Fixes: 48166e6ea47d ("y2038: add 64-bit time_t syscalls to all 32-bit architectures")
Acked-by: Heiko Carstens <hca@linux.ibm.com> # s390
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
arch/arm64/include/asm/unistd32.h
arch/mips/kernel/syscalls/syscall_n32.tbl
arch/mips/kernel/syscalls/syscall_o32.tbl
arch/powerpc/kernel/syscalls/syscall.tbl
arch/s390/kernel/syscalls/syscall.tbl
arch/sparc/kernel/syscalls/syscall.tbl
arch/x86/entry/syscalls/syscall_32.tbl
include/uapi/asm-generic/unistd.h
kernel/sys_ni.c

index 266b96a..1386e8e 100644 (file)
@@ -840,7 +840,7 @@ __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)
+__SYSCALL(__NR_io_pgetevents_time64, compat_sys_io_pgetevents_time64)
 #define __NR_recvmmsg_time64 417
 __SYSCALL(__NR_recvmmsg_time64, compat_sys_recvmmsg_time64)
 #define __NR_mq_timedsend_time64 418
index cc869f5..953f5b7 100644 (file)
 412    n32     utimensat_time64                sys_utimensat
 413    n32     pselect6_time64                 compat_sys_pselect6_time64
 414    n32     ppoll_time64                    compat_sys_ppoll_time64
-416    n32     io_pgetevents_time64            sys_io_pgetevents
+416    n32     io_pgetevents_time64            compat_sys_io_pgetevents_time64
 417    n32     recvmmsg_time64                 compat_sys_recvmmsg_time64
 418    n32     mq_timedsend_time64             sys_mq_timedsend
 419    n32     mq_timedreceive_time64          sys_mq_timedreceive
index 81428a2..2439a24 100644 (file)
 412    o32     utimensat_time64                sys_utimensat                   sys_utimensat
 413    o32     pselect6_time64                 sys_pselect6                    compat_sys_pselect6_time64
 414    o32     ppoll_time64                    sys_ppoll                       compat_sys_ppoll_time64
-416    o32     io_pgetevents_time64            sys_io_pgetevents               sys_io_pgetevents
+416    o32     io_pgetevents_time64            sys_io_pgetevents               compat_sys_io_pgetevents_time64
 417    o32     recvmmsg_time64                 sys_recvmmsg                    compat_sys_recvmmsg_time64
 418    o32     mq_timedsend_time64             sys_mq_timedsend                sys_mq_timedsend
 419    o32     mq_timedreceive_time64          sys_mq_timedreceive             sys_mq_timedreceive
index 3656f1c..c6b0546 100644 (file)
 412    32      utimensat_time64                sys_utimensat                   sys_utimensat
 413    32      pselect6_time64                 sys_pselect6                    compat_sys_pselect6_time64
 414    32      ppoll_time64                    sys_ppoll                       compat_sys_ppoll_time64
-416    32      io_pgetevents_time64            sys_io_pgetevents               sys_io_pgetevents
+416    32      io_pgetevents_time64            sys_io_pgetevents               compat_sys_io_pgetevents_time64
 417    32      recvmmsg_time64                 sys_recvmmsg                    compat_sys_recvmmsg_time64
 418    32      mq_timedsend_time64             sys_mq_timedsend                sys_mq_timedsend
 419    32      mq_timedreceive_time64          sys_mq_timedreceive             sys_mq_timedreceive
index bd0fee2..0107118 100644 (file)
 412    32      utimensat_time64        -                               sys_utimensat
 413    32      pselect6_time64         -                               compat_sys_pselect6_time64
 414    32      ppoll_time64            -                               compat_sys_ppoll_time64
-416    32      io_pgetevents_time64    -                               sys_io_pgetevents
+416    32      io_pgetevents_time64    -                               compat_sys_io_pgetevents_time64
 417    32      recvmmsg_time64         -                               compat_sys_recvmmsg_time64
 418    32      mq_timedsend_time64     -                               sys_mq_timedsend
 419    32      mq_timedreceive_time64  -                               sys_mq_timedreceive
index ac6c281..b354139 100644 (file)
 412    32      utimensat_time64                sys_utimensat                   sys_utimensat
 413    32      pselect6_time64                 sys_pselect6                    compat_sys_pselect6_time64
 414    32      ppoll_time64                    sys_ppoll                       compat_sys_ppoll_time64
-416    32      io_pgetevents_time64            sys_io_pgetevents               sys_io_pgetevents
+416    32      io_pgetevents_time64            sys_io_pgetevents               compat_sys_io_pgetevents_time64
 417    32      recvmmsg_time64                 sys_recvmmsg                    compat_sys_recvmmsg_time64
 418    32      mq_timedsend_time64             sys_mq_timedsend                sys_mq_timedsend
 419    32      mq_timedreceive_time64          sys_mq_timedreceive             sys_mq_timedreceive
index 7fd1f57..d6ebcab 100644 (file)
 412    i386    utimensat_time64        sys_utimensat
 413    i386    pselect6_time64         sys_pselect6                    compat_sys_pselect6_time64
 414    i386    ppoll_time64            sys_ppoll                       compat_sys_ppoll_time64
-416    i386    io_pgetevents_time64    sys_io_pgetevents
+416    i386    io_pgetevents_time64    sys_io_pgetevents               compat_sys_io_pgetevents_time64
 417    i386    recvmmsg_time64         sys_recvmmsg                    compat_sys_recvmmsg_time64
 418    i386    mq_timedsend_time64     sys_mq_timedsend
 419    i386    mq_timedreceive_time64  sys_mq_timedreceive
index d983c48..d4cc269 100644 (file)
@@ -737,7 +737,7 @@ __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)
+__SC_COMP(__NR_io_pgetevents_time64, sys_io_pgetevents, compat_sys_io_pgetevents_time64)
 #define __NR_recvmmsg_time64 417
 __SC_COMP(__NR_recvmmsg_time64, sys_recvmmsg, compat_sys_recvmmsg_time64)
 #define __NR_mq_timedsend_time64 418
index d7eee42..b696b85 100644 (file)
@@ -46,8 +46,8 @@ COND_SYSCALL(io_getevents_time32);
 COND_SYSCALL(io_getevents);
 COND_SYSCALL(io_pgetevents_time32);
 COND_SYSCALL(io_pgetevents);
-COND_SYSCALL_COMPAT(io_pgetevents_time32);
 COND_SYSCALL_COMPAT(io_pgetevents);
+COND_SYSCALL_COMPAT(io_pgetevents_time64);
 COND_SYSCALL(io_uring_setup);
 COND_SYSCALL(io_uring_enter);
 COND_SYSCALL(io_uring_register);