[00/26] Linux cleanups enabled by built-in system call tables

Message ID cover.1581279333.git.fweimer@redhat.com
Headers show
Series
  • Linux cleanups enabled by built-in system call tables
Related show

Message

Florian Weimer Feb. 9, 2020, 8:19 p.m.
This series cleans up various quirks in the Linux implementation related
to historic lack of system call numbers in several places.

It has been tested on aarch64-linux-gnu, i686-linux-gnu,
powerpc64le-linux-gnu, s390x-linux-gnu, x86_64-linux-gnu, and also built
with build-many-glibcs-py.

I did not touch the futex #ifdefs because they are going to change soon
enough.

Thanks,
Florian

Florian Weimer (26):
  Linux: Enhance glibcsyscalls.h to support listing system calls
  Linux: renameat2 syscall number is always available
  Linux: copy_file_range syscall number is always available
  Linux: mlock2 syscall number is always available
  Linux: mq_* syscall numbers are always available
  Linux: statx syscall number is always available
  Linux: sched_setaffinity syscall number is always available
  Linux: sched_getaffinity syscall number is always available
  Linux: sigaltstack syscall number is always available
  Linux: Clean up pread64/pwrite64 system call names
  Linux: Clean up preadv2, pwritev2 system call names
  Linux: Clean up preadv, pwritev system call names
  Linux: getrandom syscall number is always available
  Linux: rt_sigqueueinfo syscall number is always available
  Linux: pkey_mprotect syscall number is always available
  Linux: set_tid_address syscall number is always available
  Linux: exit_group syscall number is always available
  Linux: getdents64 syscall number is always available on MIPS
  Linux: pciconfig_iobase syscall number is always available on alpha
  Linux: set_robust_list syscall number is always available
  Linux: open_by_handle_at syscall number is always available
  ia64: Do not define __NR_semtimedop in <sysdep.h>
  x86_64: Do not define __NR_semtimedop in <sysdep.h>
  Linux: epoll_pwait syscall number is always available
  m68k: getpagesize syscall number is always available
  microblaze: vfork is always available

 nptl/nptl-init.c                              |  4 -
 nptl/pthread_create.c                         |  6 +-
 sysdeps/nptl/fork.c                           | 10 +--
 sysdeps/unix/sysv/linux/_exit.c               |  2 -
 sysdeps/unix/sysv/linux/aio_sigqueue.c        |  5 --
 sysdeps/unix/sysv/linux/alpha/ioperm.c        |  2 -
 sysdeps/unix/sysv/linux/copy_file_range.c     |  5 --
 sysdeps/unix/sysv/linux/epoll_pwait.c         | 16 ----
 sysdeps/unix/sysv/linux/gai_sigqueue.c        |  5 --
 sysdeps/unix/sysv/linux/generic/sysdep.h      |  8 --
 sysdeps/unix/sysv/linux/getentropy.c          |  9 --
 sysdeps/unix/sysv/linux/getrandom.c           | 13 ---
 sysdeps/unix/sysv/linux/glibcsyscalls.py      | 86 ++++++++++++++++++-
 sysdeps/unix/sysv/linux/ia64/sysdep.h         |  6 --
 sysdeps/unix/sysv/linux/m68k/getpagesize.c    |  4 -
 sysdeps/unix/sysv/linux/microblaze/vfork.S    |  4 -
 .../unix/sysv/linux/mips/mips64/getdents64.c  |  2 -
 sysdeps/unix/sysv/linux/mlock2.c              |  2 -
 sysdeps/unix/sysv/linux/mq_close.c            |  6 --
 sysdeps/unix/sysv/linux/mq_getattr.c          |  6 --
 sysdeps/unix/sysv/linux/mq_notify.c           |  6 --
 sysdeps/unix/sysv/linux/mq_open.c             |  5 --
 sysdeps/unix/sysv/linux/mq_receive.c          |  6 --
 sysdeps/unix/sysv/linux/mq_send.c             |  6 --
 sysdeps/unix/sysv/linux/mq_unlink.c           |  6 --
 sysdeps/unix/sysv/linux/nscd_setup_thread.c   |  2 -
 sysdeps/unix/sysv/linux/open_by_handle_at.c   |  9 --
 sysdeps/unix/sysv/linux/pkey_mprotect.c       |  5 --
 sysdeps/unix/sysv/linux/pread.c               |  6 +-
 sysdeps/unix/sysv/linux/pread64.c             |  4 -
 sysdeps/unix/sysv/linux/pread64_nocancel.c    |  4 -
 sysdeps/unix/sysv/linux/preadv.c              |  6 --
 sysdeps/unix/sysv/linux/preadv2.c             |  7 +-
 sysdeps/unix/sysv/linux/preadv64.c            | 10 +--
 sysdeps/unix/sysv/linux/preadv64v2.c          |  9 +-
 sysdeps/unix/sysv/linux/pwrite.c              |  6 +-
 sysdeps/unix/sysv/linux/pwrite64.c            |  4 -
 sysdeps/unix/sysv/linux/pwritev.c             |  6 --
 sysdeps/unix/sysv/linux/pwritev2.c            |  4 +-
 sysdeps/unix/sysv/linux/pwritev64.c           | 10 +--
 sysdeps/unix/sysv/linux/pwritev64v2.c         |  9 +-
 sysdeps/unix/sysv/linux/renameat2.c           |  7 +-
 sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h | 11 ---
 sysdeps/unix/sysv/linux/sched_getaffinity.c   | 10 +--
 sysdeps/unix/sysv/linux/sched_setaffinity.c   |  7 +-
 sysdeps/unix/sysv/linux/sigstack.c            |  4 -
 sysdeps/unix/sysv/linux/statx.c               | 11 +--
 sysdeps/unix/sysv/linux/x86_64/sysdep.h       |  7 --
 48 files changed, 115 insertions(+), 273 deletions(-)

-- 
2.24.1

Comments

Lukasz Majewski Feb. 10, 2020, 11:25 p.m. | #1
Hi Florian,

> This series cleans up various quirks in the Linux implementation

> related to historic lack of system call numbers in several places.


I'm wondering if those "system call tables" are generated from headers
from contemporary Linux (e.g. 5.5) or the oldest supported by glibc
(3.2)?

Moreover, I thought that the

#ifdef __NR_foo_syscall__ define was to prevent from mismatch between
newest glibc build with old linux kernel headers and running under yet
another kernel.

Is there any documentation regarding this new "approach"/"feature" with
those "system call tables"?

(I'm asking as I'm a bit puzzled).

Thanks in advance for explanation.

> 

> It has been tested on aarch64-linux-gnu, i686-linux-gnu,

> powerpc64le-linux-gnu, s390x-linux-gnu, x86_64-linux-gnu, and also

> built with build-many-glibcs-py.

> 

> I did not touch the futex #ifdefs because they are going to change

> soon enough.

> 

> Thanks,

> Florian

> 

> Florian Weimer (26):

>   Linux: Enhance glibcsyscalls.h to support listing system calls

>   Linux: renameat2 syscall number is always available

>   Linux: copy_file_range syscall number is always available

>   Linux: mlock2 syscall number is always available

>   Linux: mq_* syscall numbers are always available

>   Linux: statx syscall number is always available

>   Linux: sched_setaffinity syscall number is always available

>   Linux: sched_getaffinity syscall number is always available

>   Linux: sigaltstack syscall number is always available

>   Linux: Clean up pread64/pwrite64 system call names

>   Linux: Clean up preadv2, pwritev2 system call names

>   Linux: Clean up preadv, pwritev system call names

>   Linux: getrandom syscall number is always available

>   Linux: rt_sigqueueinfo syscall number is always available

>   Linux: pkey_mprotect syscall number is always available

>   Linux: set_tid_address syscall number is always available

>   Linux: exit_group syscall number is always available

>   Linux: getdents64 syscall number is always available on MIPS

>   Linux: pciconfig_iobase syscall number is always available on alpha

>   Linux: set_robust_list syscall number is always available

>   Linux: open_by_handle_at syscall number is always available

>   ia64: Do not define __NR_semtimedop in <sysdep.h>

>   x86_64: Do not define __NR_semtimedop in <sysdep.h>

>   Linux: epoll_pwait syscall number is always available

>   m68k: getpagesize syscall number is always available

>   microblaze: vfork is always available

> 

>  nptl/nptl-init.c                              |  4 -

>  nptl/pthread_create.c                         |  6 +-

>  sysdeps/nptl/fork.c                           | 10 +--

>  sysdeps/unix/sysv/linux/_exit.c               |  2 -

>  sysdeps/unix/sysv/linux/aio_sigqueue.c        |  5 --

>  sysdeps/unix/sysv/linux/alpha/ioperm.c        |  2 -

>  sysdeps/unix/sysv/linux/copy_file_range.c     |  5 --

>  sysdeps/unix/sysv/linux/epoll_pwait.c         | 16 ----

>  sysdeps/unix/sysv/linux/gai_sigqueue.c        |  5 --

>  sysdeps/unix/sysv/linux/generic/sysdep.h      |  8 --

>  sysdeps/unix/sysv/linux/getentropy.c          |  9 --

>  sysdeps/unix/sysv/linux/getrandom.c           | 13 ---

>  sysdeps/unix/sysv/linux/glibcsyscalls.py      | 86

> ++++++++++++++++++- sysdeps/unix/sysv/linux/ia64/sysdep.h         |

> 6 -- sysdeps/unix/sysv/linux/m68k/getpagesize.c    |  4 -

>  sysdeps/unix/sysv/linux/microblaze/vfork.S    |  4 -

>  .../unix/sysv/linux/mips/mips64/getdents64.c  |  2 -

>  sysdeps/unix/sysv/linux/mlock2.c              |  2 -

>  sysdeps/unix/sysv/linux/mq_close.c            |  6 --

>  sysdeps/unix/sysv/linux/mq_getattr.c          |  6 --

>  sysdeps/unix/sysv/linux/mq_notify.c           |  6 --

>  sysdeps/unix/sysv/linux/mq_open.c             |  5 --

>  sysdeps/unix/sysv/linux/mq_receive.c          |  6 --

>  sysdeps/unix/sysv/linux/mq_send.c             |  6 --

>  sysdeps/unix/sysv/linux/mq_unlink.c           |  6 --

>  sysdeps/unix/sysv/linux/nscd_setup_thread.c   |  2 -

>  sysdeps/unix/sysv/linux/open_by_handle_at.c   |  9 --

>  sysdeps/unix/sysv/linux/pkey_mprotect.c       |  5 --

>  sysdeps/unix/sysv/linux/pread.c               |  6 +-

>  sysdeps/unix/sysv/linux/pread64.c             |  4 -

>  sysdeps/unix/sysv/linux/pread64_nocancel.c    |  4 -

>  sysdeps/unix/sysv/linux/preadv.c              |  6 --

>  sysdeps/unix/sysv/linux/preadv2.c             |  7 +-

>  sysdeps/unix/sysv/linux/preadv64.c            | 10 +--

>  sysdeps/unix/sysv/linux/preadv64v2.c          |  9 +-

>  sysdeps/unix/sysv/linux/pwrite.c              |  6 +-

>  sysdeps/unix/sysv/linux/pwrite64.c            |  4 -

>  sysdeps/unix/sysv/linux/pwritev.c             |  6 --

>  sysdeps/unix/sysv/linux/pwritev2.c            |  4 +-

>  sysdeps/unix/sysv/linux/pwritev64.c           | 10 +--

>  sysdeps/unix/sysv/linux/pwritev64v2.c         |  9 +-

>  sysdeps/unix/sysv/linux/renameat2.c           |  7 +-

>  sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h | 11 ---

>  sysdeps/unix/sysv/linux/sched_getaffinity.c   | 10 +--

>  sysdeps/unix/sysv/linux/sched_setaffinity.c   |  7 +-

>  sysdeps/unix/sysv/linux/sigstack.c            |  4 -

>  sysdeps/unix/sysv/linux/statx.c               | 11 +--

>  sysdeps/unix/sysv/linux/x86_64/sysdep.h       |  7 --

>  48 files changed, 115 insertions(+), 273 deletions(-)

> 





Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de
Joseph Myers Feb. 10, 2020, 11:56 p.m. | #2
On Tue, 11 Feb 2020, Lukasz Majewski wrote:

> Hi Florian,

> 

> > This series cleans up various quirks in the Linux implementation

> > related to historic lack of system call numbers in several places.

> 

> I'm wondering if those "system call tables" are generated from headers

> from contemporary Linux (e.g. 5.5) or the oldest supported by glibc

> (3.2)?


See commit 4cf0d223052dabb9caed29e1e91e1d61933e14fb and the next few 
commits.

-- 
Joseph S. Myers
joseph@codesourcery.com
Florian Weimer Feb. 11, 2020, 7:46 a.m. | #3
* Lukasz Majewski:

>> This series cleans up various quirks in the Linux implementation

>> related to historic lack of system call numbers in several places.

>

> I'm wondering if those "system call tables" are generated from headers

> from contemporary Linux (e.g. 5.5) or the oldest supported by glibc

> (3.2)?


We are keeping them up-to-date with the latest released kernel headers.

> Moreover, I thought that the

>

> #ifdef __NR_foo_syscall__ define was to prevent from mismatch between

> newest glibc build with old linux kernel headers and running under yet

> another kernel.


It is very common that new system call numbers are backported.  This
happens even in upstream stable kernel series.  We expect that the glibc
sources are written in such a way that the __NR_* #ifdefs only cover the
availability of the number itself.  They are not treated as a proxy for
anything else (such as availability of types in headers or individual
header files).

I've posted a patch series that should clarify this: it removes historic
#ifdefs which are no longer needed under the new model:

  <https://www.sourceware.org/ml/libc-alpha/2020-02/msg00214.html>

> Is there any documentation regarding this new "approach"/"feature" with

> those "system call tables"?


I'm not sure what needs to be documented.  Only two things should have
changed:

* It is no longer necessary to write these #ifdefs.

* If one compiles glibc with older UAPI headers, you still get a full
  glibc with all features, as far is that possible.  Previously, some
  parts could be stubbed out (e.g., return ENOSYS unconditionally even
  if the kernel supports the feature).  Now, this only happens if Linux
  has not published required system call numbers.

Thanks,
Florian
Florian Weimer Feb. 11, 2020, 11:07 a.m. | #4
* Florian Weimer:

> I've posted a patch series that should clarify this: it removes historic

> #ifdefs which are no longer needed under the new model:

>

>   <https://www.sourceware.org/ml/libc-alpha/2020-02/msg00214.html>


Sorry, please disregard this part.  I was confused.

Florian