Re: [PATCH] epoll: fix compat syscall wire up of epoll_pwait2

From: Arnd Bergmann
Date: Sun Dec 20 2020 - 15:16:54 EST


On Sun, Dec 20, 2020 at 7:51 PM Linus Torvalds
<torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:
>
> On Sun, Dec 20, 2020 at 10:22 AM Willem de Bruijn
> <willemdebruijn.kernel@xxxxxxxxx> 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