linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] epoll: fix compat syscall wire up of epoll_pwait2
@ 2020-12-20  9:58 Heiko Carstens
  2020-12-20 11:43 ` Arnd Bergmann
  2020-12-23 14:48 ` Will Deacon
  0 siblings, 2 replies; 8+ messages in thread
From: Heiko Carstens @ 2020-12-20  9:58 UTC (permalink / raw)
  To: Andrew Morton
  Cc: linux-kernel, Linus Torvalds, Heiko Carstens, Willem de Bruijn,
	Al Viro, Arnd Bergmann, Matthew Wilcox, Catalin Marinas,
	Will Deacon, Thomas Bogendoerfer, Vasily Gorbik,
	Christian Borntraeger, David S. Miller

Commit b0a0c2615f6f ("epoll: wire up syscall epoll_pwait2") wired up
the 64 bit syscall instead of the compat variant in a couple of places.

Cc: Willem de Bruijn <willemb@google.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>
Cc: "David S. Miller" <davem@davemloft.net>
Fixes: b0a0c2615f6f ("epoll: wire up syscall epoll_pwait2")
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
---
 arch/arm64/include/asm/unistd32.h         | 2 +-
 arch/mips/kernel/syscalls/syscall_n32.tbl | 2 +-
 arch/s390/kernel/syscalls/syscall.tbl     | 2 +-
 arch/sparc/kernel/syscalls/syscall.tbl    | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/arm64/include/asm/unistd32.h b/arch/arm64/include/asm/unistd32.h
index f4bca2b90218..cccfbbefbf95 100644
--- a/arch/arm64/include/asm/unistd32.h
+++ b/arch/arm64/include/asm/unistd32.h
@@ -890,7 +890,7 @@ __SYSCALL(__NR_faccessat2, sys_faccessat2)
 #define __NR_process_madvise 440
 __SYSCALL(__NR_process_madvise, sys_process_madvise)
 #define __NR_epoll_pwait2 441
-__SYSCALL(__NR_epoll_pwait2, sys_epoll_pwait2)
+__SYSCALL(__NR_epoll_pwait2, compat_sys_epoll_pwait2)
 
 /*
  * Please add new compat syscalls above this comment and update
diff --git a/arch/mips/kernel/syscalls/syscall_n32.tbl b/arch/mips/kernel/syscalls/syscall_n32.tbl
index ad9c3dd0ab1f..0f03ad223f33 100644
--- a/arch/mips/kernel/syscalls/syscall_n32.tbl
+++ b/arch/mips/kernel/syscalls/syscall_n32.tbl
@@ -379,4 +379,4 @@
 438	n32	pidfd_getfd			sys_pidfd_getfd
 439	n32	faccessat2			sys_faccessat2
 440	n32	process_madvise			sys_process_madvise
-441	n32	epoll_pwait2			sys_epoll_pwait2
+441	n32	epoll_pwait2			compat_sys_epoll_pwait2
diff --git a/arch/s390/kernel/syscalls/syscall.tbl b/arch/s390/kernel/syscalls/syscall.tbl
index 14f6525886a8..d443423495e5 100644
--- a/arch/s390/kernel/syscalls/syscall.tbl
+++ b/arch/s390/kernel/syscalls/syscall.tbl
@@ -443,4 +443,4 @@
 438  common	pidfd_getfd		sys_pidfd_getfd			sys_pidfd_getfd
 439  common	faccessat2		sys_faccessat2			sys_faccessat2
 440  common	process_madvise		sys_process_madvise		sys_process_madvise
-441  common	epoll_pwait2		sys_epoll_pwait2		sys_epoll_pwait2
+441  common	epoll_pwait2		sys_epoll_pwait2		compat_sys_epoll_pwait2
diff --git a/arch/sparc/kernel/syscalls/syscall.tbl b/arch/sparc/kernel/syscalls/syscall.tbl
index c7da4c3271e6..40d8c7cd8298 100644
--- a/arch/sparc/kernel/syscalls/syscall.tbl
+++ b/arch/sparc/kernel/syscalls/syscall.tbl
@@ -486,4 +486,4 @@
 438	common	pidfd_getfd			sys_pidfd_getfd
 439	common	faccessat2			sys_faccessat2
 440	common	process_madvise			sys_process_madvise
-441	common	epoll_pwait2			sys_epoll_pwait2
+441	common	epoll_pwait2			sys_epoll_pwait2		compat_sys_epoll_pwait2
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] epoll: fix compat syscall wire up of epoll_pwait2
  2020-12-20  9:58 [PATCH] epoll: fix compat syscall wire up of epoll_pwait2 Heiko Carstens
@ 2020-12-20 11:43 ` Arnd Bergmann
  2020-12-20 18:22   ` Willem de Bruijn
  2020-12-23 14:48 ` Will Deacon
  1 sibling, 1 reply; 8+ messages in thread
From: Arnd Bergmann @ 2020-12-20 11:43 UTC (permalink / raw)
  To: Heiko Carstens
  Cc: Andrew Morton, linux-kernel, Linus Torvalds, Willem de Bruijn,
	Al Viro, Arnd Bergmann, Matthew Wilcox, Catalin Marinas,
	Will Deacon, Thomas Bogendoerfer, Vasily Gorbik,
	Christian Borntraeger, David S. Miller

On Sun, Dec 20, 2020 at 11:00 AM Heiko Carstens <hca@linux.ibm.com> wrote:
>
> Commit b0a0c2615f6f ("epoll: wire up syscall epoll_pwait2") wired up
> the 64 bit syscall instead of the compat variant in a couple of places.
>
> Cc: Willem de Bruijn <willemb@google.com>
> Cc: Al Viro <viro@zeniv.linux.org.uk>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will@kernel.org>
> Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
> Cc: Vasily Gorbik <gor@linux.ibm.com>
> Cc: Christian Borntraeger <borntraeger@de.ibm.com>
> Cc: "David S. Miller" <davem@davemloft.net>
> Fixes: b0a0c2615f6f ("epoll: wire up syscall epoll_pwait2")
> Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
> ---
>  arch/arm64/include/asm/unistd32.h         | 2 +-
>  arch/mips/kernel/syscalls/syscall_n32.tbl | 2 +-
>  arch/s390/kernel/syscalls/syscall.tbl     | 2 +-
>  arch/sparc/kernel/syscalls/syscall.tbl    | 2 +-
>  4 files changed, 4 insertions(+), 4 deletions(-)

I double-checked all the entries to make sure you caught all
the missing ones, looks good.

Acked-by: Arnd Bergmann <arnd@arndb.de>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] epoll: fix compat syscall wire up of epoll_pwait2
  2020-12-20 11:43 ` Arnd Bergmann
@ 2020-12-20 18:22   ` Willem de Bruijn
  2020-12-20 18:51     ` Linus Torvalds
  0 siblings, 1 reply; 8+ messages in thread
From: Willem de Bruijn @ 2020-12-20 18:22 UTC (permalink / raw)
  To: Heiko Carstens
  Cc: Arnd Bergmann, Andrew Morton, linux-kernel, Linus Torvalds,
	Al Viro, Arnd Bergmann, Matthew Wilcox, Catalin Marinas,
	Will Deacon, Thomas Bogendoerfer, Vasily Gorbik,
	Christian Borntraeger, David S. Miller

On Sun, Dec 20, 2020 at 6:43 AM Arnd Bergmann <arnd@kernel.org> wrote:
>
> On Sun, Dec 20, 2020 at 11:00 AM Heiko Carstens <hca@linux.ibm.com> wrote:
> >
> > Commit b0a0c2615f6f ("epoll: wire up syscall epoll_pwait2") wired up
> > the 64 bit syscall instead of the compat variant in a couple of places.
> >
> > Cc: Willem de Bruijn <willemb@google.com>
> > Cc: Al Viro <viro@zeniv.linux.org.uk>
> > Cc: Arnd Bergmann <arnd@arndb.de>
> > Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
> > Cc: Catalin Marinas <catalin.marinas@arm.com>
> > Cc: Will Deacon <will@kernel.org>
> > Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
> > Cc: Vasily Gorbik <gor@linux.ibm.com>
> > Cc: Christian Borntraeger <borntraeger@de.ibm.com>
> > Cc: "David S. Miller" <davem@davemloft.net>
> > Fixes: b0a0c2615f6f ("epoll: wire up syscall epoll_pwait2")
> > Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
> > ---
> >  arch/arm64/include/asm/unistd32.h         | 2 +-
> >  arch/mips/kernel/syscalls/syscall_n32.tbl | 2 +-
> >  arch/s390/kernel/syscalls/syscall.tbl     | 2 +-
> >  arch/sparc/kernel/syscalls/syscall.tbl    | 2 +-
> >  4 files changed, 4 insertions(+), 4 deletions(-)
>
> I double-checked all the entries to make sure you caught all
> the missing ones, looks good.
>
> Acked-by: Arnd Bergmann <arnd@arndb.de>

Acked-by: Willem de Bruijn <willemb@google.com>

Thanks a lot. I also arrived at the same list after comparing to
epoll_pwait and signalfd (for sigset) and ppoll_time64 (for timespec64).

Slightly tangential, it's not immediately clear to me why in
arch/x86/entry/syscalls/syscall_32.tbl epoll_pwait does not need a
compat entry, unlike on other architectures and unlike signalfd.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] epoll: fix compat syscall wire up of epoll_pwait2
  2020-12-20 18:22   ` Willem de Bruijn
@ 2020-12-20 18:51     ` Linus Torvalds
  2020-12-20 20:14       ` Arnd Bergmann
  0 siblings, 1 reply; 8+ messages in thread
From: Linus Torvalds @ 2020-12-20 18:51 UTC (permalink / raw)
  To: Willem de Bruijn, Andy Lutomirski, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, Peter Anvin
  Cc: Heiko Carstens, Arnd Bergmann, Andrew Morton, linux-kernel,
	Al Viro, Arnd Bergmann, Matthew Wilcox, Catalin Marinas,
	Will Deacon, Thomas Bogendoerfer, Vasily Gorbik,
	Christian Borntraeger, David S. Miller, the arch/x86 maintainers

On Sun, Dec 20, 2020 at 10:22 AM Willem de Bruijn
<willemdebruijn.kernel@gmail.com> wrote:
>
> Slightly tangential, it's not immediately clear to me why in
> arch/x86/entry/syscalls/syscall_32.tbl epoll_pwait does not need a
> compat entry, unlike on other architectures and unlike signalfd.

Hmm. Good question. That looks like a bug to me. Probably nobody
noticed because it's so rarely used.

Or maybe I'm missing something too.

Adding x86 entry code people to the participants.

             Linus

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] epoll: fix compat syscall wire up of epoll_pwait2
  2020-12-20 18:51     ` Linus Torvalds
@ 2020-12-20 20:14       ` Arnd Bergmann
  2020-12-20 21:06         ` Linus Torvalds
  0 siblings, 1 reply; 8+ messages in thread
From: Arnd Bergmann @ 2020-12-20 20:14 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Willem de Bruijn, Andy Lutomirski, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, Peter Anvin, Heiko Carstens, Andrew Morton,
	linux-kernel, Al Viro, Arnd Bergmann, Matthew Wilcox,
	Catalin Marinas, Will Deacon, Thomas Bogendoerfer, Vasily Gorbik,
	Christian Borntraeger, David S. Miller, the arch/x86 maintainers

On Sun, Dec 20, 2020 at 7:51 PM Linus Torvalds
<torvalds@linux-foundation.org> wrote:
>
> On Sun, Dec 20, 2020 at 10:22 AM Willem de Bruijn
> <willemdebruijn.kernel@gmail.com> wrote:
> >
> > Slightly tangential, it's not immediately clear to me why in
> > arch/x86/entry/syscalls/syscall_32.tbl epoll_pwait does not need a
> > compat entry, unlike on other architectures and unlike signalfd.
>
> Hmm. Good question. That looks like a bug to me. Probably nobody
> noticed because it's so rarely used.
>
> Or maybe I'm missing something too.
>
> Adding x86 entry code people to the participants.

The sigset_t argument is actually compatible between x86-32 and x86-64
because

- The bits are in the same order on little-endian machines
- _NSIG is the same as _COMPAT_NSIG (unlike old sparc kernels)
- accessing a 64-bit with 32-bit alignment is always allowed on x86

All other architectures with compat mode support big-endian
code at least as an option, so they have to use the compat
version.

         Arnd

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] epoll: fix compat syscall wire up of epoll_pwait2
  2020-12-20 20:14       ` Arnd Bergmann
@ 2020-12-20 21:06         ` Linus Torvalds
  2020-12-20 23:18           ` Arnd Bergmann
  0 siblings, 1 reply; 8+ messages in thread
From: Linus Torvalds @ 2020-12-20 21:06 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Willem de Bruijn, Andy Lutomirski, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, Peter Anvin, Heiko Carstens, Andrew Morton,
	linux-kernel, Al Viro, Arnd Bergmann, Matthew Wilcox,
	Catalin Marinas, Will Deacon, Thomas Bogendoerfer, Vasily Gorbik,
	Christian Borntraeger, David S. Miller, the arch/x86 maintainers

On Sun, Dec 20, 2020 at 12:14 PM Arnd Bergmann <arnd@kernel.org> wrote:
>
> The sigset_t argument is actually compatible between x86-32 and x86-64

Well, random high bits in size_t or the pointer value aren't. So it
still looks a bit iffy to me.

But it might end up working almost by accident.

          Linus

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] epoll: fix compat syscall wire up of epoll_pwait2
  2020-12-20 21:06         ` Linus Torvalds
@ 2020-12-20 23:18           ` Arnd Bergmann
  0 siblings, 0 replies; 8+ messages in thread
From: Arnd Bergmann @ 2020-12-20 23:18 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Willem de Bruijn, Andy Lutomirski, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, Peter Anvin, Heiko Carstens, Andrew Morton,
	linux-kernel, Al Viro, Arnd Bergmann, Matthew Wilcox,
	Catalin Marinas, Will Deacon, Thomas Bogendoerfer, Vasily Gorbik,
	Christian Borntraeger, David S. Miller, the arch/x86 maintainers

On Sun, Dec 20, 2020 at 10:06 PM Linus Torvalds
<torvalds@linux-foundation.org> wrote:
>
> On Sun, Dec 20, 2020 at 12:14 PM Arnd Bergmann <arnd@kernel.org> wrote:
> >
> > The sigset_t argument is actually compatible between x86-32 and x86-64
>
> Well, random high bits in size_t or the pointer value aren't. So it
> still looks a bit iffy to me.
>
> But it might end up working almost by accident.

The direct syscall arguments all get the correct zero-extension with
asm/syscall_wrapper.h, just like they do with any other syscall that
is used in both native and compat mode, like epoll_wait().

It probably makes sense to change it just for consistency with the other
architectures, but I would assume that it was intentional when this was
added originally, as the compat handling for epoll_pwait() went through
several iterations before it first worked correctly.

        Arnd

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] epoll: fix compat syscall wire up of epoll_pwait2
  2020-12-20  9:58 [PATCH] epoll: fix compat syscall wire up of epoll_pwait2 Heiko Carstens
  2020-12-20 11:43 ` Arnd Bergmann
@ 2020-12-23 14:48 ` Will Deacon
  1 sibling, 0 replies; 8+ messages in thread
From: Will Deacon @ 2020-12-23 14:48 UTC (permalink / raw)
  To: Heiko Carstens
  Cc: Andrew Morton, linux-kernel, Linus Torvalds, Willem de Bruijn,
	Al Viro, Arnd Bergmann, Matthew Wilcox, Catalin Marinas,
	Thomas Bogendoerfer, Vasily Gorbik, Christian Borntraeger,
	David S. Miller

On Sun, Dec 20, 2020 at 10:58:30AM +0100, Heiko Carstens wrote:
> Commit b0a0c2615f6f ("epoll: wire up syscall epoll_pwait2") wired up
> the 64 bit syscall instead of the compat variant in a couple of places.
> 
> Cc: Willem de Bruijn <willemb@google.com>
> Cc: Al Viro <viro@zeniv.linux.org.uk>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will@kernel.org>
> Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
> Cc: Vasily Gorbik <gor@linux.ibm.com>
> Cc: Christian Borntraeger <borntraeger@de.ibm.com>
> Cc: "David S. Miller" <davem@davemloft.net>
> Fixes: b0a0c2615f6f ("epoll: wire up syscall epoll_pwait2")
> Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
> ---
>  arch/arm64/include/asm/unistd32.h         | 2 +-
>  arch/mips/kernel/syscalls/syscall_n32.tbl | 2 +-
>  arch/s390/kernel/syscalls/syscall.tbl     | 2 +-
>  arch/sparc/kernel/syscalls/syscall.tbl    | 2 +-
>  4 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/arm64/include/asm/unistd32.h b/arch/arm64/include/asm/unistd32.h
> index f4bca2b90218..cccfbbefbf95 100644
> --- a/arch/arm64/include/asm/unistd32.h
> +++ b/arch/arm64/include/asm/unistd32.h
> @@ -890,7 +890,7 @@ __SYSCALL(__NR_faccessat2, sys_faccessat2)
>  #define __NR_process_madvise 440
>  __SYSCALL(__NR_process_madvise, sys_process_madvise)
>  #define __NR_epoll_pwait2 441
> -__SYSCALL(__NR_epoll_pwait2, sys_epoll_pwait2)
> +__SYSCALL(__NR_epoll_pwait2, compat_sys_epoll_pwait2)


For this bit ^^

Acked-by: Will Deacon <will@kernel.org>

Will

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-12-23 14:48 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-20  9:58 [PATCH] epoll: fix compat syscall wire up of epoll_pwait2 Heiko Carstens
2020-12-20 11:43 ` Arnd Bergmann
2020-12-20 18:22   ` Willem de Bruijn
2020-12-20 18:51     ` Linus Torvalds
2020-12-20 20:14       ` Arnd Bergmann
2020-12-20 21:06         ` Linus Torvalds
2020-12-20 23:18           ` Arnd Bergmann
2020-12-23 14:48 ` Will Deacon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).