diff mbox series

[v2,3/9] ARM: oabi-compat: add epoll_pwait handler

Message ID 20200918124624.1469673-4-arnd@arndb.de
State Accepted
Commit b6e47f3c11c17965acb2a12001af3b1cd5658f37
Headers show
Series None | expand

Commit Message

Arnd Bergmann Sept. 18, 2020, 12:46 p.m. UTC
The epoll_wait() syscall has a special version for OABI compat
mode to convert the arguments to the EABI structure layout
of the kernel. However, the later epoll_pwait() syscall was
added in arch/arm in linux-2.6.32 without this conversion.

Use the same kind of handler for both.

Fixes: 369842658a36 ("ARM: 5677/1: ARM support for TIF_RESTORE_SIGMASK/pselect6/ppoll/epoll_pwait")
Cc: stable@vger.kernel.org
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/kernel/sys_oabi-compat.c | 37 ++++++++++++++++++++++++++++---
 arch/arm/tools/syscall.tbl        |  2 +-
 2 files changed, 35 insertions(+), 4 deletions(-)

Comments

Sasha Levin Sept. 21, 2020, 12:54 p.m. UTC | #1
Hi

[This is an automated email]

This commit has been processed because it contains a "Fixes:" tag
fixing commit: 369842658a36 ("ARM: 5677/1: ARM support for TIF_RESTORE_SIGMASK/pselect6/ppoll/epoll_pwait").

The bot has tested the following trees: v5.8.10, v5.4.66, v4.19.146, v4.14.198, v4.9.236, v4.4.236.

v5.8.10: Build OK!
v5.4.66: Build OK!
v4.19.146: Build OK!
v4.14.198: Build OK!
v4.9.236: Failed to apply! Possible dependencies:
    00bf25d693e7 ("y2038: use time32 syscall names on 32-bit")
    17435e5f8cf3 ("time: Introduce CONFIG_COMPAT_32BIT_TIME")
    338035edc9b9 ("arm: Wire up restartable sequences system call")
    4e2648db9c5f ("ARM: remove indirection of asm/mach-types.h")
    73aeb2cbcdc9 ("ARM: 8787/1: wire up io_pgetevents syscall")
    78594b95998f ("ARM: add migrate_pages() system call")
    96a8fae0fe09 ("ARM: convert to generated system call tables")
    a1016e94cce9 ("ARM: wire up statx syscall")
    c281634c8652 ("ARM: compat: remove KERNEL_DS usage in sys_oabi_epoll_ctl()")
    d4703ddafd1e ("time: Introduce CONFIG_64BIT_TIME in architectures")

v4.4.236: Failed to apply! Possible dependencies:
    00bf25d693e7 ("y2038: use time32 syscall names on 32-bit")
    03590cb56d5d ("ARM: wire up copy_file_range() syscall")
    0d4a619b64ba ("dma-mapping: make the generic coherent dma mmap implementation optional")
    17435e5f8cf3 ("time: Introduce CONFIG_COMPAT_32BIT_TIME")
    4e2648db9c5f ("ARM: remove indirection of asm/mach-types.h")
    96a8fae0fe09 ("ARM: convert to generated system call tables")
    c281634c8652 ("ARM: compat: remove KERNEL_DS usage in sys_oabi_epoll_ctl()")
    d4703ddafd1e ("time: Introduce CONFIG_64BIT_TIME in architectures")
    f2335a2a0a59 ("ARM: wire up preadv2 and pwritev2 syscalls")


NOTE: The patch will not be queued to stable trees until it is upstream.

How should we proceed with this patch?

-- 
Thanks
Sasha
Arnd Bergmann Sept. 21, 2020, 1:27 p.m. UTC | #2
On Mon, Sep 21, 2020 at 2:54 PM Sasha Levin <sashal@kernel.org> wrote:
>

> Hi

>

> [This is an automated email]

>

> This commit has been processed because it contains a "Fixes:" tag

> fixing commit: 369842658a36 ("ARM: 5677/1: ARM support for TIF_RESTORE_SIGMASK/pselect6/ppoll/epoll_pwait").

>

> The bot has tested the following trees: v5.8.10, v5.4.66, v4.19.146, v4.14.198, v4.9.236, v4.4.236.

>

> v5.8.10: Build OK!

> v5.4.66: Build OK!

> v4.19.146: Build OK!

> v4.14.198: Build OK!

> v4.9.236: Failed to apply! Possible dependencies:

>     00bf25d693e7 ("y2038: use time32 syscall names on 32-bit")

>     17435e5f8cf3 ("time: Introduce CONFIG_COMPAT_32BIT_TIME")

>     338035edc9b9 ("arm: Wire up restartable sequences system call")

>     4e2648db9c5f ("ARM: remove indirection of asm/mach-types.h")

>     73aeb2cbcdc9 ("ARM: 8787/1: wire up io_pgetevents syscall")

>     78594b95998f ("ARM: add migrate_pages() system call")

>     96a8fae0fe09 ("ARM: convert to generated system call tables")

>     a1016e94cce9 ("ARM: wire up statx syscall")

>     c281634c8652 ("ARM: compat: remove KERNEL_DS usage in sys_oabi_epoll_ctl()")

>     d4703ddafd1e ("time: Introduce CONFIG_64BIT_TIME in architectures")

>

> v4.4.236: Failed to apply! Possible dependencies:

>     00bf25d693e7 ("y2038: use time32 syscall names on 32-bit")

>     03590cb56d5d ("ARM: wire up copy_file_range() syscall")

>     0d4a619b64ba ("dma-mapping: make the generic coherent dma mmap implementation optional")

>     17435e5f8cf3 ("time: Introduce CONFIG_COMPAT_32BIT_TIME")

>     4e2648db9c5f ("ARM: remove indirection of asm/mach-types.h")

>     96a8fae0fe09 ("ARM: convert to generated system call tables")

>     c281634c8652 ("ARM: compat: remove KERNEL_DS usage in sys_oabi_epoll_ctl()")

>     d4703ddafd1e ("time: Introduce CONFIG_64BIT_TIME in architectures")

>     f2335a2a0a59 ("ARM: wire up preadv2 and pwritev2 syscalls")

>

>

> NOTE: The patch will not be queued to stable trees until it is upstream.

>

> How should we proceed with this patch?


I wouldn't worry too much about the failed backport in this case, as I
don't think there are any actual users of this code on older stable
kernels, and even if there are they are unlikely to start using
epoll_pwait.

      Arnd
diff mbox series

Patch

diff --git a/arch/arm/kernel/sys_oabi-compat.c b/arch/arm/kernel/sys_oabi-compat.c
index 0203e545bbc8..a2b1ae01e5bf 100644
--- a/arch/arm/kernel/sys_oabi-compat.c
+++ b/arch/arm/kernel/sys_oabi-compat.c
@@ -264,9 +264,8 @@  asmlinkage long sys_oabi_epoll_ctl(int epfd, int op, int fd,
 	return do_epoll_ctl(epfd, op, fd, &kernel, false);
 }
 
-asmlinkage long sys_oabi_epoll_wait(int epfd,
-				    struct oabi_epoll_event __user *events,
-				    int maxevents, int timeout)
+static long do_oabi_epoll_wait(int epfd, struct oabi_epoll_event __user *events,
+			       int maxevents, int timeout)
 {
 	struct epoll_event *kbuf;
 	struct oabi_epoll_event e;
@@ -299,6 +298,38 @@  asmlinkage long sys_oabi_epoll_wait(int epfd,
 	return err ? -EFAULT : ret;
 }
 
+SYSCALL_DEFINE4(oabi_epoll_wait, int, epfd,
+		struct oabi_epoll_event __user *, events,
+		int, maxevents, int, timeout)
+{
+	return do_oabi_epoll_wait(epfd, events, maxevents, timeout);
+}
+
+/*
+ * Implement the event wait interface for the eventpoll file. It is the kernel
+ * part of the user space epoll_pwait(2).
+ */
+SYSCALL_DEFINE6(oabi_epoll_pwait, int, epfd,
+		struct oabi_epoll_event __user *, events, int, maxevents,
+		int, timeout, const sigset_t __user *, sigmask,
+		size_t, sigsetsize)
+{
+	int error;
+
+	/*
+	 * If the caller wants a certain signal mask to be set during the wait,
+	 * we apply it here.
+	 */
+	error = set_user_sigmask(sigmask, sigsetsize);
+	if (error)
+		return error;
+
+	error = do_oabi_epoll_wait(epfd, events, maxevents, timeout);
+	restore_saved_sigmask_unless(error == -EINTR);
+
+	return error;
+}
+
 struct oabi_sembuf {
 	unsigned short	sem_num;
 	short		sem_op;
diff --git a/arch/arm/tools/syscall.tbl b/arch/arm/tools/syscall.tbl
index 171077cbf419..39a24bee7df8 100644
--- a/arch/arm/tools/syscall.tbl
+++ b/arch/arm/tools/syscall.tbl
@@ -360,7 +360,7 @@ 
 343	common	vmsplice		sys_vmsplice
 344	common	move_pages		sys_move_pages
 345	common	getcpu			sys_getcpu
-346	common	epoll_pwait		sys_epoll_pwait
+346	common	epoll_pwait		sys_epoll_pwait		sys_oabi_epoll_pwait
 347	common	kexec_load		sys_kexec_load
 348	common	utimensat		sys_utimensat_time32
 349	common	signalfd		sys_signalfd