Linux: Add execveat system call wrapper

Message ID 20201126212855.830998-1-ahajkova@redhat.com
State Superseded
Headers
Series Linux: Add execveat system call wrapper |

Commit Message

Alexandra Hájková Nov. 26, 2020, 9:28 p.m. UTC
  From: Alexandra Hájková <ahajkova@redhat.com>

 Also add the test for the new wrapper.
---
This iterations adds * NEWS update
                     * uses stat64 to use the LFS interface
                     * uses __openat_nocancel to open the fd without the cancelation point
                     * some cosmetic changs
                     * the docs are are blocked on a generic section on *at functions and O_PATH (the patch by Florian Weimer was already posted)

 NEWS                                          |   2 +
 posix/Makefile                                |   5 +-
 posix/Versions                                |   3 +
 posix/execveat.c                              |  40 ++++
 posix/tst-execveat.c                          | 174 ++++++++++++++++++
 posix/unistd.h                                |   5 +
 sysdeps/mach/hurd/i386/libc.abilist           |   1 +
 sysdeps/unix/sysv/linux/Makefile              |   2 +-
 sysdeps/unix/sysv/linux/aarch64/libc.abilist  |   1 +
 sysdeps/unix/sysv/linux/alpha/libc.abilist    |   1 +
 sysdeps/unix/sysv/linux/arm/be/libc.abilist   |   1 +
 sysdeps/unix/sysv/linux/arm/le/libc.abilist   |   1 +
 sysdeps/unix/sysv/linux/csky/libc.abilist     |   1 +
 sysdeps/unix/sysv/linux/execveat.c            |  79 ++++++++
 sysdeps/unix/sysv/linux/hppa/libc.abilist     |   1 +
 sysdeps/unix/sysv/linux/i386/libc.abilist     |   1 +
 sysdeps/unix/sysv/linux/ia64/libc.abilist     |   1 +
 .../sysv/linux/m68k/coldfire/libc.abilist     |   1 +
 .../unix/sysv/linux/m68k/m680x0/libc.abilist  |   1 +
 .../sysv/linux/microblaze/be/libc.abilist     |   1 +
 .../sysv/linux/microblaze/le/libc.abilist     |   1 +
 .../sysv/linux/mips/mips32/fpu/libc.abilist   |   1 +
 .../sysv/linux/mips/mips32/nofpu/libc.abilist |   1 +
 .../sysv/linux/mips/mips64/n32/libc.abilist   |   1 +
 .../sysv/linux/mips/mips64/n64/libc.abilist   |   1 +
 sysdeps/unix/sysv/linux/nios2/libc.abilist    |   1 +
 .../linux/powerpc/powerpc32/fpu/libc.abilist  |   1 +
 .../powerpc/powerpc32/nofpu/libc.abilist      |   1 +
 .../linux/powerpc/powerpc64/be/libc.abilist   |   1 +
 .../linux/powerpc/powerpc64/le/libc.abilist   |   1 +
 .../unix/sysv/linux/riscv/rv64/libc.abilist   |   1 +
 .../unix/sysv/linux/s390/s390-32/libc.abilist |   1 +
 .../unix/sysv/linux/s390/s390-64/libc.abilist |   1 +
 sysdeps/unix/sysv/linux/sh/be/libc.abilist    |   1 +
 sysdeps/unix/sysv/linux/sh/le/libc.abilist    |   1 +
 .../sysv/linux/sparc/sparc32/libc.abilist     |   1 +
 .../sysv/linux/sparc/sparc64/libc.abilist     |   1 +
 .../unix/sysv/linux/x86_64/64/libc.abilist    |   1 +
 .../unix/sysv/linux/x86_64/x32/libc.abilist   |   1 +
 39 files changed, 338 insertions(+), 3 deletions(-)
 create mode 100644 posix/execveat.c
 create mode 100644 posix/tst-execveat.c
 create mode 100644 sysdeps/unix/sysv/linux/execveat.c
  

Comments

Adhemerval Zanella Netto Nov. 27, 2020, 2:58 p.m. UTC | #1
On 26/11/2020 18:28, Alexandra Hájková via Libc-alpha wrote:
> From: Alexandra Hájková <ahajkova@redhat.com>
> 
>  Also add the test for the new wrapper.
> ---
> This iterations adds * NEWS update
>                      * uses stat64 to use the LFS interface
>                      * uses __openat_nocancel to open the fd without the cancelation point
>                      * some cosmetic changs
>                      * the docs are are blocked on a generic section on *at functions and O_PATH (the patch by Florian Weimer was already posted)

Some comments below.

> 
>  NEWS                                          |   2 +
>  posix/Makefile                                |   5 +-
>  posix/Versions                                |   3 +
>  posix/execveat.c                              |  40 ++++
>  posix/tst-execveat.c                          | 174 ++++++++++++++++++
>  posix/unistd.h                                |   5 +
>  sysdeps/mach/hurd/i386/libc.abilist           |   1 +
>  sysdeps/unix/sysv/linux/Makefile              |   2 +-
>  sysdeps/unix/sysv/linux/aarch64/libc.abilist  |   1 +
>  sysdeps/unix/sysv/linux/alpha/libc.abilist    |   1 +
>  sysdeps/unix/sysv/linux/arm/be/libc.abilist   |   1 +
>  sysdeps/unix/sysv/linux/arm/le/libc.abilist   |   1 +
>  sysdeps/unix/sysv/linux/csky/libc.abilist     |   1 +
>  sysdeps/unix/sysv/linux/execveat.c            |  79 ++++++++
>  sysdeps/unix/sysv/linux/hppa/libc.abilist     |   1 +
>  sysdeps/unix/sysv/linux/i386/libc.abilist     |   1 +
>  sysdeps/unix/sysv/linux/ia64/libc.abilist     |   1 +
>  .../sysv/linux/m68k/coldfire/libc.abilist     |   1 +
>  .../unix/sysv/linux/m68k/m680x0/libc.abilist  |   1 +
>  .../sysv/linux/microblaze/be/libc.abilist     |   1 +
>  .../sysv/linux/microblaze/le/libc.abilist     |   1 +
>  .../sysv/linux/mips/mips32/fpu/libc.abilist   |   1 +
>  .../sysv/linux/mips/mips32/nofpu/libc.abilist |   1 +
>  .../sysv/linux/mips/mips64/n32/libc.abilist   |   1 +
>  .../sysv/linux/mips/mips64/n64/libc.abilist   |   1 +
>  sysdeps/unix/sysv/linux/nios2/libc.abilist    |   1 +
>  .../linux/powerpc/powerpc32/fpu/libc.abilist  |   1 +
>  .../powerpc/powerpc32/nofpu/libc.abilist      |   1 +
>  .../linux/powerpc/powerpc64/be/libc.abilist   |   1 +
>  .../linux/powerpc/powerpc64/le/libc.abilist   |   1 +
>  .../unix/sysv/linux/riscv/rv64/libc.abilist   |   1 +
>  .../unix/sysv/linux/s390/s390-32/libc.abilist |   1 +
>  .../unix/sysv/linux/s390/s390-64/libc.abilist |   1 +
>  sysdeps/unix/sysv/linux/sh/be/libc.abilist    |   1 +
>  sysdeps/unix/sysv/linux/sh/le/libc.abilist    |   1 +
>  .../sysv/linux/sparc/sparc32/libc.abilist     |   1 +
>  .../sysv/linux/sparc/sparc64/libc.abilist     |   1 +
>  .../unix/sysv/linux/x86_64/64/libc.abilist    |   1 +
>  .../unix/sysv/linux/x86_64/x32/libc.abilist   |   1 +
>  39 files changed, 338 insertions(+), 3 deletions(-)
>  create mode 100644 posix/execveat.c
>  create mode 100644 posix/tst-execveat.c
>  create mode 100644 sysdeps/unix/sysv/linux/execveat.c
> 
> diff --git a/NEWS b/NEWS
> index 685b93c8e9..962480f2e6 100644
> --- a/NEWS
> +++ b/NEWS
> @@ -28,6 +28,8 @@ Major new features:
>    The 32-bit RISC-V port requires at least Linux 5.4, GCC 7.1 and binutils
>    2.28.
>  
> +* Add execveat system call wrapper.
> +

I think we could extend it a bit:

  * The function execveat have been added and it operates similar to execve.
    The syscall is already used to implement fexecve without require /proc to
    be mounted.  Similar to fexecve, if the syscall is not supported a fallback
    which access /proc is used.

>  Deprecated and removed features, and other changes affecting compatibility:
>  
>  * The mallinfo function is marked deprecated.  Callers should call
> diff --git a/posix/Makefile b/posix/Makefile
> index 4bfc8d942c..ca678ad781 100644
> --- a/posix/Makefile
> +++ b/posix/Makefile
> @@ -65,7 +65,8 @@ routines :=								      \
>  	spawnattr_setsigmask spawnattr_setschedpolicy spawnattr_setschedparam \
>  	posix_madvise							      \
>  	get_child_max sched_cpucount sched_cpualloc sched_cpufree \
> -	streams-compat
> +	streams-compat                                            \
> +	execveat
>  
>  aux		:= init-posix environ
>  tests		:= test-errno tstgetopt testfnm runtests runptests \
> @@ -102,7 +103,7 @@ tests		:= test-errno tstgetopt testfnm runtests runptests \
>  		   tst-sysconf-empty-chroot tst-glob_symlinks tst-fexecve \
>  		   tst-glob-tilde test-ssize-max tst-spawn4 bug-regex37 \
>  		   bug-regex38 tst-regcomp-truncated tst-spawn-chdir \
> -		   tst-wordexp-nocmd
> +		   tst-wordexp-nocmd tst-execveat
>  tests-internal	:= bug-regex5 bug-regex20 bug-regex33 \
>  		   tst-rfc3484 tst-rfc3484-2 tst-rfc3484-3 \
>  		   tst-glob_lstat_compat tst-spawn4-compat
> diff --git a/posix/Versions b/posix/Versions
> index 7d06a6d0c0..9d07ce6c96 100644
> --- a/posix/Versions
> +++ b/posix/Versions
> @@ -147,6 +147,9 @@ libc {
>    }
>    GLIBC_2.30 {
>    }
> +  GLIBC_2.33 {
> +    execveat;
> +  }
>    GLIBC_PRIVATE {
>      __libc_fork; __libc_pread; __libc_pwrite;
>      __nanosleep_nocancel; __pause_nocancel;
> diff --git a/posix/execveat.c b/posix/execveat.c
> new file mode 100644
> index 0000000000..cab61952b3
> --- /dev/null
> +++ b/posix/execveat.c
> @@ -0,0 +1,40 @@
> +/* Copyright (C) 1991-2020 Free Software Foundation, Inc.

Missing one line comment and the Copyright should be only 2020.

> +   This file is part of the GNU C Library.
> +
> +   The GNU C Library is free software; you can redistribute it and/or
> +   modify it under the terms of the GNU Lesser General Public
> +   License as published by the Free Software Foundation; either
> +   version 2.1 of the License, or (at your option) any later version.
> +
> +   The GNU C Library is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +   Lesser General Public License for more details.
> +
> +   You should have received a copy of the GNU Lesser General Public
> +   License along with the GNU C Library; if not, see
> +   <https://www.gnu.org/licenses/>.  */
> +
> +#include <errno.h>
> +#include <stddef.h>
> +#include <unistd.h>
> +
> +/* Replace the current process, executing PATH relative to DIFRD with
> + * arguments ARGV and environment ENVP.
> + * ARGV and ENVP are terminated by NULL pointers.  */
> +int
> +__execveat (int dirfd, const char *path, char *const argv[], char *const envp[],
> +            int flags)
> +{
> +  if (difrd < 0 || path == NULL || argv == NULL || envp == NULL)
> +    {
> +      __set_errno (EINVAL);
> +      return -1;
> +    }
> +
> +  __set_errno (ENOSYS);
> +  return -1;
> +}
> +stub_warning (execveat)
> +
> +weak_alias (__execveat, execveat)

Ok.

> diff --git a/posix/tst-execveat.c b/posix/tst-execveat.c
> new file mode 100644
> index 0000000000..c1dcd26183
> --- /dev/null
> +++ b/posix/tst-execveat.c
> @@ -0,0 +1,174 @@

Missing one line comment.

> +/* Copyright (C) 2020 Free Software Foundation, Inc.
> +   This file is part of the GNU C Library.
> +
> +   The GNU C Library is free software; you can redistribute it and/or
> +   modify it under the terms of the GNU Lesser General Public
> +   License as published by the Free Software Foundation; either
> +   version 2.1 of the License, or (at your option) any later version.
> +
> +   The GNU C Library is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +   Lesser General Public License for more details.
> +
> +   You should have received a copy of the GNU Lesser General Public
> +   License along with the GNU C Library; if not, see
> +   <https://www.gnu.org/licenses/>.  */
> +
> +#include <fcntl.h>
> +#include <errno.h>
> +#include <stdlib.h>
> +#include <sys/types.h>
> +#include <dirent.h>
> +#include <support/check.h>
> +#include <support/support.h>
> +#include <support/temp_file.h>
> +#include <support/xdlfcn.h>
> +#include <support/xstdio.h>
> +#include <support/xunistd.h>
> +#include <wait.h>
> +#include <support/test-driver.h>
> +
> +int
> +call_execveat (int fd, const char *pathname, int flags, int expected_fail,
> +               int num)
> +{
> +  char *argv[] = { (char *) "sh", (char *) "-c", (char *) "exit 3", NULL };
> +  char *envp[] = { (char *) "FOO=BAR", NULL };

The shell environment is set, but this is no test that actually checks it
(if the resulting environment variable is set or if it containst the
expected value).

> +  pid_t pid;
> +  int status;
> +
> +  test_verbose = 1;

I think you should remove this line, --verbose will already set it. 

> +  if (test_verbose > 0)
> +    printf ("call line number: %d\n", num);
> +
> +  pid = xfork ();
> +  if (pid == 0)
> +    {
> +

Spurious new line.

> +      TEST_COMPARE (execveat (fd, pathname, argv, envp, flags), -1);
> +      if (errno == ENOSYS)
> +        FAIL_UNSUPPORTED ("execveat is unimplemented");
> +      else if (errno == expected_fail)
> +        {
> +          if (test_verbose > 0)
> +            printf ("expected fail: errno %d\n", errno);
> +          _exit (0);
> +        }
> +      else
> +        FAIL_EXIT1 ("execveat failed, errno %d", errno);

Maybe 

  FAIL_EXIT1 ("execveat failed: %m (%d)", errno);

> +    }
> +  xwaitpid (pid, &status, 0);
> +
> +  if (WIFEXITED (status))
> +    {
> +      if (WEXITSTATUS (status) == EXIT_UNSUPPORTED)
> +        FAIL_UNSUPPORTED ("execveat is unimplemented");
> +      else if (expected_fail)

No implicit checks. 

> +        TEST_COMPARE (WEXITSTATUS (status), 0);
> +      else
> +        TEST_COMPARE (WEXITSTATUS (status), 3);
> +    }
> +  return 0;
> +}
> +
> +static int
> +do_test (void)
> +{
> +  DIR *dirp;
> +  int fd, fd_out;
> +  char *tmp_dir, *symlink_name, *tmp_sh;
> +  struct stat st;
> +
> +  dirp = opendir ("/bin");
> +  if (dirp == NULL)
> +    FAIL_EXIT1 ("failed to open /bin");
> +  fd = dirfd (dirp);
> +
> +  /* Call execveat for various fd/pathname combinations  */
> +
> +  /* fd: valid dir, pathname: relative, flags:: 0  */
> +  call_execveat (fd, "sh", 0, 0, __LINE__);
> +  /* fd: AT_FDCWD, pathname: relative, flags: 0
> +     If pathname is relative and dirfd is the special value AT_FDCWD, then
> +     pathname is interpreted relative to the current working directory of
> +     the calling process  */
> +  chdir ("/bin");
> +  call_execveat (AT_FDCWD, "sh", 0, 0, __LINE__);
> +  xclose (fd);
> +#ifdef O_PATH
> +  /* fd: valid dir with O_PATH, pathname: relative, flags: 0  */
> +  fd = xopen ("/bin", O_PATH | O_DIRECTORY, O_RDONLY);
> +  call_execveat (fd, "sh", 0, 0, __LINE__);
> +  xclose (fd);
> +

Not sure if we should rely on specific filesystem layout, but it should
be fine.

Another possibilty would move this test to a test-container, the minimal
shell implementation should be suffice for the checks.

> +  fd = xopen ("/usr", O_PATH | O_DIRECTORY, 0);

This is not used on the test below, move to the test where it
actually uses it.

> +  /* fd: AT_FDCWD, pathname: absolute in different dir, flags: 0  */

Missing period and some other comments also misses double space before
comment closing.

Also this comment and the other below that does not really add much, 
different the one closed fd below.  I think it is too succinct, I 
would recomment to describes more thoroughly what the tests intends 
to do, the arguments, and the expected return. Something like:

  /* Check absolute pathname, dirfd should be ignored.  */

> +  call_execveat (AT_FDCWD, "/bin/sh", 0, 0, __LINE__);
> +  /* fd: valid dir with O_PATH, pathname: absolute, flags: 0  */
> +  call_execveat (fd, "/bin/sh", 0, 0, __LINE__);
> +  xclose (fd);
> +#endif
> +
> +  fd = xopen ("/usr", O_RDONLY, 0);
> +  /* fd: valid dir, pathname: absolute in differen dir, flags: 0  */

  /* Same check for absolute pathname, but with input file descriptor
     openend with different flags.  The dirfd should be ignored.  */
  
> +  call_execveat (fd, "/bin/sh", 0, 0, __LINE__);
> +  xclose (fd);
> +
> +  fd = xopen ("/bin/sh", O_RDONLY, 0);
> +  /* fd: regular file, pathname: relative, flags: 0  */

  /* Check relative pathname, where dirfd does not point to a directory.  */

> +  call_execveat (fd, "sh", 0, ENOTDIR, __LINE__);
> +  /* fd: regular file, pathname: absolute, flags: 0  */
> +  call_execveat (fd, "/bin/sh", 0, 0, __LINE__);

  /* Check absolute pathname, but dirfd is a regular file.  The dirfd 
     should be ignored. */

> +  xclose (fd);
> +
> +#ifdef O_PATH
> +  fd = xopen ("/bin/sh", O_PATH, 0);
> +  /* fd: O_PATH of regular file, pathname: empty, flags: 0  */
> +  call_execveat (fd, "", 0, ENOENT, __LINE__);
> +  /* fd: O_PATH of regular file, pathname: empty, flags: AT_EMPTY_PATH  */
> +  call_execveat (fd, "", AT_EMPTY_PATH, 0, __LINE__);
> +  /* fd: O_PATH of regular file, pathname: empty,
> +     flags: AT_EMPTY_PATH  AT_SYMLINK_NOFOLLOW  */
> +  call_execveat (fd, "", AT_EMPTY_PATH | AT_SYMLINK_NOFOLLOW, 0, __LINE__);
> +  xclose (fd);
> +
> +  tmp_dir = support_create_temp_directory ("tst-execveat_dir");
> +  symlink_name = xasprintf ("%s/symlink", tmp_dir);
> +  xsymlink ("tmp_sh", symlink_name);
> +  add_temp_file (symlink_name);
> +  tmp_sh = xasprintf ("%s/tmp_sh", tmp_dir);
> +  add_temp_file (tmp_sh);
> +  fd_out = xopen (symlink_name, O_CREAT | O_WRONLY, 0);
> +  stat ("/bin/sh", &st);
> +  fd = xopen ("/bin/sh", O_RDONLY, 0);
> +  xcopy_file_range (fd, 0, fd_out, 0, st.st_size, 0);
> +  fchmod (fd_out, 0777);
> +  xclose (fd);
> +  xclose (fd_out);
> +  fd_out = xopen (symlink_name, O_PATH, 0);
> +
> +  /* fd: O_PATH of symbolic link, pathname: empty, flags: 0 */
> +  call_execveat (fd_out, "", 0, ENOENT, __LINE__);
> +  /* fd: O_PATH of symbolic link, pathname: empty, flags: AT_EMPTY_PATH */
> +  call_execveat (fd_out, "", AT_EMPTY_PATH, 0, __LINE__);
> +  /* fd: O_PATH of symbolic link, pathname: empty,
> +     flags: AT_EMPTY_PATH  AT_SYMLINK_NOFOLLOW */
> +  call_execveat (fd_out, "", AT_EMPTY_PATH | AT_SYMLINK_NOFOLLOW, 0,
> +                 __LINE__);
> +  xclose (fd_out);
> +  free (symlink_name);
> +  free (tmp_sh);
> +  free (tmp_dir);
> +#endif
> +
> +  /* Call execveat with closed fd, we expect this to fail with EBADF  */
> +  call_execveat (fd, "sh", 0, EBADF, __LINE__);
> +  /* Call execveat with closed fd, we expect this to pass because the pathname is
> +     absolute  */
> +  call_execveat (fd, "/bin/sh", 0, 0, __LINE__);
> +
> +  return 0;
> +}
> +
> +#include <support/test-driver.c>

Ok, I think this covers all the cases man-pages describes.

> diff --git a/posix/unistd.h b/posix/unistd.h
> index 32b8161619..b1117f2eda 100644
> --- a/posix/unistd.h
> +++ b/posix/unistd.h
> @@ -295,6 +295,11 @@ extern int euidaccess (const char *__name, int __type)
>  /* An alias for `euidaccess', used by some other systems.  */
>  extern int eaccess (const char *__name, int __type)
>       __THROW __nonnull ((1));
> +
> +/* Execute program relative to a directory file descriptor.  */
> +extern int execveat (int __fd, const char *__path, char *const __argv[],
> +                     char *const __envp[], int __flags)
> +    __THROW __nonnull ((2, 3));
>  #endif
>  
>  #ifdef __USE_ATFILE

Ok.

> diff --git a/sysdeps/mach/hurd/i386/libc.abilist b/sysdeps/mach/hurd/i386/libc.abilist
> index 7a5eb66b85..5afcd48075 100644
> --- a/sysdeps/mach/hurd/i386/libc.abilist
> +++ b/sysdeps/mach/hurd/i386/libc.abilist
> @@ -2181,6 +2181,7 @@ GLIBC_2.3.4 xdr_quad_t F
>  GLIBC_2.3.4 xdr_u_quad_t F
>  GLIBC_2.30 twalk_r F
>  GLIBC_2.32 __libc_single_threaded D 0x1
> +GLIBC_2.32 execveat F
>  GLIBC_2.32 mach_print F
>  GLIBC_2.32 mremap F
>  GLIBC_2.32 sigabbrev_np F
> diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
> index 09604e128b..bb916b7742 100644
> --- a/sysdeps/unix/sysv/linux/Makefile
> +++ b/sysdeps/unix/sysv/linux/Makefile
> @@ -235,7 +235,7 @@ endif
>  ifeq ($(subdir),posix)
>  sysdep_headers += bits/initspin.h
>  
> -sysdep_routines += sched_getcpu oldglob getcpu
> +sysdep_routines += sched_getcpu oldglob getcpu execveat
>  
>  tests += tst-affinity tst-affinity-pid
>  

This was already added on posix/Makefile.

> diff --git a/sysdeps/unix/sysv/linux/aarch64/libc.abilist b/sysdeps/unix/sysv/linux/aarch64/libc.abilist
> index 4cc1c6a591..d281749621 100644
> --- a/sysdeps/unix/sysv/linux/aarch64/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/aarch64/libc.abilist
> @@ -2155,6 +2155,7 @@ GLIBC_2.32 pthread_attr_setaffinity_np F
>  GLIBC_2.32 pthread_attr_setsigmask_np F
>  GLIBC_2.32 pthread_getaffinity_np F
>  GLIBC_2.32 pthread_getattr_np F
> +GLIBC_2.33 execveat F
>  GLIBC_2.32 pthread_sigmask F
>  GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
> diff --git a/sysdeps/unix/sysv/linux/alpha/libc.abilist b/sysdeps/unix/sysv/linux/alpha/libc.abilist
> index 26ad9845e4..9bbcda105e 100644
> --- a/sysdeps/unix/sysv/linux/alpha/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/alpha/libc.abilist
> @@ -2237,6 +2237,7 @@ GLIBC_2.32 pthread_attr_setaffinity_np F
>  GLIBC_2.32 pthread_attr_setsigmask_np F
>  GLIBC_2.32 pthread_getaffinity_np F
>  GLIBC_2.32 pthread_getattr_np F
> +GLIBC_2.33 execveat F
>  GLIBC_2.32 pthread_sigmask F
>  GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
> diff --git a/sysdeps/unix/sysv/linux/arm/be/libc.abilist b/sysdeps/unix/sysv/linux/arm/be/libc.abilist
> index 3b0a47e967..25ce4024a8 100644
> --- a/sysdeps/unix/sysv/linux/arm/be/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/arm/be/libc.abilist
> @@ -139,6 +139,7 @@ GLIBC_2.32 pthread_attr_setaffinity_np F
>  GLIBC_2.32 pthread_attr_setsigmask_np F
>  GLIBC_2.32 pthread_getaffinity_np F
>  GLIBC_2.32 pthread_getattr_np F
> +GLIBC_2.33 execveat F
>  GLIBC_2.32 pthread_sigmask F
>  GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
> diff --git a/sysdeps/unix/sysv/linux/arm/le/libc.abilist b/sysdeps/unix/sysv/linux/arm/le/libc.abilist
> index 9ab3924888..31675a4068 100644
> --- a/sysdeps/unix/sysv/linux/arm/le/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/arm/le/libc.abilist
> @@ -136,6 +136,7 @@ GLIBC_2.32 pthread_attr_setaffinity_np F
>  GLIBC_2.32 pthread_attr_setsigmask_np F
>  GLIBC_2.32 pthread_getaffinity_np F
>  GLIBC_2.32 pthread_getattr_np F
> +GLIBC_2.33 execveat F
>  GLIBC_2.32 pthread_sigmask F
>  GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
> diff --git a/sysdeps/unix/sysv/linux/csky/libc.abilist b/sysdeps/unix/sysv/linux/csky/libc.abilist
> index 14a84dac8f..b4b760fbc5 100644
> --- a/sysdeps/unix/sysv/linux/csky/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/csky/libc.abilist
> @@ -2099,6 +2099,7 @@ GLIBC_2.32 pthread_attr_setaffinity_np F
>  GLIBC_2.32 pthread_attr_setsigmask_np F
>  GLIBC_2.32 pthread_getaffinity_np F
>  GLIBC_2.32 pthread_getattr_np F
> +GLIBC_2.33 execveat F
>  GLIBC_2.32 pthread_sigmask F
>  GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
> diff --git a/sysdeps/unix/sysv/linux/execveat.c b/sysdeps/unix/sysv/linux/execveat.c
> new file mode 100644
> index 0000000000..8f93e9eb97
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/execveat.c
> @@ -0,0 +1,79 @@

Missing one line comment.

> +/* Copyright (C) 2020 Free Software Foundation, Inc.
> +   This file is part of the GNU C Library.
> +
> +   The GNU C Library is free software; you can redistribute it and/or
> +   modify it under the terms of the GNU Lesser General Public
> +   License as published by the Free Software Foundation; either
> +   version 2.1 of the License, or (at your option) any later version.
> +
> +   The GNU C Library is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +   Lesser General Public License for more details.
> +
> +   You should have received a copy of the GNU Lesser General Public
> +   License along with the GNU C Library; if not, see
> +   <https://www.gnu.org/licenses/>.  */
> +
> +#include <errno.h>
> +#include <stddef.h>
> +#include <stdio.h>
> +#include <unistd.h>
> +#include <fcntl.h>
> +#include <sys/stat.h>
> +
> +#include <sysdep.h>
> +#include <sys/syscall.h>
> +#include <kernel-features.h>
> +#include <fd_to_filename.h>
> +#include <not-cancel.h>
> +
> +/* Execute the file FD refers to, overlaying the running program image.
> +   ARGV and ENVP are passed to the new program, as for `execve'.  */
> +int
> +execveat (int dirfd, const char *path, char *const argv[], char *const envp[],
> +          int flags)
> +{
> +  /* Avoid implicit array coercion in syscall macros.  */
> +  INLINE_SYSCALL_CALL (execveat, dirfd, path, &argv[0], &envp[0], flags);
> +#ifndef __ASSUME_EXECVEAT
> +  if (errno != ENOSYS)
> +    return -1;

You need get the INLINE_SYSCALL_CALL and check if it was sucessful as well,
instead of just check for the errno value. Also, this implementation always 
return '-1' (as below):

    int r = INLINE_SYSCALL_CALL (execveat, dirfd, path, &argv[0], &envp[0],
                                 flags);
  #if __ASSUME_EXECVEAT
    return r;
  #else
    if (r == 0 || errno != ENOSYS)
      return r;
    [...]

  
> +
> +  if ((flags & ~(AT_EMPTY_PATH | AT_SYMLINK_NOFOLLOW)) != 0)
> +    return EINVAL;
> +
> +  int fd;
> +  if (path[0] == '\0' && (flags & AT_EMPTY_PATH) && dirfd >= 0)
> +    fd = dirfd;
> +  else
> +    {
> +      int oflags = O_CLOEXEC;
> +      if (flags & AT_SYMLINK_NOFOLLOW)
> +        oflags |= O_NOFOLLOW;
> +      fd = __openat_nocancel (dirfd, path, oflags);
> +    }
> +  if (fd < 0)
> +    return -1;
> +
> +  struct fd_to_filename fdfilename;
> +  const char *gfilename = __fd_to_filename (fd, &fdfilename);
> +
> +  /* We do not need the return value.  */
> +  __execve (gfilename, argv, envp);
> +
> +  int save = errno;
> +
> +  /* We come here only if the 'execve' call fails.  Determine whether
> +     /proc is mounted.  If not we return ENOSYS.  */
> +  struct stat64 st;
> +  if (stat64 ("/proc/self/fd", &st) != 0 && errno == ENOENT)
> +    save = ENOSYS;
> +
> +  if (fd != dirfd)
> +    __close_nocancel_nostatus (fd);
> +  __set_errno (save);
> +#endif
> +
> +  return -1;
> +}

This will make the function always return -1.  Hasn't it shown in
testing?

> diff --git a/sysdeps/unix/sysv/linux/hppa/libc.abilist b/sysdeps/unix/sysv/linux/hppa/libc.abilist
> index 5c8502f3d3..71ddaa2930 100644
> --- a/sysdeps/unix/sysv/linux/hppa/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/hppa/libc.abilist
> @@ -2058,6 +2058,7 @@ GLIBC_2.32 pthread_attr_setaffinity_np F
>  GLIBC_2.32 pthread_attr_setsigmask_np F
>  GLIBC_2.32 pthread_getaffinity_np F
>  GLIBC_2.32 pthread_getattr_np F
> +GLIBC_2.33 execveat F
>  GLIBC_2.32 pthread_sigmask F
>  GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
> diff --git a/sysdeps/unix/sysv/linux/i386/libc.abilist b/sysdeps/unix/sysv/linux/i386/libc.abilist
> index 4f0d3c1eb5..350687bf6f 100644
> --- a/sysdeps/unix/sysv/linux/i386/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/i386/libc.abilist
> @@ -2224,6 +2224,7 @@ GLIBC_2.32 pthread_attr_setaffinity_np F
>  GLIBC_2.32 pthread_attr_setsigmask_np F
>  GLIBC_2.32 pthread_getaffinity_np F
>  GLIBC_2.32 pthread_getattr_np F
> +GLIBC_2.33 execveat F
>  GLIBC_2.32 pthread_sigmask F
>  GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
> diff --git a/sysdeps/unix/sysv/linux/ia64/libc.abilist b/sysdeps/unix/sysv/linux/ia64/libc.abilist
> index e3b345b803..8ac4337b70 100644
> --- a/sysdeps/unix/sysv/linux/ia64/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/ia64/libc.abilist
> @@ -2090,6 +2090,7 @@ GLIBC_2.32 pthread_attr_setaffinity_np F
>  GLIBC_2.32 pthread_attr_setsigmask_np F
>  GLIBC_2.32 pthread_getaffinity_np F
>  GLIBC_2.32 pthread_getattr_np F
> +GLIBC_2.33 execveat F
>  GLIBC_2.32 pthread_sigmask F
>  GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
> diff --git a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
> index 25f2d1c08f..425a44bc5f 100644
> --- a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
> @@ -140,6 +140,7 @@ GLIBC_2.32 pthread_attr_setaffinity_np F
>  GLIBC_2.32 pthread_attr_setsigmask_np F
>  GLIBC_2.32 pthread_getaffinity_np F
>  GLIBC_2.32 pthread_getattr_np F
> +GLIBC_2.33 execveat F
>  GLIBC_2.32 pthread_sigmask F
>  GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
> diff --git a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
> index c4891479d3..057c77119b 100644
> --- a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
> @@ -2170,6 +2170,7 @@ GLIBC_2.32 pthread_attr_setaffinity_np F
>  GLIBC_2.32 pthread_attr_setsigmask_np F
>  GLIBC_2.32 pthread_getaffinity_np F
>  GLIBC_2.32 pthread_getattr_np F
> +GLIBC_2.33 execveat F
>  GLIBC_2.32 pthread_sigmask F
>  GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
> diff --git a/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist b/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
> index 143b0163b4..a85ea5a0bd 100644
> --- a/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
> @@ -2150,6 +2150,7 @@ GLIBC_2.32 pthread_attr_setaffinity_np F
>  GLIBC_2.32 pthread_attr_setsigmask_np F
>  GLIBC_2.32 pthread_getaffinity_np F
>  GLIBC_2.32 pthread_getattr_np F
> +GLIBC_2.33 execveat F
>  GLIBC_2.32 pthread_sigmask F
>  GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
> diff --git a/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist b/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
> index 13d374a031..5822ab2896 100644
> --- a/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
> @@ -2147,6 +2147,7 @@ GLIBC_2.32 pthread_attr_setaffinity_np F
>  GLIBC_2.32 pthread_attr_setsigmask_np F
>  GLIBC_2.32 pthread_getaffinity_np F
>  GLIBC_2.32 pthread_getattr_np F
> +GLIBC_2.33 execveat F
>  GLIBC_2.32 pthread_sigmask F
>  GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
> diff --git a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
> index b2295f1937..30ead20668 100644
> --- a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
> @@ -2141,6 +2141,7 @@ GLIBC_2.32 pthread_attr_setaffinity_np F
>  GLIBC_2.32 pthread_attr_setsigmask_np F
>  GLIBC_2.32 pthread_getaffinity_np F
>  GLIBC_2.32 pthread_getattr_np F
> +GLIBC_2.33 execveat F
>  GLIBC_2.32 pthread_sigmask F
>  GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
> diff --git a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
> index 4c786070d0..ac35f615aa 100644
> --- a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
> @@ -2139,6 +2139,7 @@ GLIBC_2.32 pthread_attr_setaffinity_np F
>  GLIBC_2.32 pthread_attr_setsigmask_np F
>  GLIBC_2.32 pthread_getaffinity_np F
>  GLIBC_2.32 pthread_getattr_np F
> +GLIBC_2.33 execveat F
>  GLIBC_2.32 pthread_sigmask F
>  GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
> diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
> index aa9c6a4dca..76ae132755 100644
> --- a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
> @@ -2147,6 +2147,7 @@ GLIBC_2.32 pthread_attr_setaffinity_np F
>  GLIBC_2.32 pthread_attr_setsigmask_np F
>  GLIBC_2.32 pthread_getaffinity_np F
>  GLIBC_2.32 pthread_getattr_np F
> +GLIBC_2.33 execveat F
>  GLIBC_2.32 pthread_sigmask F
>  GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
> diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
> index 5939588ad5..45ddc18ec1 100644
> --- a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
> @@ -2141,6 +2141,7 @@ GLIBC_2.32 pthread_attr_setaffinity_np F
>  GLIBC_2.32 pthread_attr_setsigmask_np F
>  GLIBC_2.32 pthread_getaffinity_np F
>  GLIBC_2.32 pthread_getattr_np F
> +GLIBC_2.33 execveat F
>  GLIBC_2.32 pthread_sigmask F
>  GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
> diff --git a/sysdeps/unix/sysv/linux/nios2/libc.abilist b/sysdeps/unix/sysv/linux/nios2/libc.abilist
> index 92556c4237..3887748b90 100644
> --- a/sysdeps/unix/sysv/linux/nios2/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/nios2/libc.abilist
> @@ -2188,6 +2188,7 @@ GLIBC_2.32 pthread_attr_setaffinity_np F
>  GLIBC_2.32 pthread_attr_setsigmask_np F
>  GLIBC_2.32 pthread_getaffinity_np F
>  GLIBC_2.32 pthread_getattr_np F
> +GLIBC_2.33 execveat F
>  GLIBC_2.32 pthread_sigmask F
>  GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
> diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
> index 26c93dff05..a32a53e330 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
> @@ -2197,6 +2197,7 @@ GLIBC_2.32 pthread_attr_setaffinity_np F
>  GLIBC_2.32 pthread_attr_setsigmask_np F
>  GLIBC_2.32 pthread_getaffinity_np F
>  GLIBC_2.32 pthread_getattr_np F
> +GLIBC_2.33 execveat F
>  GLIBC_2.32 pthread_sigmask F
>  GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
> diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
> index f04b167788..a787e224fc 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
> @@ -2230,6 +2230,7 @@ GLIBC_2.32 pthread_attr_setaffinity_np F
>  GLIBC_2.32 pthread_attr_setsigmask_np F
>  GLIBC_2.32 pthread_getaffinity_np F
>  GLIBC_2.32 pthread_getattr_np F
> +GLIBC_2.33 execveat F
>  GLIBC_2.32 pthread_sigmask F
>  GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
> diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
> index c2ca00709e..fc8a0a5e1c 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
> @@ -2060,6 +2060,7 @@ GLIBC_2.32 pthread_attr_setaffinity_np F
>  GLIBC_2.32 pthread_attr_setsigmask_np F
>  GLIBC_2.32 pthread_getaffinity_np F
>  GLIBC_2.32 pthread_getattr_np F
> +GLIBC_2.33 execveat F
>  GLIBC_2.32 pthread_sigmask F
>  GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
> diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
> index 0ea50dc851..e1aaaedfbd 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
> @@ -2350,6 +2350,7 @@ GLIBC_2.32 pthread_attr_setaffinity_np F
>  GLIBC_2.32 pthread_attr_setsigmask_np F
>  GLIBC_2.32 pthread_getaffinity_np F
>  GLIBC_2.32 pthread_getattr_np F
> +GLIBC_2.33 execveat F
>  GLIBC_2.32 pthread_sigmask F
>  GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
> diff --git a/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist b/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist
> index 1626c5351f..35a6b7829b 100644
> --- a/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist
> @@ -2117,6 +2117,7 @@ GLIBC_2.32 pthread_attr_setaffinity_np F
>  GLIBC_2.32 pthread_attr_setsigmask_np F
>  GLIBC_2.32 pthread_getaffinity_np F
>  GLIBC_2.32 pthread_getattr_np F
> +GLIBC_2.33 execveat F
>  GLIBC_2.32 pthread_sigmask F
>  GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
> index a66426eb4d..efa1bb3d9e 100644
> --- a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
> @@ -2195,6 +2195,7 @@ GLIBC_2.32 pthread_attr_setaffinity_np F
>  GLIBC_2.32 pthread_attr_setsigmask_np F
>  GLIBC_2.32 pthread_getaffinity_np F
>  GLIBC_2.32 pthread_getattr_np F
> +GLIBC_2.33 execveat F
>  GLIBC_2.32 pthread_sigmask F
>  GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
> index ab351873ae..27958ec30c 100644
> --- a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
> @@ -2096,6 +2096,7 @@ GLIBC_2.32 pthread_attr_setaffinity_np F
>  GLIBC_2.32 pthread_attr_setsigmask_np F
>  GLIBC_2.32 pthread_getaffinity_np F
>  GLIBC_2.32 pthread_getattr_np F
> +GLIBC_2.33 execveat F
>  GLIBC_2.32 pthread_sigmask F
>  GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
> diff --git a/sysdeps/unix/sysv/linux/sh/be/libc.abilist b/sysdeps/unix/sysv/linux/sh/be/libc.abilist
> index 22ceaa3d87..40a904ac55 100644
> --- a/sysdeps/unix/sysv/linux/sh/be/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/sh/be/libc.abilist
> @@ -2065,6 +2065,7 @@ GLIBC_2.32 pthread_attr_setaffinity_np F
>  GLIBC_2.32 pthread_attr_setsigmask_np F
>  GLIBC_2.32 pthread_getaffinity_np F
>  GLIBC_2.32 pthread_getattr_np F
> +GLIBC_2.33 execveat F
>  GLIBC_2.32 pthread_sigmask F
>  GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
> diff --git a/sysdeps/unix/sysv/linux/sh/le/libc.abilist b/sysdeps/unix/sysv/linux/sh/le/libc.abilist
> index d36f228192..621c547e32 100644
> --- a/sysdeps/unix/sysv/linux/sh/le/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/sh/le/libc.abilist
> @@ -2062,6 +2062,7 @@ GLIBC_2.32 pthread_attr_setaffinity_np F
>  GLIBC_2.32 pthread_attr_setsigmask_np F
>  GLIBC_2.32 pthread_getaffinity_np F
>  GLIBC_2.32 pthread_getattr_np F
> +GLIBC_2.33 execveat F
>  GLIBC_2.32 pthread_sigmask F
>  GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
> diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
> index 59b4313280..f01f085b5b 100644
> --- a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
> @@ -2186,6 +2186,7 @@ GLIBC_2.32 pthread_attr_setaffinity_np F
>  GLIBC_2.32 pthread_attr_setsigmask_np F
>  GLIBC_2.32 pthread_getaffinity_np F
>  GLIBC_2.32 pthread_getattr_np F
> +GLIBC_2.33 execveat F
>  GLIBC_2.32 pthread_sigmask F
>  GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
> diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
> index 266dcdfa08..c9225ae42e 100644
> --- a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
> @@ -2113,6 +2113,7 @@ GLIBC_2.32 pthread_attr_setaffinity_np F
>  GLIBC_2.32 pthread_attr_setsigmask_np F
>  GLIBC_2.32 pthread_getaffinity_np F
>  GLIBC_2.32 pthread_getattr_np F
> +GLIBC_2.33 execveat F
>  GLIBC_2.32 pthread_sigmask F
>  GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
> diff --git a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
> index 4fff61818b..5e1cb8b63c 100644
> --- a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
> @@ -2071,6 +2071,7 @@ GLIBC_2.32 pthread_attr_setaffinity_np F
>  GLIBC_2.32 pthread_attr_setsigmask_np F
>  GLIBC_2.32 pthread_getaffinity_np F
>  GLIBC_2.32 pthread_getattr_np F
> +GLIBC_2.33 execveat F
>  GLIBC_2.32 pthread_sigmask F
>  GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
> diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
> index 102ed47a9c..de1d452320 100644
> --- a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
> @@ -2168,6 +2168,7 @@ GLIBC_2.32 pthread_attr_setaffinity_np F
>  GLIBC_2.32 pthread_attr_setsigmask_np F
>  GLIBC_2.32 pthread_getaffinity_np F
>  GLIBC_2.32 pthread_getattr_np F
> +GLIBC_2.33 execveat F
>  GLIBC_2.32 pthread_sigmask F
>  GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
>
  
Florian Weimer Nov. 27, 2020, 5:32 p.m. UTC | #2
* Adhemerval Zanella via Libc-alpha:

>> +{
>> +  /* Avoid implicit array coercion in syscall macros.  */
>> +  INLINE_SYSCALL_CALL (execveat, dirfd, path, &argv[0], &envp[0], flags);
>> +#ifndef __ASSUME_EXECVEAT
>> +  if (errno != ENOSYS)
>> +    return -1;
>
> You need get the INLINE_SYSCALL_CALL and check if it was sucessful as well,
> instead of just check for the errno value. Also, this implementation always 
> return '-1' (as below):
>
>     int r = INLINE_SYSCALL_CALL (execveat, dirfd, path, &argv[0], &envp[0],
>                                  flags);
>   #if __ASSUME_EXECVEAT
>     return r;
>   #else
>     if (r == 0 || errno != ENOSYS)
>       return r;
>     [...]

>> +  return -1;
>> +}
>
> This will make the function always return -1.  Hasn't it shown in
> testing?

This is the expected behavior for execve and execveat.  It does not
return successfully, which is why it is not necessary to check the value
of the INLINE_SYSCALL_CALL macro, either.

Thanks,
Florian
  
Adhemerval Zanella Netto Nov. 27, 2020, 5:38 p.m. UTC | #3
On 27/11/2020 14:32, Florian Weimer wrote:
> * Adhemerval Zanella via Libc-alpha:
> 
>>> +{
>>> +  /* Avoid implicit array coercion in syscall macros.  */
>>> +  INLINE_SYSCALL_CALL (execveat, dirfd, path, &argv[0], &envp[0], flags);
>>> +#ifndef __ASSUME_EXECVEAT
>>> +  if (errno != ENOSYS)
>>> +    return -1;
>>
>> You need get the INLINE_SYSCALL_CALL and check if it was sucessful as well,
>> instead of just check for the errno value. Also, this implementation always 
>> return '-1' (as below):
>>
>>     int r = INLINE_SYSCALL_CALL (execveat, dirfd, path, &argv[0], &envp[0],
>>                                  flags);
>>   #if __ASSUME_EXECVEAT
>>     return r;
>>   #else
>>     if (r == 0 || errno != ENOSYS)
>>       return r;
>>     [...]
> 
>>> +  return -1;
>>> +}
>>
>> This will make the function always return -1.  Hasn't it shown in
>> testing?
> 
> This is the expected behavior for execve and execveat.  It does not
> return successfully, which is why it is not necessary to check the value
> of the INLINE_SYSCALL_CALL macro, either.

Right, forgot about the non return in case of success. So please ignore
that part of the review.
  

Patch

diff --git a/NEWS b/NEWS
index 685b93c8e9..962480f2e6 100644
--- a/NEWS
+++ b/NEWS
@@ -28,6 +28,8 @@  Major new features:
   The 32-bit RISC-V port requires at least Linux 5.4, GCC 7.1 and binutils
   2.28.
 
+* Add execveat system call wrapper.
+
 Deprecated and removed features, and other changes affecting compatibility:
 
 * The mallinfo function is marked deprecated.  Callers should call
diff --git a/posix/Makefile b/posix/Makefile
index 4bfc8d942c..ca678ad781 100644
--- a/posix/Makefile
+++ b/posix/Makefile
@@ -65,7 +65,8 @@  routines :=								      \
 	spawnattr_setsigmask spawnattr_setschedpolicy spawnattr_setschedparam \
 	posix_madvise							      \
 	get_child_max sched_cpucount sched_cpualloc sched_cpufree \
-	streams-compat
+	streams-compat                                            \
+	execveat
 
 aux		:= init-posix environ
 tests		:= test-errno tstgetopt testfnm runtests runptests \
@@ -102,7 +103,7 @@  tests		:= test-errno tstgetopt testfnm runtests runptests \
 		   tst-sysconf-empty-chroot tst-glob_symlinks tst-fexecve \
 		   tst-glob-tilde test-ssize-max tst-spawn4 bug-regex37 \
 		   bug-regex38 tst-regcomp-truncated tst-spawn-chdir \
-		   tst-wordexp-nocmd
+		   tst-wordexp-nocmd tst-execveat
 tests-internal	:= bug-regex5 bug-regex20 bug-regex33 \
 		   tst-rfc3484 tst-rfc3484-2 tst-rfc3484-3 \
 		   tst-glob_lstat_compat tst-spawn4-compat
diff --git a/posix/Versions b/posix/Versions
index 7d06a6d0c0..9d07ce6c96 100644
--- a/posix/Versions
+++ b/posix/Versions
@@ -147,6 +147,9 @@  libc {
   }
   GLIBC_2.30 {
   }
+  GLIBC_2.33 {
+    execveat;
+  }
   GLIBC_PRIVATE {
     __libc_fork; __libc_pread; __libc_pwrite;
     __nanosleep_nocancel; __pause_nocancel;
diff --git a/posix/execveat.c b/posix/execveat.c
new file mode 100644
index 0000000000..cab61952b3
--- /dev/null
+++ b/posix/execveat.c
@@ -0,0 +1,40 @@ 
+/* Copyright (C) 1991-2020 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <errno.h>
+#include <stddef.h>
+#include <unistd.h>
+
+/* Replace the current process, executing PATH relative to DIFRD with
+ * arguments ARGV and environment ENVP.
+ * ARGV and ENVP are terminated by NULL pointers.  */
+int
+__execveat (int dirfd, const char *path, char *const argv[], char *const envp[],
+            int flags)
+{
+  if (difrd < 0 || path == NULL || argv == NULL || envp == NULL)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  __set_errno (ENOSYS);
+  return -1;
+}
+stub_warning (execveat)
+
+weak_alias (__execveat, execveat)
diff --git a/posix/tst-execveat.c b/posix/tst-execveat.c
new file mode 100644
index 0000000000..c1dcd26183
--- /dev/null
+++ b/posix/tst-execveat.c
@@ -0,0 +1,174 @@ 
+/* Copyright (C) 2020 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <fcntl.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <dirent.h>
+#include <support/check.h>
+#include <support/support.h>
+#include <support/temp_file.h>
+#include <support/xdlfcn.h>
+#include <support/xstdio.h>
+#include <support/xunistd.h>
+#include <wait.h>
+#include <support/test-driver.h>
+
+int
+call_execveat (int fd, const char *pathname, int flags, int expected_fail,
+               int num)
+{
+  char *argv[] = { (char *) "sh", (char *) "-c", (char *) "exit 3", NULL };
+  char *envp[] = { (char *) "FOO=BAR", NULL };
+  pid_t pid;
+  int status;
+
+  test_verbose = 1;
+  if (test_verbose > 0)
+    printf ("call line number: %d\n", num);
+
+  pid = xfork ();
+  if (pid == 0)
+    {
+
+      TEST_COMPARE (execveat (fd, pathname, argv, envp, flags), -1);
+      if (errno == ENOSYS)
+        FAIL_UNSUPPORTED ("execveat is unimplemented");
+      else if (errno == expected_fail)
+        {
+          if (test_verbose > 0)
+            printf ("expected fail: errno %d\n", errno);
+          _exit (0);
+        }
+      else
+        FAIL_EXIT1 ("execveat failed, errno %d", errno);
+    }
+  xwaitpid (pid, &status, 0);
+
+  if (WIFEXITED (status))
+    {
+      if (WEXITSTATUS (status) == EXIT_UNSUPPORTED)
+        FAIL_UNSUPPORTED ("execveat is unimplemented");
+      else if (expected_fail)
+        TEST_COMPARE (WEXITSTATUS (status), 0);
+      else
+        TEST_COMPARE (WEXITSTATUS (status), 3);
+    }
+  return 0;
+}
+
+static int
+do_test (void)
+{
+  DIR *dirp;
+  int fd, fd_out;
+  char *tmp_dir, *symlink_name, *tmp_sh;
+  struct stat st;
+
+  dirp = opendir ("/bin");
+  if (dirp == NULL)
+    FAIL_EXIT1 ("failed to open /bin");
+  fd = dirfd (dirp);
+
+  /* Call execveat for various fd/pathname combinations  */
+
+  /* fd: valid dir, pathname: relative, flags:: 0  */
+  call_execveat (fd, "sh", 0, 0, __LINE__);
+  /* fd: AT_FDCWD, pathname: relative, flags: 0
+     If pathname is relative and dirfd is the special value AT_FDCWD, then
+     pathname is interpreted relative to the current working directory of
+     the calling process  */
+  chdir ("/bin");
+  call_execveat (AT_FDCWD, "sh", 0, 0, __LINE__);
+  xclose (fd);
+#ifdef O_PATH
+  /* fd: valid dir with O_PATH, pathname: relative, flags: 0  */
+  fd = xopen ("/bin", O_PATH | O_DIRECTORY, O_RDONLY);
+  call_execveat (fd, "sh", 0, 0, __LINE__);
+  xclose (fd);
+
+  fd = xopen ("/usr", O_PATH | O_DIRECTORY, 0);
+  /* fd: AT_FDCWD, pathname: absolute in different dir, flags: 0  */
+  call_execveat (AT_FDCWD, "/bin/sh", 0, 0, __LINE__);
+  /* fd: valid dir with O_PATH, pathname: absolute, flags: 0  */
+  call_execveat (fd, "/bin/sh", 0, 0, __LINE__);
+  xclose (fd);
+#endif
+
+  fd = xopen ("/usr", O_RDONLY, 0);
+  /* fd: valid dir, pathname: absolute in differen dir, flags: 0  */
+  call_execveat (fd, "/bin/sh", 0, 0, __LINE__);
+  xclose (fd);
+
+  fd = xopen ("/bin/sh", O_RDONLY, 0);
+  /* fd: regular file, pathname: relative, flags: 0  */
+  call_execveat (fd, "sh", 0, ENOTDIR, __LINE__);
+  /* fd: regular file, pathname: absolute, flags: 0  */
+  call_execveat (fd, "/bin/sh", 0, 0, __LINE__);
+  xclose (fd);
+
+#ifdef O_PATH
+  fd = xopen ("/bin/sh", O_PATH, 0);
+  /* fd: O_PATH of regular file, pathname: empty, flags: 0  */
+  call_execveat (fd, "", 0, ENOENT, __LINE__);
+  /* fd: O_PATH of regular file, pathname: empty, flags: AT_EMPTY_PATH  */
+  call_execveat (fd, "", AT_EMPTY_PATH, 0, __LINE__);
+  /* fd: O_PATH of regular file, pathname: empty,
+     flags: AT_EMPTY_PATH  AT_SYMLINK_NOFOLLOW  */
+  call_execveat (fd, "", AT_EMPTY_PATH | AT_SYMLINK_NOFOLLOW, 0, __LINE__);
+  xclose (fd);
+
+  tmp_dir = support_create_temp_directory ("tst-execveat_dir");
+  symlink_name = xasprintf ("%s/symlink", tmp_dir);
+  xsymlink ("tmp_sh", symlink_name);
+  add_temp_file (symlink_name);
+  tmp_sh = xasprintf ("%s/tmp_sh", tmp_dir);
+  add_temp_file (tmp_sh);
+  fd_out = xopen (symlink_name, O_CREAT | O_WRONLY, 0);
+  stat ("/bin/sh", &st);
+  fd = xopen ("/bin/sh", O_RDONLY, 0);
+  xcopy_file_range (fd, 0, fd_out, 0, st.st_size, 0);
+  fchmod (fd_out, 0777);
+  xclose (fd);
+  xclose (fd_out);
+  fd_out = xopen (symlink_name, O_PATH, 0);
+
+  /* fd: O_PATH of symbolic link, pathname: empty, flags: 0 */
+  call_execveat (fd_out, "", 0, ENOENT, __LINE__);
+  /* fd: O_PATH of symbolic link, pathname: empty, flags: AT_EMPTY_PATH */
+  call_execveat (fd_out, "", AT_EMPTY_PATH, 0, __LINE__);
+  /* fd: O_PATH of symbolic link, pathname: empty,
+     flags: AT_EMPTY_PATH  AT_SYMLINK_NOFOLLOW */
+  call_execveat (fd_out, "", AT_EMPTY_PATH | AT_SYMLINK_NOFOLLOW, 0,
+                 __LINE__);
+  xclose (fd_out);
+  free (symlink_name);
+  free (tmp_sh);
+  free (tmp_dir);
+#endif
+
+  /* Call execveat with closed fd, we expect this to fail with EBADF  */
+  call_execveat (fd, "sh", 0, EBADF, __LINE__);
+  /* Call execveat with closed fd, we expect this to pass because the pathname is
+     absolute  */
+  call_execveat (fd, "/bin/sh", 0, 0, __LINE__);
+
+  return 0;
+}
+
+#include <support/test-driver.c>
diff --git a/posix/unistd.h b/posix/unistd.h
index 32b8161619..b1117f2eda 100644
--- a/posix/unistd.h
+++ b/posix/unistd.h
@@ -295,6 +295,11 @@  extern int euidaccess (const char *__name, int __type)
 /* An alias for `euidaccess', used by some other systems.  */
 extern int eaccess (const char *__name, int __type)
      __THROW __nonnull ((1));
+
+/* Execute program relative to a directory file descriptor.  */
+extern int execveat (int __fd, const char *__path, char *const __argv[],
+                     char *const __envp[], int __flags)
+    __THROW __nonnull ((2, 3));
 #endif
 
 #ifdef __USE_ATFILE
diff --git a/sysdeps/mach/hurd/i386/libc.abilist b/sysdeps/mach/hurd/i386/libc.abilist
index 7a5eb66b85..5afcd48075 100644
--- a/sysdeps/mach/hurd/i386/libc.abilist
+++ b/sysdeps/mach/hurd/i386/libc.abilist
@@ -2181,6 +2181,7 @@  GLIBC_2.3.4 xdr_quad_t F
 GLIBC_2.3.4 xdr_u_quad_t F
 GLIBC_2.30 twalk_r F
 GLIBC_2.32 __libc_single_threaded D 0x1
+GLIBC_2.32 execveat F
 GLIBC_2.32 mach_print F
 GLIBC_2.32 mremap F
 GLIBC_2.32 sigabbrev_np F
diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
index 09604e128b..bb916b7742 100644
--- a/sysdeps/unix/sysv/linux/Makefile
+++ b/sysdeps/unix/sysv/linux/Makefile
@@ -235,7 +235,7 @@  endif
 ifeq ($(subdir),posix)
 sysdep_headers += bits/initspin.h
 
-sysdep_routines += sched_getcpu oldglob getcpu
+sysdep_routines += sched_getcpu oldglob getcpu execveat
 
 tests += tst-affinity tst-affinity-pid
 
diff --git a/sysdeps/unix/sysv/linux/aarch64/libc.abilist b/sysdeps/unix/sysv/linux/aarch64/libc.abilist
index 4cc1c6a591..d281749621 100644
--- a/sysdeps/unix/sysv/linux/aarch64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/aarch64/libc.abilist
@@ -2155,6 +2155,7 @@  GLIBC_2.32 pthread_attr_setaffinity_np F
 GLIBC_2.32 pthread_attr_setsigmask_np F
 GLIBC_2.32 pthread_getaffinity_np F
 GLIBC_2.32 pthread_getattr_np F
+GLIBC_2.33 execveat F
 GLIBC_2.32 pthread_sigmask F
 GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
diff --git a/sysdeps/unix/sysv/linux/alpha/libc.abilist b/sysdeps/unix/sysv/linux/alpha/libc.abilist
index 26ad9845e4..9bbcda105e 100644
--- a/sysdeps/unix/sysv/linux/alpha/libc.abilist
+++ b/sysdeps/unix/sysv/linux/alpha/libc.abilist
@@ -2237,6 +2237,7 @@  GLIBC_2.32 pthread_attr_setaffinity_np F
 GLIBC_2.32 pthread_attr_setsigmask_np F
 GLIBC_2.32 pthread_getaffinity_np F
 GLIBC_2.32 pthread_getattr_np F
+GLIBC_2.33 execveat F
 GLIBC_2.32 pthread_sigmask F
 GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
diff --git a/sysdeps/unix/sysv/linux/arm/be/libc.abilist b/sysdeps/unix/sysv/linux/arm/be/libc.abilist
index 3b0a47e967..25ce4024a8 100644
--- a/sysdeps/unix/sysv/linux/arm/be/libc.abilist
+++ b/sysdeps/unix/sysv/linux/arm/be/libc.abilist
@@ -139,6 +139,7 @@  GLIBC_2.32 pthread_attr_setaffinity_np F
 GLIBC_2.32 pthread_attr_setsigmask_np F
 GLIBC_2.32 pthread_getaffinity_np F
 GLIBC_2.32 pthread_getattr_np F
+GLIBC_2.33 execveat F
 GLIBC_2.32 pthread_sigmask F
 GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
diff --git a/sysdeps/unix/sysv/linux/arm/le/libc.abilist b/sysdeps/unix/sysv/linux/arm/le/libc.abilist
index 9ab3924888..31675a4068 100644
--- a/sysdeps/unix/sysv/linux/arm/le/libc.abilist
+++ b/sysdeps/unix/sysv/linux/arm/le/libc.abilist
@@ -136,6 +136,7 @@  GLIBC_2.32 pthread_attr_setaffinity_np F
 GLIBC_2.32 pthread_attr_setsigmask_np F
 GLIBC_2.32 pthread_getaffinity_np F
 GLIBC_2.32 pthread_getattr_np F
+GLIBC_2.33 execveat F
 GLIBC_2.32 pthread_sigmask F
 GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
diff --git a/sysdeps/unix/sysv/linux/csky/libc.abilist b/sysdeps/unix/sysv/linux/csky/libc.abilist
index 14a84dac8f..b4b760fbc5 100644
--- a/sysdeps/unix/sysv/linux/csky/libc.abilist
+++ b/sysdeps/unix/sysv/linux/csky/libc.abilist
@@ -2099,6 +2099,7 @@  GLIBC_2.32 pthread_attr_setaffinity_np F
 GLIBC_2.32 pthread_attr_setsigmask_np F
 GLIBC_2.32 pthread_getaffinity_np F
 GLIBC_2.32 pthread_getattr_np F
+GLIBC_2.33 execveat F
 GLIBC_2.32 pthread_sigmask F
 GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
diff --git a/sysdeps/unix/sysv/linux/execveat.c b/sysdeps/unix/sysv/linux/execveat.c
new file mode 100644
index 0000000000..8f93e9eb97
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/execveat.c
@@ -0,0 +1,79 @@ 
+/* Copyright (C) 2020 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <errno.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+
+#include <sysdep.h>
+#include <sys/syscall.h>
+#include <kernel-features.h>
+#include <fd_to_filename.h>
+#include <not-cancel.h>
+
+/* Execute the file FD refers to, overlaying the running program image.
+   ARGV and ENVP are passed to the new program, as for `execve'.  */
+int
+execveat (int dirfd, const char *path, char *const argv[], char *const envp[],
+          int flags)
+{
+  /* Avoid implicit array coercion in syscall macros.  */
+  INLINE_SYSCALL_CALL (execveat, dirfd, path, &argv[0], &envp[0], flags);
+#ifndef __ASSUME_EXECVEAT
+  if (errno != ENOSYS)
+    return -1;
+
+  if ((flags & ~(AT_EMPTY_PATH | AT_SYMLINK_NOFOLLOW)) != 0)
+    return EINVAL;
+
+  int fd;
+  if (path[0] == '\0' && (flags & AT_EMPTY_PATH) && dirfd >= 0)
+    fd = dirfd;
+  else
+    {
+      int oflags = O_CLOEXEC;
+      if (flags & AT_SYMLINK_NOFOLLOW)
+        oflags |= O_NOFOLLOW;
+      fd = __openat_nocancel (dirfd, path, oflags);
+    }
+  if (fd < 0)
+    return -1;
+
+  struct fd_to_filename fdfilename;
+  const char *gfilename = __fd_to_filename (fd, &fdfilename);
+
+  /* We do not need the return value.  */
+  __execve (gfilename, argv, envp);
+
+  int save = errno;
+
+  /* We come here only if the 'execve' call fails.  Determine whether
+     /proc is mounted.  If not we return ENOSYS.  */
+  struct stat64 st;
+  if (stat64 ("/proc/self/fd", &st) != 0 && errno == ENOENT)
+    save = ENOSYS;
+
+  if (fd != dirfd)
+    __close_nocancel_nostatus (fd);
+  __set_errno (save);
+#endif
+
+  return -1;
+}
diff --git a/sysdeps/unix/sysv/linux/hppa/libc.abilist b/sysdeps/unix/sysv/linux/hppa/libc.abilist
index 5c8502f3d3..71ddaa2930 100644
--- a/sysdeps/unix/sysv/linux/hppa/libc.abilist
+++ b/sysdeps/unix/sysv/linux/hppa/libc.abilist
@@ -2058,6 +2058,7 @@  GLIBC_2.32 pthread_attr_setaffinity_np F
 GLIBC_2.32 pthread_attr_setsigmask_np F
 GLIBC_2.32 pthread_getaffinity_np F
 GLIBC_2.32 pthread_getattr_np F
+GLIBC_2.33 execveat F
 GLIBC_2.32 pthread_sigmask F
 GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
diff --git a/sysdeps/unix/sysv/linux/i386/libc.abilist b/sysdeps/unix/sysv/linux/i386/libc.abilist
index 4f0d3c1eb5..350687bf6f 100644
--- a/sysdeps/unix/sysv/linux/i386/libc.abilist
+++ b/sysdeps/unix/sysv/linux/i386/libc.abilist
@@ -2224,6 +2224,7 @@  GLIBC_2.32 pthread_attr_setaffinity_np F
 GLIBC_2.32 pthread_attr_setsigmask_np F
 GLIBC_2.32 pthread_getaffinity_np F
 GLIBC_2.32 pthread_getattr_np F
+GLIBC_2.33 execveat F
 GLIBC_2.32 pthread_sigmask F
 GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
diff --git a/sysdeps/unix/sysv/linux/ia64/libc.abilist b/sysdeps/unix/sysv/linux/ia64/libc.abilist
index e3b345b803..8ac4337b70 100644
--- a/sysdeps/unix/sysv/linux/ia64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/ia64/libc.abilist
@@ -2090,6 +2090,7 @@  GLIBC_2.32 pthread_attr_setaffinity_np F
 GLIBC_2.32 pthread_attr_setsigmask_np F
 GLIBC_2.32 pthread_getaffinity_np F
 GLIBC_2.32 pthread_getattr_np F
+GLIBC_2.33 execveat F
 GLIBC_2.32 pthread_sigmask F
 GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
diff --git a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
index 25f2d1c08f..425a44bc5f 100644
--- a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
+++ b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
@@ -140,6 +140,7 @@  GLIBC_2.32 pthread_attr_setaffinity_np F
 GLIBC_2.32 pthread_attr_setsigmask_np F
 GLIBC_2.32 pthread_getaffinity_np F
 GLIBC_2.32 pthread_getattr_np F
+GLIBC_2.33 execveat F
 GLIBC_2.32 pthread_sigmask F
 GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
diff --git a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
index c4891479d3..057c77119b 100644
--- a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
+++ b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
@@ -2170,6 +2170,7 @@  GLIBC_2.32 pthread_attr_setaffinity_np F
 GLIBC_2.32 pthread_attr_setsigmask_np F
 GLIBC_2.32 pthread_getaffinity_np F
 GLIBC_2.32 pthread_getattr_np F
+GLIBC_2.33 execveat F
 GLIBC_2.32 pthread_sigmask F
 GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
diff --git a/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist b/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
index 143b0163b4..a85ea5a0bd 100644
--- a/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
+++ b/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
@@ -2150,6 +2150,7 @@  GLIBC_2.32 pthread_attr_setaffinity_np F
 GLIBC_2.32 pthread_attr_setsigmask_np F
 GLIBC_2.32 pthread_getaffinity_np F
 GLIBC_2.32 pthread_getattr_np F
+GLIBC_2.33 execveat F
 GLIBC_2.32 pthread_sigmask F
 GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
diff --git a/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist b/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
index 13d374a031..5822ab2896 100644
--- a/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
+++ b/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
@@ -2147,6 +2147,7 @@  GLIBC_2.32 pthread_attr_setaffinity_np F
 GLIBC_2.32 pthread_attr_setsigmask_np F
 GLIBC_2.32 pthread_getaffinity_np F
 GLIBC_2.32 pthread_getattr_np F
+GLIBC_2.33 execveat F
 GLIBC_2.32 pthread_sigmask F
 GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
diff --git a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
index b2295f1937..30ead20668 100644
--- a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
@@ -2141,6 +2141,7 @@  GLIBC_2.32 pthread_attr_setaffinity_np F
 GLIBC_2.32 pthread_attr_setsigmask_np F
 GLIBC_2.32 pthread_getaffinity_np F
 GLIBC_2.32 pthread_getattr_np F
+GLIBC_2.33 execveat F
 GLIBC_2.32 pthread_sigmask F
 GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
diff --git a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
index 4c786070d0..ac35f615aa 100644
--- a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
@@ -2139,6 +2139,7 @@  GLIBC_2.32 pthread_attr_setaffinity_np F
 GLIBC_2.32 pthread_attr_setsigmask_np F
 GLIBC_2.32 pthread_getaffinity_np F
 GLIBC_2.32 pthread_getattr_np F
+GLIBC_2.33 execveat F
 GLIBC_2.32 pthread_sigmask F
 GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
index aa9c6a4dca..76ae132755 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
@@ -2147,6 +2147,7 @@  GLIBC_2.32 pthread_attr_setaffinity_np F
 GLIBC_2.32 pthread_attr_setsigmask_np F
 GLIBC_2.32 pthread_getaffinity_np F
 GLIBC_2.32 pthread_getattr_np F
+GLIBC_2.33 execveat F
 GLIBC_2.32 pthread_sigmask F
 GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
index 5939588ad5..45ddc18ec1 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
@@ -2141,6 +2141,7 @@  GLIBC_2.32 pthread_attr_setaffinity_np F
 GLIBC_2.32 pthread_attr_setsigmask_np F
 GLIBC_2.32 pthread_getaffinity_np F
 GLIBC_2.32 pthread_getattr_np F
+GLIBC_2.33 execveat F
 GLIBC_2.32 pthread_sigmask F
 GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
diff --git a/sysdeps/unix/sysv/linux/nios2/libc.abilist b/sysdeps/unix/sysv/linux/nios2/libc.abilist
index 92556c4237..3887748b90 100644
--- a/sysdeps/unix/sysv/linux/nios2/libc.abilist
+++ b/sysdeps/unix/sysv/linux/nios2/libc.abilist
@@ -2188,6 +2188,7 @@  GLIBC_2.32 pthread_attr_setaffinity_np F
 GLIBC_2.32 pthread_attr_setsigmask_np F
 GLIBC_2.32 pthread_getaffinity_np F
 GLIBC_2.32 pthread_getattr_np F
+GLIBC_2.33 execveat F
 GLIBC_2.32 pthread_sigmask F
 GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
index 26c93dff05..a32a53e330 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
@@ -2197,6 +2197,7 @@  GLIBC_2.32 pthread_attr_setaffinity_np F
 GLIBC_2.32 pthread_attr_setsigmask_np F
 GLIBC_2.32 pthread_getaffinity_np F
 GLIBC_2.32 pthread_getattr_np F
+GLIBC_2.33 execveat F
 GLIBC_2.32 pthread_sigmask F
 GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
index f04b167788..a787e224fc 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
@@ -2230,6 +2230,7 @@  GLIBC_2.32 pthread_attr_setaffinity_np F
 GLIBC_2.32 pthread_attr_setsigmask_np F
 GLIBC_2.32 pthread_getaffinity_np F
 GLIBC_2.32 pthread_getattr_np F
+GLIBC_2.33 execveat F
 GLIBC_2.32 pthread_sigmask F
 GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
index c2ca00709e..fc8a0a5e1c 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
@@ -2060,6 +2060,7 @@  GLIBC_2.32 pthread_attr_setaffinity_np F
 GLIBC_2.32 pthread_attr_setsigmask_np F
 GLIBC_2.32 pthread_getaffinity_np F
 GLIBC_2.32 pthread_getattr_np F
+GLIBC_2.33 execveat F
 GLIBC_2.32 pthread_sigmask F
 GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
index 0ea50dc851..e1aaaedfbd 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
@@ -2350,6 +2350,7 @@  GLIBC_2.32 pthread_attr_setaffinity_np F
 GLIBC_2.32 pthread_attr_setsigmask_np F
 GLIBC_2.32 pthread_getaffinity_np F
 GLIBC_2.32 pthread_getattr_np F
+GLIBC_2.33 execveat F
 GLIBC_2.32 pthread_sigmask F
 GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
diff --git a/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist b/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist
index 1626c5351f..35a6b7829b 100644
--- a/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist
@@ -2117,6 +2117,7 @@  GLIBC_2.32 pthread_attr_setaffinity_np F
 GLIBC_2.32 pthread_attr_setsigmask_np F
 GLIBC_2.32 pthread_getaffinity_np F
 GLIBC_2.32 pthread_getattr_np F
+GLIBC_2.33 execveat F
 GLIBC_2.32 pthread_sigmask F
 GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
index a66426eb4d..efa1bb3d9e 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
@@ -2195,6 +2195,7 @@  GLIBC_2.32 pthread_attr_setaffinity_np F
 GLIBC_2.32 pthread_attr_setsigmask_np F
 GLIBC_2.32 pthread_getaffinity_np F
 GLIBC_2.32 pthread_getattr_np F
+GLIBC_2.33 execveat F
 GLIBC_2.32 pthread_sigmask F
 GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
index ab351873ae..27958ec30c 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
@@ -2096,6 +2096,7 @@  GLIBC_2.32 pthread_attr_setaffinity_np F
 GLIBC_2.32 pthread_attr_setsigmask_np F
 GLIBC_2.32 pthread_getaffinity_np F
 GLIBC_2.32 pthread_getattr_np F
+GLIBC_2.33 execveat F
 GLIBC_2.32 pthread_sigmask F
 GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
diff --git a/sysdeps/unix/sysv/linux/sh/be/libc.abilist b/sysdeps/unix/sysv/linux/sh/be/libc.abilist
index 22ceaa3d87..40a904ac55 100644
--- a/sysdeps/unix/sysv/linux/sh/be/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sh/be/libc.abilist
@@ -2065,6 +2065,7 @@  GLIBC_2.32 pthread_attr_setaffinity_np F
 GLIBC_2.32 pthread_attr_setsigmask_np F
 GLIBC_2.32 pthread_getaffinity_np F
 GLIBC_2.32 pthread_getattr_np F
+GLIBC_2.33 execveat F
 GLIBC_2.32 pthread_sigmask F
 GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
diff --git a/sysdeps/unix/sysv/linux/sh/le/libc.abilist b/sysdeps/unix/sysv/linux/sh/le/libc.abilist
index d36f228192..621c547e32 100644
--- a/sysdeps/unix/sysv/linux/sh/le/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sh/le/libc.abilist
@@ -2062,6 +2062,7 @@  GLIBC_2.32 pthread_attr_setaffinity_np F
 GLIBC_2.32 pthread_attr_setsigmask_np F
 GLIBC_2.32 pthread_getaffinity_np F
 GLIBC_2.32 pthread_getattr_np F
+GLIBC_2.33 execveat F
 GLIBC_2.32 pthread_sigmask F
 GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
index 59b4313280..f01f085b5b 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
@@ -2186,6 +2186,7 @@  GLIBC_2.32 pthread_attr_setaffinity_np F
 GLIBC_2.32 pthread_attr_setsigmask_np F
 GLIBC_2.32 pthread_getaffinity_np F
 GLIBC_2.32 pthread_getattr_np F
+GLIBC_2.33 execveat F
 GLIBC_2.32 pthread_sigmask F
 GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
index 266dcdfa08..c9225ae42e 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
@@ -2113,6 +2113,7 @@  GLIBC_2.32 pthread_attr_setaffinity_np F
 GLIBC_2.32 pthread_attr_setsigmask_np F
 GLIBC_2.32 pthread_getaffinity_np F
 GLIBC_2.32 pthread_getattr_np F
+GLIBC_2.33 execveat F
 GLIBC_2.32 pthread_sigmask F
 GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
diff --git a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
index 4fff61818b..5e1cb8b63c 100644
--- a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
@@ -2071,6 +2071,7 @@  GLIBC_2.32 pthread_attr_setaffinity_np F
 GLIBC_2.32 pthread_attr_setsigmask_np F
 GLIBC_2.32 pthread_getaffinity_np F
 GLIBC_2.32 pthread_getattr_np F
+GLIBC_2.33 execveat F
 GLIBC_2.32 pthread_sigmask F
 GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
index 102ed47a9c..de1d452320 100644
--- a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
@@ -2168,6 +2168,7 @@  GLIBC_2.32 pthread_attr_setaffinity_np F
 GLIBC_2.32 pthread_attr_setsigmask_np F
 GLIBC_2.32 pthread_getaffinity_np F
 GLIBC_2.32 pthread_getattr_np F
+GLIBC_2.33 execveat F
 GLIBC_2.32 pthread_sigmask F
 GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F