mbox series

[0/6] linux: Some syscall refactors

Message ID 20211122185437.1934590-1-adhemerval.zanella@linaro.org
Headers show
Series linux: Some syscall refactors | expand

Message

Adhemerval Zanella Nov. 22, 2021, 6:54 p.m. UTC
The autogeneration syscall list has some limitations:

  * 64-bit arguments might require to override with the specific
    kernel ABI (for instance if the ABI required even-off register
    number).

  * LFS might also incur arch-specific override.

  * Variadic call is also another source of potential issues,
    since some architectures might use a different call mechanism
    (for instance passing argument on the stack instead of registers)
    and the argument might impose some non obvious issues (for
    instance if 64-bit argument are used).

Besides this issue, this patchset also refactors pipe (to remove the
usage of arch-specific kernel ABIS), and provide C generic
implementations for syscall and ioctl.

Adhemerval Zanella (6):
  linux: Add fanotify_mark C implementation
  linux: Add prlimit64 C implementation
  linux: Implement mremap in C
  linux: Implement pipe in terms of __NR_pipe2
  linux: Add generic syscall implementation
  linux: Add generic ioctl implementation

 sysdeps/unix/sysdep.h                         | 20 ++++++
 sysdeps/unix/sysv/linux/Makefile              |  6 +-
 sysdeps/unix/sysv/linux/alpha/pipe.S          |  1 -
 sysdeps/unix/sysv/linux/arm/syscalls.list     |  4 --
 .../{sparc/sparc32/pipe.S => fanotify_mark.c} | 38 +++++------
 .../linux/generic/wordsize-32/syscalls.list   |  5 --
 sysdeps/unix/sysv/linux/hppa/fanotify_mark.c  |  2 +
 sysdeps/unix/sysv/linux/hppa/prlimit64.c      |  2 +
 sysdeps/unix/sysv/linux/hppa/syscall.c        | 65 ------------------
 sysdeps/unix/sysv/linux/hppa/syscalls.list    |  2 -
 sysdeps/unix/sysv/linux/i386/syscalls.list    |  4 --
 sysdeps/unix/sysv/linux/ia64/pipe.S           | 36 ----------
 .../pipe.S => sysv/linux/internal-ioctl.h}    | 23 +++----
 sysdeps/unix/sysv/linux/ioctl.c               | 49 +++++++++++++
 sysdeps/unix/sysv/linux/m68k/syscalls.list    |  2 -
 .../unix/sysv/linux/microblaze/syscalls.list  |  2 -
 .../unix/sysv/linux/mips/mips32/syscalls.list |  5 --
 .../sysv/linux/mips/mips64/n32/syscalls.list  |  4 --
 .../sysv/linux/mips/mips64/n64/syscalls.list  |  4 --
 sysdeps/unix/sysv/linux/mips/pipe.S           |  1 -
 .../linux/{sparc/sparc64/pipe.S => mremap.c}  | 40 +++++------
 sysdeps/unix/sysv/linux/{generic => }/pipe.c  |  5 +-
 .../linux/powerpc/internal-ioctl.h}           | 39 +++++++----
 sysdeps/unix/sysv/linux/powerpc/ioctl.c       | 68 -------------------
 .../linux/powerpc/powerpc32/syscalls.list     |  3 -
 sysdeps/unix/sysv/linux/prlimit.c             |  2 +
 .../sysv/linux/{sh/pipe.S => prlimit64.c}     | 45 ++++++------
 sysdeps/unix/sysv/linux/riscv/syscall.c       |  4 +-
 .../sysv/linux/s390/s390-32/syscalls.list     |  2 -
 sysdeps/unix/sysv/linux/sh/fanotify_mark.c    |  2 +
 sysdeps/unix/sysv/linux/sh/syscalls.list      |  4 --
 .../sysv/linux/sparc/sparc32/syscalls.list    |  3 -
 sysdeps/unix/sysv/linux/syscall.c             | 43 ++++++++++++
 sysdeps/unix/sysv/linux/syscalls.list         |  2 -
 .../unix/sysv/linux/wordsize-64/syscalls.list |  3 -
 35 files changed, 225 insertions(+), 315 deletions(-)
 delete mode 100644 sysdeps/unix/sysv/linux/alpha/pipe.S
 rename sysdeps/unix/sysv/linux/{sparc/sparc32/pipe.S => fanotify_mark.c} (56%)
 delete mode 100644 sysdeps/unix/sysv/linux/generic/wordsize-32/syscalls.list
 create mode 100644 sysdeps/unix/sysv/linux/hppa/fanotify_mark.c
 create mode 100644 sysdeps/unix/sysv/linux/hppa/prlimit64.c
 delete mode 100644 sysdeps/unix/sysv/linux/hppa/syscall.c
 delete mode 100644 sysdeps/unix/sysv/linux/ia64/pipe.S
 rename sysdeps/unix/{alpha/pipe.S => sysv/linux/internal-ioctl.h} (69%)
 create mode 100644 sysdeps/unix/sysv/linux/ioctl.c
 delete mode 100644 sysdeps/unix/sysv/linux/mips/mips32/syscalls.list
 delete mode 100644 sysdeps/unix/sysv/linux/mips/pipe.S
 rename sysdeps/unix/sysv/linux/{sparc/sparc64/pipe.S => mremap.c} (56%)
 rename sysdeps/unix/sysv/linux/{generic => }/pipe.c (87%)
 rename sysdeps/unix/{mips/pipe.S => sysv/linux/powerpc/internal-ioctl.h} (53%)
 delete mode 100644 sysdeps/unix/sysv/linux/powerpc/ioctl.c
 rename sysdeps/unix/sysv/linux/{sh/pipe.S => prlimit64.c} (53%)
 create mode 100644 sysdeps/unix/sysv/linux/sh/fanotify_mark.c
 create mode 100644 sysdeps/unix/sysv/linux/syscall.c