diff mbox series

[v7,3/5] linux: Add open_tree

Message ID 20220624195919.435424-4-adhemerval.zanella@linaro.org
State Committed
Headers show
Series linux: Add new syscalls | expand

Checks

Context Check Description
dj/TryBot-apply_patch success Patch applied to master at the time it was sent

Commit Message

Adhemerval Zanella Netto June 24, 2022, 7:59 p.m. UTC
It was added on Linux 5.2 (a07b20004793d8926f78d63eb5980559f7813404)
to return a O_PATH-opened file descriptor to an existing mountpoint.
---
 NEWS                                                   | 10 +++++-----
 sysdeps/unix/sysv/linux/Versions                       |  1 +
 sysdeps/unix/sysv/linux/aarch64/libc.abilist           |  1 +
 sysdeps/unix/sysv/linux/alpha/libc.abilist             |  1 +
 sysdeps/unix/sysv/linux/arc/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/hppa/libc.abilist              |  1 +
 sysdeps/unix/sysv/linux/i386/libc.abilist              |  1 +
 sysdeps/unix/sysv/linux/ia64/libc.abilist              |  1 +
 sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist     |  1 +
 sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist       |  1 +
 sysdeps/unix/sysv/linux/microblaze/be/libc.abilist     |  1 +
 sysdeps/unix/sysv/linux/microblaze/le/libc.abilist     |  1 +
 sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist   |  1 +
 sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist |  1 +
 sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist   |  1 +
 sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist   |  1 +
 sysdeps/unix/sysv/linux/nios2/libc.abilist             |  1 +
 sysdeps/unix/sysv/linux/or1k/libc.abilist              |  1 +
 .../unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist |  1 +
 .../sysv/linux/powerpc/powerpc32/nofpu/libc.abilist    |  1 +
 .../unix/sysv/linux/powerpc/powerpc64/be/libc.abilist  |  1 +
 .../unix/sysv/linux/powerpc/powerpc64/le/libc.abilist  |  1 +
 sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist        |  1 +
 sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist        |  1 +
 sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist      |  1 +
 sysdeps/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 +
 sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist     |  1 +
 sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist     |  1 +
 sysdeps/unix/sysv/linux/sys/mount.h                    |  9 +++++++++
 sysdeps/unix/sysv/linux/syscalls.list                  |  1 +
 sysdeps/unix/sysv/linux/tst-mount-consts.py            |  3 ++-
 sysdeps/unix/sysv/linux/x86_64/64/libc.abilist         |  1 +
 sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist        |  1 +
 38 files changed, 51 insertions(+), 6 deletions(-)

Comments

Carlos O'Donell July 4, 2022, 9:42 p.m. UTC | #1
On 6/24/22 15:59, Adhemerval Zanella wrote:
> It was added on Linux 5.2 (a07b20004793d8926f78d63eb5980559f7813404)
> to return a O_PATH-opened file descriptor to an existing mountpoint.

LGTM. Matches kernel API.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>

> ---
>  NEWS                                                   | 10 +++++-----
>  sysdeps/unix/sysv/linux/Versions                       |  1 +
>  sysdeps/unix/sysv/linux/aarch64/libc.abilist           |  1 +
>  sysdeps/unix/sysv/linux/alpha/libc.abilist             |  1 +
>  sysdeps/unix/sysv/linux/arc/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/hppa/libc.abilist              |  1 +
>  sysdeps/unix/sysv/linux/i386/libc.abilist              |  1 +
>  sysdeps/unix/sysv/linux/ia64/libc.abilist              |  1 +
>  sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist     |  1 +
>  sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist       |  1 +
>  sysdeps/unix/sysv/linux/microblaze/be/libc.abilist     |  1 +
>  sysdeps/unix/sysv/linux/microblaze/le/libc.abilist     |  1 +
>  sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist   |  1 +
>  sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist |  1 +
>  sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist   |  1 +
>  sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist   |  1 +
>  sysdeps/unix/sysv/linux/nios2/libc.abilist             |  1 +
>  sysdeps/unix/sysv/linux/or1k/libc.abilist              |  1 +
>  .../unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist |  1 +
>  .../sysv/linux/powerpc/powerpc32/nofpu/libc.abilist    |  1 +
>  .../unix/sysv/linux/powerpc/powerpc64/be/libc.abilist  |  1 +
>  .../unix/sysv/linux/powerpc/powerpc64/le/libc.abilist  |  1 +
>  sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist        |  1 +
>  sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist        |  1 +
>  sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist      |  1 +
>  sysdeps/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 +
>  sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist     |  1 +
>  sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist     |  1 +
>  sysdeps/unix/sysv/linux/sys/mount.h                    |  9 +++++++++
>  sysdeps/unix/sysv/linux/syscalls.list                  |  1 +
>  sysdeps/unix/sysv/linux/tst-mount-consts.py            |  3 ++-
>  sysdeps/unix/sysv/linux/x86_64/64/libc.abilist         |  1 +
>  sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist        |  1 +
>  38 files changed, 51 insertions(+), 6 deletions(-)
> 
> diff --git a/NEWS b/NEWS
> index 9557b15f4a..f52718aa77 100644
> --- a/NEWS
> +++ b/NEWS
> @@ -41,11 +41,11 @@ Major new features:
>    have adverse impact.  It is incompatible with EDNS0 usage and DNSSEC
>    validation by applications.
>  
> -* On Linux, the fsopen, fsmount, move_mount, fsconfig, and fspick functions
> -  have been added.  They are part of the new Linux kernel mount APIs that
> -  allow applications to more flexibly configure and operate on filesystem
> -  mounts.  The new mount APIs are specifically designed to work with
> -  namespaces.
> +* On Linux, the fsopen, fsmount, move_mount, fsconfig, fspick, and open_tree
> +  functions have been added.  They are part of the new Linux kernel mount
> +  APIs that allow applications to more flexibly configure and operate on
> +  filesystem mounts.  The new mount APIs are specifically designed to work
> +  with namespaces.

OK.

>  
>  Deprecated and removed features, and other changes affecting compatibility:
>  
> diff --git a/sysdeps/unix/sysv/linux/Versions b/sysdeps/unix/sysv/linux/Versions
> index 7bc5861513..b70530ef40 100644
> --- a/sysdeps/unix/sysv/linux/Versions
> +++ b/sysdeps/unix/sysv/linux/Versions
> @@ -305,6 +305,7 @@ libc {
>      fsopen;
>      fspick;
>      move_mount;
> +    open_tree;

OK.

>      pidfd_open;
>      pidfd_getfd;
>      pidfd_send_signal;
> diff --git a/sysdeps/unix/sysv/linux/aarch64/libc.abilist b/sysdeps/unix/sysv/linux/aarch64/libc.abilist
> index 4eaffedf7f..2a666d8135 100644
> --- a/sysdeps/unix/sysv/linux/aarch64/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/aarch64/libc.abilist
> @@ -2621,6 +2621,7 @@ GLIBC_2.36 fsmount F
>  GLIBC_2.36 fsopen F
>  GLIBC_2.36 fspick F
>  GLIBC_2.36 move_mount F
> +GLIBC_2.36 open_tree F
>  GLIBC_2.36 pidfd_getfd F
>  GLIBC_2.36 pidfd_open F
>  GLIBC_2.36 pidfd_send_signal F
> diff --git a/sysdeps/unix/sysv/linux/alpha/libc.abilist b/sysdeps/unix/sysv/linux/alpha/libc.abilist
> index 6acce2a762..41bd7c1959 100644
> --- a/sysdeps/unix/sysv/linux/alpha/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/alpha/libc.abilist
> @@ -2718,6 +2718,7 @@ GLIBC_2.36 fsmount F
>  GLIBC_2.36 fsopen F
>  GLIBC_2.36 fspick F
>  GLIBC_2.36 move_mount F
> +GLIBC_2.36 open_tree F
>  GLIBC_2.36 pidfd_getfd F
>  GLIBC_2.36 pidfd_open F
>  GLIBC_2.36 pidfd_send_signal F
> diff --git a/sysdeps/unix/sysv/linux/arc/libc.abilist b/sysdeps/unix/sysv/linux/arc/libc.abilist
> index 9d254a3bc3..198fdab2f7 100644
> --- a/sysdeps/unix/sysv/linux/arc/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/arc/libc.abilist
> @@ -2382,6 +2382,7 @@ GLIBC_2.36 fsmount F
>  GLIBC_2.36 fsopen F
>  GLIBC_2.36 fspick F
>  GLIBC_2.36 move_mount F
> +GLIBC_2.36 open_tree F
>  GLIBC_2.36 pidfd_getfd F
>  GLIBC_2.36 pidfd_open F
>  GLIBC_2.36 pidfd_send_signal F
> diff --git a/sysdeps/unix/sysv/linux/arm/be/libc.abilist b/sysdeps/unix/sysv/linux/arm/be/libc.abilist
> index 95026bc448..6fd4e75df2 100644
> --- a/sysdeps/unix/sysv/linux/arm/be/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/arm/be/libc.abilist
> @@ -501,6 +501,7 @@ GLIBC_2.36 fsmount F
>  GLIBC_2.36 fsopen F
>  GLIBC_2.36 fspick F
>  GLIBC_2.36 move_mount F
> +GLIBC_2.36 open_tree F
>  GLIBC_2.36 pidfd_getfd F
>  GLIBC_2.36 pidfd_open F
>  GLIBC_2.36 pidfd_send_signal F
> diff --git a/sysdeps/unix/sysv/linux/arm/le/libc.abilist b/sysdeps/unix/sysv/linux/arm/le/libc.abilist
> index 096246378c..3ec572b50f 100644
> --- a/sysdeps/unix/sysv/linux/arm/le/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/arm/le/libc.abilist
> @@ -498,6 +498,7 @@ GLIBC_2.36 fsmount F
>  GLIBC_2.36 fsopen F
>  GLIBC_2.36 fspick F
>  GLIBC_2.36 move_mount F
> +GLIBC_2.36 open_tree F
>  GLIBC_2.36 pidfd_getfd F
>  GLIBC_2.36 pidfd_open F
>  GLIBC_2.36 pidfd_send_signal F
> diff --git a/sysdeps/unix/sysv/linux/csky/libc.abilist b/sysdeps/unix/sysv/linux/csky/libc.abilist
> index 166008f970..94f3deb3e5 100644
> --- a/sysdeps/unix/sysv/linux/csky/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/csky/libc.abilist
> @@ -2657,6 +2657,7 @@ GLIBC_2.36 fsmount F
>  GLIBC_2.36 fsopen F
>  GLIBC_2.36 fspick F
>  GLIBC_2.36 move_mount F
> +GLIBC_2.36 open_tree F
>  GLIBC_2.36 pidfd_getfd F
>  GLIBC_2.36 pidfd_open F
>  GLIBC_2.36 pidfd_send_signal F
> diff --git a/sysdeps/unix/sysv/linux/hppa/libc.abilist b/sysdeps/unix/sysv/linux/hppa/libc.abilist
> index 155cc6ed96..a7deaf3e26 100644
> --- a/sysdeps/unix/sysv/linux/hppa/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/hppa/libc.abilist
> @@ -2606,6 +2606,7 @@ GLIBC_2.36 fsmount F
>  GLIBC_2.36 fsopen F
>  GLIBC_2.36 fspick F
>  GLIBC_2.36 move_mount F
> +GLIBC_2.36 open_tree F
>  GLIBC_2.36 pidfd_getfd F
>  GLIBC_2.36 pidfd_open F
>  GLIBC_2.36 pidfd_send_signal F
> diff --git a/sysdeps/unix/sysv/linux/i386/libc.abilist b/sysdeps/unix/sysv/linux/i386/libc.abilist
> index 67f7e36556..5f1a1bc4d0 100644
> --- a/sysdeps/unix/sysv/linux/i386/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/i386/libc.abilist
> @@ -2790,6 +2790,7 @@ GLIBC_2.36 fsmount F
>  GLIBC_2.36 fsopen F
>  GLIBC_2.36 fspick F
>  GLIBC_2.36 move_mount F
> +GLIBC_2.36 open_tree F
>  GLIBC_2.36 pidfd_getfd F
>  GLIBC_2.36 pidfd_open F
>  GLIBC_2.36 pidfd_send_signal F
> diff --git a/sysdeps/unix/sysv/linux/ia64/libc.abilist b/sysdeps/unix/sysv/linux/ia64/libc.abilist
> index dbb75aa50f..1af8a55836 100644
> --- a/sysdeps/unix/sysv/linux/ia64/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/ia64/libc.abilist
> @@ -2556,6 +2556,7 @@ GLIBC_2.36 fsmount F
>  GLIBC_2.36 fsopen F
>  GLIBC_2.36 fspick F
>  GLIBC_2.36 move_mount F
> +GLIBC_2.36 open_tree F
>  GLIBC_2.36 pidfd_getfd F
>  GLIBC_2.36 pidfd_open F
>  GLIBC_2.36 pidfd_send_signal F
> diff --git a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
> index 6d72cedf89..ad3a4b4008 100644
> --- a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
> @@ -502,6 +502,7 @@ GLIBC_2.36 fsmount F
>  GLIBC_2.36 fsopen F
>  GLIBC_2.36 fspick F
>  GLIBC_2.36 move_mount F
> +GLIBC_2.36 open_tree F
>  GLIBC_2.36 pidfd_getfd F
>  GLIBC_2.36 pidfd_open F
>  GLIBC_2.36 pidfd_send_signal F
> diff --git a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
> index 7899efa0e0..87e76f33a0 100644
> --- a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
> @@ -2733,6 +2733,7 @@ GLIBC_2.36 fsmount F
>  GLIBC_2.36 fsopen F
>  GLIBC_2.36 fspick F
>  GLIBC_2.36 move_mount F
> +GLIBC_2.36 open_tree F
>  GLIBC_2.36 pidfd_getfd F
>  GLIBC_2.36 pidfd_open F
>  GLIBC_2.36 pidfd_send_signal F
> diff --git a/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist b/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
> index 162a85a8a8..73df42c7aa 100644
> --- a/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
> @@ -2706,6 +2706,7 @@ GLIBC_2.36 fsmount F
>  GLIBC_2.36 fsopen F
>  GLIBC_2.36 fspick F
>  GLIBC_2.36 move_mount F
> +GLIBC_2.36 open_tree F
>  GLIBC_2.36 pidfd_getfd F
>  GLIBC_2.36 pidfd_open F
>  GLIBC_2.36 pidfd_send_signal F
> diff --git a/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist b/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
> index a5e28ec2ae..5c2e936547 100644
> --- a/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
> @@ -2703,6 +2703,7 @@ GLIBC_2.36 fsmount F
>  GLIBC_2.36 fsopen F
>  GLIBC_2.36 fspick F
>  GLIBC_2.36 move_mount F
> +GLIBC_2.36 open_tree F
>  GLIBC_2.36 pidfd_getfd F
>  GLIBC_2.36 pidfd_open F
>  GLIBC_2.36 pidfd_send_signal F
> diff --git a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
> index 33627f4b67..45919d27d6 100644
> --- a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
> @@ -2698,6 +2698,7 @@ GLIBC_2.36 fsmount F
>  GLIBC_2.36 fsopen F
>  GLIBC_2.36 fspick F
>  GLIBC_2.36 move_mount F
> +GLIBC_2.36 open_tree F
>  GLIBC_2.36 pidfd_getfd F
>  GLIBC_2.36 pidfd_open F
>  GLIBC_2.36 pidfd_send_signal F
> diff --git a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
> index 333547fc56..8321b0efac 100644
> --- a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
> @@ -2696,6 +2696,7 @@ GLIBC_2.36 fsmount F
>  GLIBC_2.36 fsopen F
>  GLIBC_2.36 fspick F
>  GLIBC_2.36 move_mount F
> +GLIBC_2.36 open_tree F
>  GLIBC_2.36 pidfd_getfd F
>  GLIBC_2.36 pidfd_open F
>  GLIBC_2.36 pidfd_send_signal F
> diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
> index a46a1aefe7..c7198646d2 100644
> --- a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
> @@ -2704,6 +2704,7 @@ GLIBC_2.36 fsmount F
>  GLIBC_2.36 fsopen F
>  GLIBC_2.36 fspick F
>  GLIBC_2.36 move_mount F
> +GLIBC_2.36 open_tree F
>  GLIBC_2.36 pidfd_getfd F
>  GLIBC_2.36 pidfd_open F
>  GLIBC_2.36 pidfd_send_signal F
> diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
> index b9b88321a7..8b3cca2a54 100644
> --- a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
> @@ -2607,6 +2607,7 @@ GLIBC_2.36 fsmount F
>  GLIBC_2.36 fsopen F
>  GLIBC_2.36 fspick F
>  GLIBC_2.36 move_mount F
> +GLIBC_2.36 open_tree F
>  GLIBC_2.36 pidfd_getfd F
>  GLIBC_2.36 pidfd_open F
>  GLIBC_2.36 pidfd_send_signal F
> diff --git a/sysdeps/unix/sysv/linux/nios2/libc.abilist b/sysdeps/unix/sysv/linux/nios2/libc.abilist
> index 0f2293d6a1..2f1595bb35 100644
> --- a/sysdeps/unix/sysv/linux/nios2/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/nios2/libc.abilist
> @@ -2745,6 +2745,7 @@ GLIBC_2.36 fsmount F
>  GLIBC_2.36 fsopen F
>  GLIBC_2.36 fspick F
>  GLIBC_2.36 move_mount F
> +GLIBC_2.36 open_tree F
>  GLIBC_2.36 pidfd_getfd F
>  GLIBC_2.36 pidfd_open F
>  GLIBC_2.36 pidfd_send_signal F
> diff --git a/sysdeps/unix/sysv/linux/or1k/libc.abilist b/sysdeps/unix/sysv/linux/or1k/libc.abilist
> index 812c05804e..d1d4e12d12 100644
> --- a/sysdeps/unix/sysv/linux/or1k/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/or1k/libc.abilist
> @@ -2128,6 +2128,7 @@ GLIBC_2.36 fsmount F
>  GLIBC_2.36 fsopen F
>  GLIBC_2.36 fspick F
>  GLIBC_2.36 move_mount F
> +GLIBC_2.36 open_tree F
>  GLIBC_2.36 pidfd_getfd F
>  GLIBC_2.36 pidfd_open F
>  GLIBC_2.36 pidfd_send_signal F
> diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
> index 568e5ab91f..50c9fadaf0 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
> @@ -2760,6 +2760,7 @@ GLIBC_2.36 fsmount F
>  GLIBC_2.36 fsopen F
>  GLIBC_2.36 fspick F
>  GLIBC_2.36 move_mount F
> +GLIBC_2.36 open_tree F
>  GLIBC_2.36 pidfd_getfd F
>  GLIBC_2.36 pidfd_open F
>  GLIBC_2.36 pidfd_send_signal F
> diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
> index bf5bab018d..8998a560cd 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
> @@ -2793,6 +2793,7 @@ GLIBC_2.36 fsmount F
>  GLIBC_2.36 fsopen F
>  GLIBC_2.36 fspick F
>  GLIBC_2.36 move_mount F
> +GLIBC_2.36 open_tree F
>  GLIBC_2.36 pidfd_getfd F
>  GLIBC_2.36 pidfd_open F
>  GLIBC_2.36 pidfd_send_signal F
> diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
> index cffbb88886..bca46bdbe5 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
> @@ -2515,6 +2515,7 @@ GLIBC_2.36 fsmount F
>  GLIBC_2.36 fsopen F
>  GLIBC_2.36 fspick F
>  GLIBC_2.36 move_mount F
> +GLIBC_2.36 open_tree F
>  GLIBC_2.36 pidfd_getfd F
>  GLIBC_2.36 pidfd_open F
>  GLIBC_2.36 pidfd_send_signal F
> diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
> index 8dac584380..97f6d96cd6 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
> @@ -2817,6 +2817,7 @@ GLIBC_2.36 fsmount F
>  GLIBC_2.36 fsopen F
>  GLIBC_2.36 fspick F
>  GLIBC_2.36 move_mount F
> +GLIBC_2.36 open_tree F
>  GLIBC_2.36 pidfd_getfd F
>  GLIBC_2.36 pidfd_open F
>  GLIBC_2.36 pidfd_send_signal F
> diff --git a/sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist b/sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist
> index 431a9a30a1..f588745b28 100644
> --- a/sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist
> @@ -2384,6 +2384,7 @@ GLIBC_2.36 fsmount F
>  GLIBC_2.36 fsopen F
>  GLIBC_2.36 fspick F
>  GLIBC_2.36 move_mount F
> +GLIBC_2.36 open_tree F
>  GLIBC_2.36 pidfd_getfd F
>  GLIBC_2.36 pidfd_open F
>  GLIBC_2.36 pidfd_send_signal F
> diff --git a/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist b/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist
> index ec86269bf7..1acf8a4c54 100644
> --- a/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist
> @@ -2584,6 +2584,7 @@ GLIBC_2.36 fsmount F
>  GLIBC_2.36 fsopen F
>  GLIBC_2.36 fspick F
>  GLIBC_2.36 move_mount F
> +GLIBC_2.36 open_tree F
>  GLIBC_2.36 pidfd_getfd F
>  GLIBC_2.36 pidfd_open F
>  GLIBC_2.36 pidfd_send_signal F
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
> index fe437d8e61..7c8b410f1a 100644
> --- a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
> @@ -2758,6 +2758,7 @@ GLIBC_2.36 fsmount F
>  GLIBC_2.36 fsopen F
>  GLIBC_2.36 fspick F
>  GLIBC_2.36 move_mount F
> +GLIBC_2.36 open_tree F
>  GLIBC_2.36 pidfd_getfd F
>  GLIBC_2.36 pidfd_open F
>  GLIBC_2.36 pidfd_send_signal F
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
> index e802e8da7f..ba9317ee01 100644
> --- a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
> @@ -2552,6 +2552,7 @@ GLIBC_2.36 fsmount F
>  GLIBC_2.36 fsopen F
>  GLIBC_2.36 fspick F
>  GLIBC_2.36 move_mount F
> +GLIBC_2.36 open_tree F
>  GLIBC_2.36 pidfd_getfd F
>  GLIBC_2.36 pidfd_open F
>  GLIBC_2.36 pidfd_send_signal F
> diff --git a/sysdeps/unix/sysv/linux/sh/be/libc.abilist b/sysdeps/unix/sysv/linux/sh/be/libc.abilist
> index c0a7196f5a..75fa8834f1 100644
> --- a/sysdeps/unix/sysv/linux/sh/be/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/sh/be/libc.abilist
> @@ -2613,6 +2613,7 @@ GLIBC_2.36 fsmount F
>  GLIBC_2.36 fsopen F
>  GLIBC_2.36 fspick F
>  GLIBC_2.36 move_mount F
> +GLIBC_2.36 open_tree F
>  GLIBC_2.36 pidfd_getfd F
>  GLIBC_2.36 pidfd_open F
>  GLIBC_2.36 pidfd_send_signal F
> diff --git a/sysdeps/unix/sysv/linux/sh/le/libc.abilist b/sysdeps/unix/sysv/linux/sh/le/libc.abilist
> index 45589bac28..4a4f8ff33f 100644
> --- a/sysdeps/unix/sysv/linux/sh/le/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/sh/le/libc.abilist
> @@ -2610,6 +2610,7 @@ GLIBC_2.36 fsmount F
>  GLIBC_2.36 fsopen F
>  GLIBC_2.36 fspick F
>  GLIBC_2.36 move_mount F
> +GLIBC_2.36 open_tree F
>  GLIBC_2.36 pidfd_getfd F
>  GLIBC_2.36 pidfd_open F
>  GLIBC_2.36 pidfd_send_signal F
> diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
> index 9b84bc0143..d26671dba8 100644
> --- a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
> @@ -2753,6 +2753,7 @@ GLIBC_2.36 fsmount F
>  GLIBC_2.36 fsopen F
>  GLIBC_2.36 fspick F
>  GLIBC_2.36 move_mount F
> +GLIBC_2.36 open_tree F
>  GLIBC_2.36 pidfd_getfd F
>  GLIBC_2.36 pidfd_open F
>  GLIBC_2.36 pidfd_send_signal F
> diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
> index 362a22903a..16c2a98ab5 100644
> --- a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
> @@ -2579,6 +2579,7 @@ GLIBC_2.36 fsmount F
>  GLIBC_2.36 fsopen F
>  GLIBC_2.36 fspick F
>  GLIBC_2.36 move_mount F
> +GLIBC_2.36 open_tree F
>  GLIBC_2.36 pidfd_getfd F
>  GLIBC_2.36 pidfd_open F
>  GLIBC_2.36 pidfd_send_signal F
> diff --git a/sysdeps/unix/sysv/linux/sys/mount.h b/sysdeps/unix/sysv/linux/sys/mount.h
> index e0880f75a5..534d05b3f5 100644
> --- a/sysdeps/unix/sysv/linux/sys/mount.h
> +++ b/sysdeps/unix/sysv/linux/sys/mount.h
> @@ -21,6 +21,7 @@
>  #ifndef _SYS_MOUNT_H
>  #define _SYS_MOUNT_H	1
>  
> +#include <fcntl.h>

OK.

>  #include <features.h>
>  #include <sys/ioctl.h>
>  
> @@ -192,6 +193,10 @@ enum fsconfig_command
>  #define FSCONFIG_CMD_RECONFIGURE FSCONFIG_CMD_RECONFIGURE
>  };
>  
> +/* open_tree flags.  */
> +#define OPEN_TREE_CLONE    1         /* Clone the target tree and attach the clone */
> +#define OPEN_TREE_CLOEXEC  O_CLOEXEC /* Close the file on execve() */

OK. OPEN_TREE_* 1, O_CLOEXEC. Matches kernel.

> +
>  
>  __BEGIN_DECLS
>  
> @@ -231,6 +236,10 @@ extern int fsconfig (int __fd, unsigned int __cmd, const char *__key,
>  extern int fspick (int __dfd, const char *__path, unsigned int __flags)

OK. return int. signature is int, const char *, unsigned int. Matches kernel.

>    __THROW;
>  
> +/* Open the mount point FILENAME in directory DFD using FLAGS.  */
> +extern int open_tree (int __dfd, const char *__filename, unsigned int __flags)
> +  __THROW;
> +
>  __END_DECLS
>  
>  #endif /* _SYS_MOUNT_H */
> diff --git a/sysdeps/unix/sysv/linux/syscalls.list b/sysdeps/unix/sysv/linux/syscalls.list
> index 38ab457340..493e68b834 100644
> --- a/sysdeps/unix/sysv/linux/syscalls.list
> +++ b/sysdeps/unix/sysv/linux/syscalls.list
> @@ -43,6 +43,7 @@ move_mount	EXTRA	move_mount	i:isisU	move_mount
>  munlock		-	munlock		i:aU	munlock
>  munlockall	-	munlockall	i:	munlockall
>  nfsservctl	EXTRA	nfsservctl	i:ipp	__compat_nfsservctl	nfsservctl@GLIBC_2.0:GLIBC_2.28
> +open_tree	EXTRA	open_tree	i:isU	open_tree

OK. i:isU. Matches kernel.

>  pipe2		-	pipe2		i:fi	__pipe2		pipe2
>  pidfd_open	EXTRA	pidfd_open	i:iU	pidfd_open
>  pidfd_getfd	EXTRA	pidfd_getfd	i:iiU	pidfd_getfd
> diff --git a/sysdeps/unix/sysv/linux/tst-mount-consts.py b/sysdeps/unix/sysv/linux/tst-mount-consts.py
> index dd4d50f202..82ab18d963 100755
> --- a/sysdeps/unix/sysv/linux/tst-mount-consts.py
> +++ b/sysdeps/unix/sysv/linux/tst-mount-consts.py
> @@ -55,7 +55,8 @@ def main():
>          check('FSOPEN_.*'),
>          check('FSMOUNT_.*'),
>          # MOVE_MOUNT__MASK may vary depending of the kernel version.
> -        check('MOVE_MOUNT_.*', 'MOVE_MOUNT__MASK'))
> +        check('MOVE_MOUNT_.*', 'MOVE_MOUNT__MASK'),
> +        check('OPEN_TREE_*'))
>      sys.exit(status)
>  
>  if __name__ == '__main__':
> diff --git a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
> index 93dab79cdc..bd7c4ef801 100644
> --- a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
> @@ -2530,6 +2530,7 @@ GLIBC_2.36 fsmount F
>  GLIBC_2.36 fsopen F
>  GLIBC_2.36 fspick F
>  GLIBC_2.36 move_mount F
> +GLIBC_2.36 open_tree F
>  GLIBC_2.36 pidfd_getfd F
>  GLIBC_2.36 pidfd_open F
>  GLIBC_2.36 pidfd_send_signal F
> diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
> index 24daa92e90..1c7f60b41a 100644
> --- a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
> @@ -2636,6 +2636,7 @@ GLIBC_2.36 fsmount F
>  GLIBC_2.36 fsopen F
>  GLIBC_2.36 fspick F
>  GLIBC_2.36 move_mount F
> +GLIBC_2.36 open_tree F
>  GLIBC_2.36 pidfd_getfd F
>  GLIBC_2.36 pidfd_open F
>  GLIBC_2.36 pidfd_send_signal F
diff mbox series

Patch

diff --git a/NEWS b/NEWS
index 9557b15f4a..f52718aa77 100644
--- a/NEWS
+++ b/NEWS
@@ -41,11 +41,11 @@  Major new features:
   have adverse impact.  It is incompatible with EDNS0 usage and DNSSEC
   validation by applications.
 
-* On Linux, the fsopen, fsmount, move_mount, fsconfig, and fspick functions
-  have been added.  They are part of the new Linux kernel mount APIs that
-  allow applications to more flexibly configure and operate on filesystem
-  mounts.  The new mount APIs are specifically designed to work with
-  namespaces.
+* On Linux, the fsopen, fsmount, move_mount, fsconfig, fspick, and open_tree
+  functions have been added.  They are part of the new Linux kernel mount
+  APIs that allow applications to more flexibly configure and operate on
+  filesystem mounts.  The new mount APIs are specifically designed to work
+  with namespaces.
 
 Deprecated and removed features, and other changes affecting compatibility:
 
diff --git a/sysdeps/unix/sysv/linux/Versions b/sysdeps/unix/sysv/linux/Versions
index 7bc5861513..b70530ef40 100644
--- a/sysdeps/unix/sysv/linux/Versions
+++ b/sysdeps/unix/sysv/linux/Versions
@@ -305,6 +305,7 @@  libc {
     fsopen;
     fspick;
     move_mount;
+    open_tree;
     pidfd_open;
     pidfd_getfd;
     pidfd_send_signal;
diff --git a/sysdeps/unix/sysv/linux/aarch64/libc.abilist b/sysdeps/unix/sysv/linux/aarch64/libc.abilist
index 4eaffedf7f..2a666d8135 100644
--- a/sysdeps/unix/sysv/linux/aarch64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/aarch64/libc.abilist
@@ -2621,6 +2621,7 @@  GLIBC_2.36 fsmount F
 GLIBC_2.36 fsopen F
 GLIBC_2.36 fspick F
 GLIBC_2.36 move_mount F
+GLIBC_2.36 open_tree F
 GLIBC_2.36 pidfd_getfd F
 GLIBC_2.36 pidfd_open F
 GLIBC_2.36 pidfd_send_signal F
diff --git a/sysdeps/unix/sysv/linux/alpha/libc.abilist b/sysdeps/unix/sysv/linux/alpha/libc.abilist
index 6acce2a762..41bd7c1959 100644
--- a/sysdeps/unix/sysv/linux/alpha/libc.abilist
+++ b/sysdeps/unix/sysv/linux/alpha/libc.abilist
@@ -2718,6 +2718,7 @@  GLIBC_2.36 fsmount F
 GLIBC_2.36 fsopen F
 GLIBC_2.36 fspick F
 GLIBC_2.36 move_mount F
+GLIBC_2.36 open_tree F
 GLIBC_2.36 pidfd_getfd F
 GLIBC_2.36 pidfd_open F
 GLIBC_2.36 pidfd_send_signal F
diff --git a/sysdeps/unix/sysv/linux/arc/libc.abilist b/sysdeps/unix/sysv/linux/arc/libc.abilist
index 9d254a3bc3..198fdab2f7 100644
--- a/sysdeps/unix/sysv/linux/arc/libc.abilist
+++ b/sysdeps/unix/sysv/linux/arc/libc.abilist
@@ -2382,6 +2382,7 @@  GLIBC_2.36 fsmount F
 GLIBC_2.36 fsopen F
 GLIBC_2.36 fspick F
 GLIBC_2.36 move_mount F
+GLIBC_2.36 open_tree F
 GLIBC_2.36 pidfd_getfd F
 GLIBC_2.36 pidfd_open F
 GLIBC_2.36 pidfd_send_signal F
diff --git a/sysdeps/unix/sysv/linux/arm/be/libc.abilist b/sysdeps/unix/sysv/linux/arm/be/libc.abilist
index 95026bc448..6fd4e75df2 100644
--- a/sysdeps/unix/sysv/linux/arm/be/libc.abilist
+++ b/sysdeps/unix/sysv/linux/arm/be/libc.abilist
@@ -501,6 +501,7 @@  GLIBC_2.36 fsmount F
 GLIBC_2.36 fsopen F
 GLIBC_2.36 fspick F
 GLIBC_2.36 move_mount F
+GLIBC_2.36 open_tree F
 GLIBC_2.36 pidfd_getfd F
 GLIBC_2.36 pidfd_open F
 GLIBC_2.36 pidfd_send_signal F
diff --git a/sysdeps/unix/sysv/linux/arm/le/libc.abilist b/sysdeps/unix/sysv/linux/arm/le/libc.abilist
index 096246378c..3ec572b50f 100644
--- a/sysdeps/unix/sysv/linux/arm/le/libc.abilist
+++ b/sysdeps/unix/sysv/linux/arm/le/libc.abilist
@@ -498,6 +498,7 @@  GLIBC_2.36 fsmount F
 GLIBC_2.36 fsopen F
 GLIBC_2.36 fspick F
 GLIBC_2.36 move_mount F
+GLIBC_2.36 open_tree F
 GLIBC_2.36 pidfd_getfd F
 GLIBC_2.36 pidfd_open F
 GLIBC_2.36 pidfd_send_signal F
diff --git a/sysdeps/unix/sysv/linux/csky/libc.abilist b/sysdeps/unix/sysv/linux/csky/libc.abilist
index 166008f970..94f3deb3e5 100644
--- a/sysdeps/unix/sysv/linux/csky/libc.abilist
+++ b/sysdeps/unix/sysv/linux/csky/libc.abilist
@@ -2657,6 +2657,7 @@  GLIBC_2.36 fsmount F
 GLIBC_2.36 fsopen F
 GLIBC_2.36 fspick F
 GLIBC_2.36 move_mount F
+GLIBC_2.36 open_tree F
 GLIBC_2.36 pidfd_getfd F
 GLIBC_2.36 pidfd_open F
 GLIBC_2.36 pidfd_send_signal F
diff --git a/sysdeps/unix/sysv/linux/hppa/libc.abilist b/sysdeps/unix/sysv/linux/hppa/libc.abilist
index 155cc6ed96..a7deaf3e26 100644
--- a/sysdeps/unix/sysv/linux/hppa/libc.abilist
+++ b/sysdeps/unix/sysv/linux/hppa/libc.abilist
@@ -2606,6 +2606,7 @@  GLIBC_2.36 fsmount F
 GLIBC_2.36 fsopen F
 GLIBC_2.36 fspick F
 GLIBC_2.36 move_mount F
+GLIBC_2.36 open_tree F
 GLIBC_2.36 pidfd_getfd F
 GLIBC_2.36 pidfd_open F
 GLIBC_2.36 pidfd_send_signal F
diff --git a/sysdeps/unix/sysv/linux/i386/libc.abilist b/sysdeps/unix/sysv/linux/i386/libc.abilist
index 67f7e36556..5f1a1bc4d0 100644
--- a/sysdeps/unix/sysv/linux/i386/libc.abilist
+++ b/sysdeps/unix/sysv/linux/i386/libc.abilist
@@ -2790,6 +2790,7 @@  GLIBC_2.36 fsmount F
 GLIBC_2.36 fsopen F
 GLIBC_2.36 fspick F
 GLIBC_2.36 move_mount F
+GLIBC_2.36 open_tree F
 GLIBC_2.36 pidfd_getfd F
 GLIBC_2.36 pidfd_open F
 GLIBC_2.36 pidfd_send_signal F
diff --git a/sysdeps/unix/sysv/linux/ia64/libc.abilist b/sysdeps/unix/sysv/linux/ia64/libc.abilist
index dbb75aa50f..1af8a55836 100644
--- a/sysdeps/unix/sysv/linux/ia64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/ia64/libc.abilist
@@ -2556,6 +2556,7 @@  GLIBC_2.36 fsmount F
 GLIBC_2.36 fsopen F
 GLIBC_2.36 fspick F
 GLIBC_2.36 move_mount F
+GLIBC_2.36 open_tree F
 GLIBC_2.36 pidfd_getfd F
 GLIBC_2.36 pidfd_open F
 GLIBC_2.36 pidfd_send_signal F
diff --git a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
index 6d72cedf89..ad3a4b4008 100644
--- a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
+++ b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
@@ -502,6 +502,7 @@  GLIBC_2.36 fsmount F
 GLIBC_2.36 fsopen F
 GLIBC_2.36 fspick F
 GLIBC_2.36 move_mount F
+GLIBC_2.36 open_tree F
 GLIBC_2.36 pidfd_getfd F
 GLIBC_2.36 pidfd_open F
 GLIBC_2.36 pidfd_send_signal F
diff --git a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
index 7899efa0e0..87e76f33a0 100644
--- a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
+++ b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
@@ -2733,6 +2733,7 @@  GLIBC_2.36 fsmount F
 GLIBC_2.36 fsopen F
 GLIBC_2.36 fspick F
 GLIBC_2.36 move_mount F
+GLIBC_2.36 open_tree F
 GLIBC_2.36 pidfd_getfd F
 GLIBC_2.36 pidfd_open F
 GLIBC_2.36 pidfd_send_signal F
diff --git a/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist b/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
index 162a85a8a8..73df42c7aa 100644
--- a/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
+++ b/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
@@ -2706,6 +2706,7 @@  GLIBC_2.36 fsmount F
 GLIBC_2.36 fsopen F
 GLIBC_2.36 fspick F
 GLIBC_2.36 move_mount F
+GLIBC_2.36 open_tree F
 GLIBC_2.36 pidfd_getfd F
 GLIBC_2.36 pidfd_open F
 GLIBC_2.36 pidfd_send_signal F
diff --git a/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist b/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
index a5e28ec2ae..5c2e936547 100644
--- a/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
+++ b/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
@@ -2703,6 +2703,7 @@  GLIBC_2.36 fsmount F
 GLIBC_2.36 fsopen F
 GLIBC_2.36 fspick F
 GLIBC_2.36 move_mount F
+GLIBC_2.36 open_tree F
 GLIBC_2.36 pidfd_getfd F
 GLIBC_2.36 pidfd_open F
 GLIBC_2.36 pidfd_send_signal F
diff --git a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
index 33627f4b67..45919d27d6 100644
--- a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
@@ -2698,6 +2698,7 @@  GLIBC_2.36 fsmount F
 GLIBC_2.36 fsopen F
 GLIBC_2.36 fspick F
 GLIBC_2.36 move_mount F
+GLIBC_2.36 open_tree F
 GLIBC_2.36 pidfd_getfd F
 GLIBC_2.36 pidfd_open F
 GLIBC_2.36 pidfd_send_signal F
diff --git a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
index 333547fc56..8321b0efac 100644
--- a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
@@ -2696,6 +2696,7 @@  GLIBC_2.36 fsmount F
 GLIBC_2.36 fsopen F
 GLIBC_2.36 fspick F
 GLIBC_2.36 move_mount F
+GLIBC_2.36 open_tree F
 GLIBC_2.36 pidfd_getfd F
 GLIBC_2.36 pidfd_open F
 GLIBC_2.36 pidfd_send_signal F
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
index a46a1aefe7..c7198646d2 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
@@ -2704,6 +2704,7 @@  GLIBC_2.36 fsmount F
 GLIBC_2.36 fsopen F
 GLIBC_2.36 fspick F
 GLIBC_2.36 move_mount F
+GLIBC_2.36 open_tree F
 GLIBC_2.36 pidfd_getfd F
 GLIBC_2.36 pidfd_open F
 GLIBC_2.36 pidfd_send_signal F
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
index b9b88321a7..8b3cca2a54 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
@@ -2607,6 +2607,7 @@  GLIBC_2.36 fsmount F
 GLIBC_2.36 fsopen F
 GLIBC_2.36 fspick F
 GLIBC_2.36 move_mount F
+GLIBC_2.36 open_tree F
 GLIBC_2.36 pidfd_getfd F
 GLIBC_2.36 pidfd_open F
 GLIBC_2.36 pidfd_send_signal F
diff --git a/sysdeps/unix/sysv/linux/nios2/libc.abilist b/sysdeps/unix/sysv/linux/nios2/libc.abilist
index 0f2293d6a1..2f1595bb35 100644
--- a/sysdeps/unix/sysv/linux/nios2/libc.abilist
+++ b/sysdeps/unix/sysv/linux/nios2/libc.abilist
@@ -2745,6 +2745,7 @@  GLIBC_2.36 fsmount F
 GLIBC_2.36 fsopen F
 GLIBC_2.36 fspick F
 GLIBC_2.36 move_mount F
+GLIBC_2.36 open_tree F
 GLIBC_2.36 pidfd_getfd F
 GLIBC_2.36 pidfd_open F
 GLIBC_2.36 pidfd_send_signal F
diff --git a/sysdeps/unix/sysv/linux/or1k/libc.abilist b/sysdeps/unix/sysv/linux/or1k/libc.abilist
index 812c05804e..d1d4e12d12 100644
--- a/sysdeps/unix/sysv/linux/or1k/libc.abilist
+++ b/sysdeps/unix/sysv/linux/or1k/libc.abilist
@@ -2128,6 +2128,7 @@  GLIBC_2.36 fsmount F
 GLIBC_2.36 fsopen F
 GLIBC_2.36 fspick F
 GLIBC_2.36 move_mount F
+GLIBC_2.36 open_tree F
 GLIBC_2.36 pidfd_getfd F
 GLIBC_2.36 pidfd_open F
 GLIBC_2.36 pidfd_send_signal F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
index 568e5ab91f..50c9fadaf0 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
@@ -2760,6 +2760,7 @@  GLIBC_2.36 fsmount F
 GLIBC_2.36 fsopen F
 GLIBC_2.36 fspick F
 GLIBC_2.36 move_mount F
+GLIBC_2.36 open_tree F
 GLIBC_2.36 pidfd_getfd F
 GLIBC_2.36 pidfd_open F
 GLIBC_2.36 pidfd_send_signal F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
index bf5bab018d..8998a560cd 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
@@ -2793,6 +2793,7 @@  GLIBC_2.36 fsmount F
 GLIBC_2.36 fsopen F
 GLIBC_2.36 fspick F
 GLIBC_2.36 move_mount F
+GLIBC_2.36 open_tree F
 GLIBC_2.36 pidfd_getfd F
 GLIBC_2.36 pidfd_open F
 GLIBC_2.36 pidfd_send_signal F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
index cffbb88886..bca46bdbe5 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
@@ -2515,6 +2515,7 @@  GLIBC_2.36 fsmount F
 GLIBC_2.36 fsopen F
 GLIBC_2.36 fspick F
 GLIBC_2.36 move_mount F
+GLIBC_2.36 open_tree F
 GLIBC_2.36 pidfd_getfd F
 GLIBC_2.36 pidfd_open F
 GLIBC_2.36 pidfd_send_signal F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
index 8dac584380..97f6d96cd6 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
@@ -2817,6 +2817,7 @@  GLIBC_2.36 fsmount F
 GLIBC_2.36 fsopen F
 GLIBC_2.36 fspick F
 GLIBC_2.36 move_mount F
+GLIBC_2.36 open_tree F
 GLIBC_2.36 pidfd_getfd F
 GLIBC_2.36 pidfd_open F
 GLIBC_2.36 pidfd_send_signal F
diff --git a/sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist b/sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist
index 431a9a30a1..f588745b28 100644
--- a/sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist
@@ -2384,6 +2384,7 @@  GLIBC_2.36 fsmount F
 GLIBC_2.36 fsopen F
 GLIBC_2.36 fspick F
 GLIBC_2.36 move_mount F
+GLIBC_2.36 open_tree F
 GLIBC_2.36 pidfd_getfd F
 GLIBC_2.36 pidfd_open F
 GLIBC_2.36 pidfd_send_signal F
diff --git a/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist b/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist
index ec86269bf7..1acf8a4c54 100644
--- a/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist
@@ -2584,6 +2584,7 @@  GLIBC_2.36 fsmount F
 GLIBC_2.36 fsopen F
 GLIBC_2.36 fspick F
 GLIBC_2.36 move_mount F
+GLIBC_2.36 open_tree F
 GLIBC_2.36 pidfd_getfd F
 GLIBC_2.36 pidfd_open F
 GLIBC_2.36 pidfd_send_signal F
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
index fe437d8e61..7c8b410f1a 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
@@ -2758,6 +2758,7 @@  GLIBC_2.36 fsmount F
 GLIBC_2.36 fsopen F
 GLIBC_2.36 fspick F
 GLIBC_2.36 move_mount F
+GLIBC_2.36 open_tree F
 GLIBC_2.36 pidfd_getfd F
 GLIBC_2.36 pidfd_open F
 GLIBC_2.36 pidfd_send_signal F
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
index e802e8da7f..ba9317ee01 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
@@ -2552,6 +2552,7 @@  GLIBC_2.36 fsmount F
 GLIBC_2.36 fsopen F
 GLIBC_2.36 fspick F
 GLIBC_2.36 move_mount F
+GLIBC_2.36 open_tree F
 GLIBC_2.36 pidfd_getfd F
 GLIBC_2.36 pidfd_open F
 GLIBC_2.36 pidfd_send_signal F
diff --git a/sysdeps/unix/sysv/linux/sh/be/libc.abilist b/sysdeps/unix/sysv/linux/sh/be/libc.abilist
index c0a7196f5a..75fa8834f1 100644
--- a/sysdeps/unix/sysv/linux/sh/be/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sh/be/libc.abilist
@@ -2613,6 +2613,7 @@  GLIBC_2.36 fsmount F
 GLIBC_2.36 fsopen F
 GLIBC_2.36 fspick F
 GLIBC_2.36 move_mount F
+GLIBC_2.36 open_tree F
 GLIBC_2.36 pidfd_getfd F
 GLIBC_2.36 pidfd_open F
 GLIBC_2.36 pidfd_send_signal F
diff --git a/sysdeps/unix/sysv/linux/sh/le/libc.abilist b/sysdeps/unix/sysv/linux/sh/le/libc.abilist
index 45589bac28..4a4f8ff33f 100644
--- a/sysdeps/unix/sysv/linux/sh/le/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sh/le/libc.abilist
@@ -2610,6 +2610,7 @@  GLIBC_2.36 fsmount F
 GLIBC_2.36 fsopen F
 GLIBC_2.36 fspick F
 GLIBC_2.36 move_mount F
+GLIBC_2.36 open_tree F
 GLIBC_2.36 pidfd_getfd F
 GLIBC_2.36 pidfd_open F
 GLIBC_2.36 pidfd_send_signal F
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
index 9b84bc0143..d26671dba8 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
@@ -2753,6 +2753,7 @@  GLIBC_2.36 fsmount F
 GLIBC_2.36 fsopen F
 GLIBC_2.36 fspick F
 GLIBC_2.36 move_mount F
+GLIBC_2.36 open_tree F
 GLIBC_2.36 pidfd_getfd F
 GLIBC_2.36 pidfd_open F
 GLIBC_2.36 pidfd_send_signal F
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
index 362a22903a..16c2a98ab5 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
@@ -2579,6 +2579,7 @@  GLIBC_2.36 fsmount F
 GLIBC_2.36 fsopen F
 GLIBC_2.36 fspick F
 GLIBC_2.36 move_mount F
+GLIBC_2.36 open_tree F
 GLIBC_2.36 pidfd_getfd F
 GLIBC_2.36 pidfd_open F
 GLIBC_2.36 pidfd_send_signal F
diff --git a/sysdeps/unix/sysv/linux/sys/mount.h b/sysdeps/unix/sysv/linux/sys/mount.h
index e0880f75a5..534d05b3f5 100644
--- a/sysdeps/unix/sysv/linux/sys/mount.h
+++ b/sysdeps/unix/sysv/linux/sys/mount.h
@@ -21,6 +21,7 @@ 
 #ifndef _SYS_MOUNT_H
 #define _SYS_MOUNT_H	1
 
+#include <fcntl.h>
 #include <features.h>
 #include <sys/ioctl.h>
 
@@ -192,6 +193,10 @@  enum fsconfig_command
 #define FSCONFIG_CMD_RECONFIGURE FSCONFIG_CMD_RECONFIGURE
 };
 
+/* open_tree flags.  */
+#define OPEN_TREE_CLONE    1         /* Clone the target tree and attach the clone */
+#define OPEN_TREE_CLOEXEC  O_CLOEXEC /* Close the file on execve() */
+
 
 __BEGIN_DECLS
 
@@ -231,6 +236,10 @@  extern int fsconfig (int __fd, unsigned int __cmd, const char *__key,
 extern int fspick (int __dfd, const char *__path, unsigned int __flags)
   __THROW;
 
+/* Open the mount point FILENAME in directory DFD using FLAGS.  */
+extern int open_tree (int __dfd, const char *__filename, unsigned int __flags)
+  __THROW;
+
 __END_DECLS
 
 #endif /* _SYS_MOUNT_H */
diff --git a/sysdeps/unix/sysv/linux/syscalls.list b/sysdeps/unix/sysv/linux/syscalls.list
index 38ab457340..493e68b834 100644
--- a/sysdeps/unix/sysv/linux/syscalls.list
+++ b/sysdeps/unix/sysv/linux/syscalls.list
@@ -43,6 +43,7 @@  move_mount	EXTRA	move_mount	i:isisU	move_mount
 munlock		-	munlock		i:aU	munlock
 munlockall	-	munlockall	i:	munlockall
 nfsservctl	EXTRA	nfsservctl	i:ipp	__compat_nfsservctl	nfsservctl@GLIBC_2.0:GLIBC_2.28
+open_tree	EXTRA	open_tree	i:isU	open_tree
 pipe2		-	pipe2		i:fi	__pipe2		pipe2
 pidfd_open	EXTRA	pidfd_open	i:iU	pidfd_open
 pidfd_getfd	EXTRA	pidfd_getfd	i:iiU	pidfd_getfd
diff --git a/sysdeps/unix/sysv/linux/tst-mount-consts.py b/sysdeps/unix/sysv/linux/tst-mount-consts.py
index dd4d50f202..82ab18d963 100755
--- a/sysdeps/unix/sysv/linux/tst-mount-consts.py
+++ b/sysdeps/unix/sysv/linux/tst-mount-consts.py
@@ -55,7 +55,8 @@  def main():
         check('FSOPEN_.*'),
         check('FSMOUNT_.*'),
         # MOVE_MOUNT__MASK may vary depending of the kernel version.
-        check('MOVE_MOUNT_.*', 'MOVE_MOUNT__MASK'))
+        check('MOVE_MOUNT_.*', 'MOVE_MOUNT__MASK'),
+        check('OPEN_TREE_*'))
     sys.exit(status)
 
 if __name__ == '__main__':
diff --git a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
index 93dab79cdc..bd7c4ef801 100644
--- a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
@@ -2530,6 +2530,7 @@  GLIBC_2.36 fsmount F
 GLIBC_2.36 fsopen F
 GLIBC_2.36 fspick F
 GLIBC_2.36 move_mount F
+GLIBC_2.36 open_tree F
 GLIBC_2.36 pidfd_getfd F
 GLIBC_2.36 pidfd_open F
 GLIBC_2.36 pidfd_send_signal F
diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
index 24daa92e90..1c7f60b41a 100644
--- a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
@@ -2636,6 +2636,7 @@  GLIBC_2.36 fsmount F
 GLIBC_2.36 fsopen F
 GLIBC_2.36 fspick F
 GLIBC_2.36 move_mount F
+GLIBC_2.36 open_tree F
 GLIBC_2.36 pidfd_getfd F
 GLIBC_2.36 pidfd_open F
 GLIBC_2.36 pidfd_send_signal F