[v5,8/8] linux: Add mount_setattr
Checks
Context |
Check |
Description |
dj/TryBot-apply_patch |
success
|
Patch applied to master at the time it was sent
|
dj/TryBot-32bit |
success
|
Build for i686
|
Commit Message
It was added on Linux 5.12 (2a1867219c7b27f928e2545782b86daaf9ad50bd)
to allow change the properties of a mount or a mount tree using file
descriptors which the new mount api is based on.
Checked on x86_64-linux-gnu.
---
NEWS | 6 ++--
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 +
.../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 +
sysdeps/unix/sysv/linux/or1k/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/rv32/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 +
sysdeps/unix/sysv/linux/sys/mount.h | 22 ++++++++++++++
sysdeps/unix/sysv/linux/syscalls.list | 1 +
sysdeps/unix/sysv/linux/tst-mount.c | 30 +++++++++++++++++--
.../unix/sysv/linux/x86_64/64/libc.abilist | 1 +
.../unix/sysv/linux/x86_64/x32/libc.abilist | 1 +
38 files changed, 87 insertions(+), 6 deletions(-)
Comments
Le 06/06/2022 à 15:44, Adhemerval Zanella via Libc-alpha a écrit :
> It was added on Linux 5.12 (2a1867219c7b27f928e2545782b86daaf9ad50bd)
> to allow change the properties of a mount or a mount tree using file
> descriptors which the new mount api is based on.
>
> Checked on x86_64-linux-gnu.
> ---
> NEWS | 6 ++--
> 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 +
> .../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 +
> sysdeps/unix/sysv/linux/or1k/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/rv32/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 +
> sysdeps/unix/sysv/linux/sys/mount.h | 22 ++++++++++++++
> sysdeps/unix/sysv/linux/syscalls.list | 1 +
> sysdeps/unix/sysv/linux/tst-mount.c | 30 +++++++++++++++++--
> .../unix/sysv/linux/x86_64/64/libc.abilist | 1 +
> .../unix/sysv/linux/x86_64/x32/libc.abilist | 1 +
> 38 files changed, 87 insertions(+), 6 deletions(-)
>
> diff --git a/NEWS b/NEWS
> index de12657449..696de3962b 100644
> --- a/NEWS
> +++ b/NEWS
> @@ -29,9 +29,9 @@ Major new features:
> memory is carried out in the context of the caller, using the caller's
> CPU affinity, and priority with CPU usage accounted to the caller.
>
> -* On Linux, the fsopen, fsmount, move_mount, fsconfig, fspick, and open_tree
> - have been added. It is a new mount API to allow more flexibility on mount
> - operations, specially when used along namespaces.
> +* On Linux, the fsopen, fsmount, move_mount, fsconfig, fspick, open_tree,
> + and mount_setattr have been added. It is a new mount API to allow more
> + flexibility on mount operations, specially when used along 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 b70530ef40..65d2ceda2c 100644
> --- a/sysdeps/unix/sysv/linux/Versions
> +++ b/sysdeps/unix/sysv/linux/Versions
> @@ -305,6 +305,7 @@ libc {
> fsopen;
> fspick;
> move_mount;
> + mount_setattr;
> open_tree;
> pidfd_open;
> pidfd_getfd;
> diff --git a/sysdeps/unix/sysv/linux/aarch64/libc.abilist b/sysdeps/unix/sysv/linux/aarch64/libc.abilist
> index 2a666d8135..16d34b55c6 100644
> --- a/sysdeps/unix/sysv/linux/aarch64/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/aarch64/libc.abilist
> @@ -2620,6 +2620,7 @@ GLIBC_2.36 fsconfig F
> GLIBC_2.36 fsmount F
> GLIBC_2.36 fsopen F
> GLIBC_2.36 fspick F
> +GLIBC_2.36 mount_setattr F
> GLIBC_2.36 move_mount F
> GLIBC_2.36 open_tree F
> GLIBC_2.36 pidfd_getfd F
> diff --git a/sysdeps/unix/sysv/linux/alpha/libc.abilist b/sysdeps/unix/sysv/linux/alpha/libc.abilist
> index 41bd7c1959..3f794bea0f 100644
> --- a/sysdeps/unix/sysv/linux/alpha/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/alpha/libc.abilist
> @@ -2717,6 +2717,7 @@ GLIBC_2.36 fsconfig F
> GLIBC_2.36 fsmount F
> GLIBC_2.36 fsopen F
> GLIBC_2.36 fspick F
> +GLIBC_2.36 mount_setattr F
> GLIBC_2.36 move_mount F
> GLIBC_2.36 open_tree F
> GLIBC_2.36 pidfd_getfd F
> diff --git a/sysdeps/unix/sysv/linux/arc/libc.abilist b/sysdeps/unix/sysv/linux/arc/libc.abilist
> index 198fdab2f7..072627810c 100644
> --- a/sysdeps/unix/sysv/linux/arc/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/arc/libc.abilist
> @@ -2381,6 +2381,7 @@ GLIBC_2.36 fsconfig F
> GLIBC_2.36 fsmount F
> GLIBC_2.36 fsopen F
> GLIBC_2.36 fspick F
> +GLIBC_2.36 mount_setattr F
> GLIBC_2.36 move_mount F
> GLIBC_2.36 open_tree F
> GLIBC_2.36 pidfd_getfd F
> diff --git a/sysdeps/unix/sysv/linux/arm/be/libc.abilist b/sysdeps/unix/sysv/linux/arm/be/libc.abilist
> index 6fd4e75df2..dbd5f07e6e 100644
> --- a/sysdeps/unix/sysv/linux/arm/be/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/arm/be/libc.abilist
> @@ -500,6 +500,7 @@ GLIBC_2.36 fsconfig F
> GLIBC_2.36 fsmount F
> GLIBC_2.36 fsopen F
> GLIBC_2.36 fspick F
> +GLIBC_2.36 mount_setattr F
> GLIBC_2.36 move_mount F
> GLIBC_2.36 open_tree F
> GLIBC_2.36 pidfd_getfd F
> diff --git a/sysdeps/unix/sysv/linux/arm/le/libc.abilist b/sysdeps/unix/sysv/linux/arm/le/libc.abilist
> index 3ec572b50f..0f02d79faa 100644
> --- a/sysdeps/unix/sysv/linux/arm/le/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/arm/le/libc.abilist
> @@ -497,6 +497,7 @@ GLIBC_2.36 fsconfig F
> GLIBC_2.36 fsmount F
> GLIBC_2.36 fsopen F
> GLIBC_2.36 fspick F
> +GLIBC_2.36 mount_setattr F
> GLIBC_2.36 move_mount F
> GLIBC_2.36 open_tree F
> GLIBC_2.36 pidfd_getfd F
> diff --git a/sysdeps/unix/sysv/linux/csky/libc.abilist b/sysdeps/unix/sysv/linux/csky/libc.abilist
> index 94f3deb3e5..11d3b36a78 100644
> --- a/sysdeps/unix/sysv/linux/csky/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/csky/libc.abilist
> @@ -2656,6 +2656,7 @@ GLIBC_2.36 fsconfig F
> GLIBC_2.36 fsmount F
> GLIBC_2.36 fsopen F
> GLIBC_2.36 fspick F
> +GLIBC_2.36 mount_setattr F
> GLIBC_2.36 move_mount F
> GLIBC_2.36 open_tree F
> GLIBC_2.36 pidfd_getfd F
> diff --git a/sysdeps/unix/sysv/linux/hppa/libc.abilist b/sysdeps/unix/sysv/linux/hppa/libc.abilist
> index a7deaf3e26..5caa1321b1 100644
> --- a/sysdeps/unix/sysv/linux/hppa/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/hppa/libc.abilist
> @@ -2605,6 +2605,7 @@ GLIBC_2.36 fsconfig F
> GLIBC_2.36 fsmount F
> GLIBC_2.36 fsopen F
> GLIBC_2.36 fspick F
> +GLIBC_2.36 mount_setattr F
> GLIBC_2.36 move_mount F
> GLIBC_2.36 open_tree F
> GLIBC_2.36 pidfd_getfd F
> diff --git a/sysdeps/unix/sysv/linux/i386/libc.abilist b/sysdeps/unix/sysv/linux/i386/libc.abilist
> index 5f1a1bc4d0..276d7d5619 100644
> --- a/sysdeps/unix/sysv/linux/i386/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/i386/libc.abilist
> @@ -2789,6 +2789,7 @@ GLIBC_2.36 fsconfig F
> GLIBC_2.36 fsmount F
> GLIBC_2.36 fsopen F
> GLIBC_2.36 fspick F
> +GLIBC_2.36 mount_setattr F
> GLIBC_2.36 move_mount F
> GLIBC_2.36 open_tree F
> GLIBC_2.36 pidfd_getfd F
> diff --git a/sysdeps/unix/sysv/linux/ia64/libc.abilist b/sysdeps/unix/sysv/linux/ia64/libc.abilist
> index 1af8a55836..5e2249518e 100644
> --- a/sysdeps/unix/sysv/linux/ia64/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/ia64/libc.abilist
> @@ -2555,6 +2555,7 @@ GLIBC_2.36 fsconfig F
> GLIBC_2.36 fsmount F
> GLIBC_2.36 fsopen F
> GLIBC_2.36 fspick F
> +GLIBC_2.36 mount_setattr F
> GLIBC_2.36 move_mount F
> GLIBC_2.36 open_tree F
> GLIBC_2.36 pidfd_getfd F
> diff --git a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
> index ad3a4b4008..802469a5b9 100644
> --- a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
> @@ -501,6 +501,7 @@ GLIBC_2.36 fsconfig F
> GLIBC_2.36 fsmount F
> GLIBC_2.36 fsopen F
> GLIBC_2.36 fspick F
> +GLIBC_2.36 mount_setattr F
> GLIBC_2.36 move_mount F
> GLIBC_2.36 open_tree F
> GLIBC_2.36 pidfd_getfd F
> diff --git a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
> index 87e76f33a0..2f949397df 100644
> --- a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
> @@ -2732,6 +2732,7 @@ GLIBC_2.36 fsconfig F
> GLIBC_2.36 fsmount F
> GLIBC_2.36 fsopen F
> GLIBC_2.36 fspick F
> +GLIBC_2.36 mount_setattr F
> GLIBC_2.36 move_mount F
> GLIBC_2.36 open_tree F
> GLIBC_2.36 pidfd_getfd F
> diff --git a/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist b/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
> index 73df42c7aa..f63cc9cd4c 100644
> --- a/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
> @@ -2705,6 +2705,7 @@ GLIBC_2.36 fsconfig F
> GLIBC_2.36 fsmount F
> GLIBC_2.36 fsopen F
> GLIBC_2.36 fspick F
> +GLIBC_2.36 mount_setattr F
> GLIBC_2.36 move_mount F
> GLIBC_2.36 open_tree F
> GLIBC_2.36 pidfd_getfd F
> diff --git a/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist b/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
> index 5c2e936547..88d2b707f9 100644
> --- a/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
> @@ -2702,6 +2702,7 @@ GLIBC_2.36 fsconfig F
> GLIBC_2.36 fsmount F
> GLIBC_2.36 fsopen F
> GLIBC_2.36 fspick F
> +GLIBC_2.36 mount_setattr F
> GLIBC_2.36 move_mount F
> GLIBC_2.36 open_tree F
> GLIBC_2.36 pidfd_getfd F
> diff --git a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
> index 45919d27d6..6c2bc0ee78 100644
> --- a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
> @@ -2697,6 +2697,7 @@ GLIBC_2.36 fsconfig F
> GLIBC_2.36 fsmount F
> GLIBC_2.36 fsopen F
> GLIBC_2.36 fspick F
> +GLIBC_2.36 mount_setattr F
> GLIBC_2.36 move_mount F
> GLIBC_2.36 open_tree F
> GLIBC_2.36 pidfd_getfd F
> diff --git a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
> index 8321b0efac..09c9980d95 100644
> --- a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
> @@ -2695,6 +2695,7 @@ GLIBC_2.36 fsconfig F
> GLIBC_2.36 fsmount F
> GLIBC_2.36 fsopen F
> GLIBC_2.36 fspick F
> +GLIBC_2.36 mount_setattr F
> GLIBC_2.36 move_mount F
> GLIBC_2.36 open_tree F
> GLIBC_2.36 pidfd_getfd F
> diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
> index c7198646d2..763920ea8f 100644
> --- a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
> @@ -2703,6 +2703,7 @@ GLIBC_2.36 fsconfig F
> GLIBC_2.36 fsmount F
> GLIBC_2.36 fsopen F
> GLIBC_2.36 fspick F
> +GLIBC_2.36 mount_setattr F
> GLIBC_2.36 move_mount F
> GLIBC_2.36 open_tree F
> GLIBC_2.36 pidfd_getfd F
> diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
> index 8b3cca2a54..36d30558c1 100644
> --- a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
> @@ -2606,6 +2606,7 @@ GLIBC_2.36 fsconfig F
> GLIBC_2.36 fsmount F
> GLIBC_2.36 fsopen F
> GLIBC_2.36 fspick F
> +GLIBC_2.36 mount_setattr F
> GLIBC_2.36 move_mount F
> GLIBC_2.36 open_tree F
> GLIBC_2.36 pidfd_getfd F
> diff --git a/sysdeps/unix/sysv/linux/nios2/libc.abilist b/sysdeps/unix/sysv/linux/nios2/libc.abilist
> index 2f1595bb35..e4383fe464 100644
> --- a/sysdeps/unix/sysv/linux/nios2/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/nios2/libc.abilist
> @@ -2744,6 +2744,7 @@ GLIBC_2.36 fsconfig F
> GLIBC_2.36 fsmount F
> GLIBC_2.36 fsopen F
> GLIBC_2.36 fspick F
> +GLIBC_2.36 mount_setattr F
> GLIBC_2.36 move_mount F
> GLIBC_2.36 open_tree F
> GLIBC_2.36 pidfd_getfd F
> diff --git a/sysdeps/unix/sysv/linux/or1k/libc.abilist b/sysdeps/unix/sysv/linux/or1k/libc.abilist
> index d1d4e12d12..735a8eea7e 100644
> --- a/sysdeps/unix/sysv/linux/or1k/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/or1k/libc.abilist
> @@ -2127,6 +2127,7 @@ GLIBC_2.36 fsconfig F
> GLIBC_2.36 fsmount F
> GLIBC_2.36 fsopen F
> GLIBC_2.36 fspick F
> +GLIBC_2.36 mount_setattr F
> GLIBC_2.36 move_mount F
> GLIBC_2.36 open_tree F
> GLIBC_2.36 pidfd_getfd F
> diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
> index 50c9fadaf0..715dd31afe 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
> @@ -2759,6 +2759,7 @@ GLIBC_2.36 fsconfig F
> GLIBC_2.36 fsmount F
> GLIBC_2.36 fsopen F
> GLIBC_2.36 fspick F
> +GLIBC_2.36 mount_setattr F
> GLIBC_2.36 move_mount F
> GLIBC_2.36 open_tree F
> GLIBC_2.36 pidfd_getfd F
> diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
> index 8998a560cd..ac4b69e5fc 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
> @@ -2792,6 +2792,7 @@ GLIBC_2.36 fsconfig F
> GLIBC_2.36 fsmount F
> GLIBC_2.36 fsopen F
> GLIBC_2.36 fspick F
> +GLIBC_2.36 mount_setattr F
> GLIBC_2.36 move_mount F
> GLIBC_2.36 open_tree F
> GLIBC_2.36 pidfd_getfd F
> diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
> index bca46bdbe5..fd42f1bc11 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
> @@ -2514,6 +2514,7 @@ GLIBC_2.36 fsconfig F
> GLIBC_2.36 fsmount F
> GLIBC_2.36 fsopen F
> GLIBC_2.36 fspick F
> +GLIBC_2.36 mount_setattr F
> GLIBC_2.36 move_mount F
> GLIBC_2.36 open_tree F
> GLIBC_2.36 pidfd_getfd F
> diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
> index 97f6d96cd6..24688916dd 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
> @@ -2816,6 +2816,7 @@ GLIBC_2.36 fsconfig F
> GLIBC_2.36 fsmount F
> GLIBC_2.36 fsopen F
> GLIBC_2.36 fspick F
> +GLIBC_2.36 mount_setattr F
> GLIBC_2.36 move_mount F
> GLIBC_2.36 open_tree F
> GLIBC_2.36 pidfd_getfd F
> diff --git a/sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist b/sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist
> index f588745b28..536eddf9f1 100644
> --- a/sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist
> @@ -2383,6 +2383,7 @@ GLIBC_2.36 fsconfig F
> GLIBC_2.36 fsmount F
> GLIBC_2.36 fsopen F
> GLIBC_2.36 fspick F
> +GLIBC_2.36 mount_setattr F
> GLIBC_2.36 move_mount F
> GLIBC_2.36 open_tree F
> GLIBC_2.36 pidfd_getfd F
> diff --git a/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist b/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist
> index 1acf8a4c54..214b4f1c87 100644
> --- a/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist
> @@ -2583,6 +2583,7 @@ GLIBC_2.36 fsconfig F
> GLIBC_2.36 fsmount F
> GLIBC_2.36 fsopen F
> GLIBC_2.36 fspick F
> +GLIBC_2.36 mount_setattr F
> GLIBC_2.36 move_mount F
> GLIBC_2.36 open_tree F
> GLIBC_2.36 pidfd_getfd F
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
> index 7c8b410f1a..bd738a4eb8 100644
> --- a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
> @@ -2757,6 +2757,7 @@ GLIBC_2.36 fsconfig F
> GLIBC_2.36 fsmount F
> GLIBC_2.36 fsopen F
> GLIBC_2.36 fspick F
> +GLIBC_2.36 mount_setattr F
> GLIBC_2.36 move_mount F
> GLIBC_2.36 open_tree F
> GLIBC_2.36 pidfd_getfd F
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
> index ba9317ee01..170361236a 100644
> --- a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
> @@ -2551,6 +2551,7 @@ GLIBC_2.36 fsconfig F
> GLIBC_2.36 fsmount F
> GLIBC_2.36 fsopen F
> GLIBC_2.36 fspick F
> +GLIBC_2.36 mount_setattr F
> GLIBC_2.36 move_mount F
> GLIBC_2.36 open_tree F
> GLIBC_2.36 pidfd_getfd F
> diff --git a/sysdeps/unix/sysv/linux/sh/be/libc.abilist b/sysdeps/unix/sysv/linux/sh/be/libc.abilist
> index 75fa8834f1..88fcd03300 100644
> --- a/sysdeps/unix/sysv/linux/sh/be/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/sh/be/libc.abilist
> @@ -2612,6 +2612,7 @@ GLIBC_2.36 fsconfig F
> GLIBC_2.36 fsmount F
> GLIBC_2.36 fsopen F
> GLIBC_2.36 fspick F
> +GLIBC_2.36 mount_setattr F
> GLIBC_2.36 move_mount F
> GLIBC_2.36 open_tree F
> GLIBC_2.36 pidfd_getfd F
> diff --git a/sysdeps/unix/sysv/linux/sh/le/libc.abilist b/sysdeps/unix/sysv/linux/sh/le/libc.abilist
> index 4a4f8ff33f..f1115ef46d 100644
> --- a/sysdeps/unix/sysv/linux/sh/le/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/sh/le/libc.abilist
> @@ -2609,6 +2609,7 @@ GLIBC_2.36 fsconfig F
> GLIBC_2.36 fsmount F
> GLIBC_2.36 fsopen F
> GLIBC_2.36 fspick F
> +GLIBC_2.36 mount_setattr F
> GLIBC_2.36 move_mount F
> GLIBC_2.36 open_tree F
> GLIBC_2.36 pidfd_getfd F
> diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
> index d26671dba8..6063da1acf 100644
> --- a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
> @@ -2752,6 +2752,7 @@ GLIBC_2.36 fsconfig F
> GLIBC_2.36 fsmount F
> GLIBC_2.36 fsopen F
> GLIBC_2.36 fspick F
> +GLIBC_2.36 mount_setattr F
> GLIBC_2.36 move_mount F
> GLIBC_2.36 open_tree F
> GLIBC_2.36 pidfd_getfd F
> diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
> index 16c2a98ab5..780d2c0987 100644
> --- a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
> @@ -2578,6 +2578,7 @@ GLIBC_2.36 fsconfig F
> GLIBC_2.36 fsmount F
> GLIBC_2.36 fsopen F
> GLIBC_2.36 fspick F
> +GLIBC_2.36 mount_setattr F
> GLIBC_2.36 move_mount F
> GLIBC_2.36 open_tree F
> GLIBC_2.36 pidfd_getfd F
> diff --git a/sysdeps/unix/sysv/linux/sys/mount.h b/sysdeps/unix/sysv/linux/sys/mount.h
> index eb6705a091..4929d84027 100644
> --- a/sysdeps/unix/sysv/linux/sys/mount.h
> +++ b/sysdeps/unix/sysv/linux/sys/mount.h
> @@ -23,6 +23,8 @@
>
> #include <fcntl.h>
> #include <features.h>
> +#include <stdint.h>
> +#include <stddef.h>
> #include <sys/ioctl.h>
>
> #define BLOCK_SIZE 1024
> @@ -155,6 +157,17 @@ enum
> #define MOUNT_ATTR_NOSYMFOLLOW 0x00200000 /* Do not follow symlinks. */
>
>
> +/* For mount_setattr. */
> +struct mount_attr
> +{
> + uint64_t attr_set;
> + uint64_t attr_clr;
> + uint64_t propagation;
> + uint64_t userns_fd;
> +};
> +
> +#define MOUNT_ATTR_SIZE_VER0 32 /* sizeof first published struct */
> +
> /* move_mount flags. */
> #define MOVE_MOUNT_F_SYMLINKS 0x00000001 /* Follow symlinks on from path */
> #define MOVE_MOUNT_F_AUTOMOUNTS 0x00000002 /* Follow automounts on from path */
> @@ -240,6 +253,15 @@ extern int fspick (int __dfd, const char *__path, unsigned int __flags)
> extern int open_tree (int __dfd, const char *__filename, unsigned int __flags)
> __THROW;
>
> +/* Change the mount proprieties of the mount or an entire mount tree. If
mount properties
> + PATH is a relative pathname, then it is interpreted relative to the directory
> + referred to by the file descriptor dirfd. Otherwise if DFD is the special
> + value AT_FDCWD then PATH is interpreted relative to the current working
> + directory of the calling process. */
> +extern int mount_setattr (int __dfd, const char *__path, unsigned int __flags,
> + struct mount_attr *__uattr, size_t __usize)
> + __THROW;
> +
> __END_DECLS
>
> #endif /* _SYS_MOUNT_H */
> diff --git a/sysdeps/unix/sysv/linux/syscalls.list b/sysdeps/unix/sysv/linux/syscalls.list
> index e5e2b528fd..f79a519d89 100644
> --- a/sysdeps/unix/sysv/linux/syscalls.list
> +++ b/sysdeps/unix/sysv/linux/syscalls.list
> @@ -39,6 +39,7 @@ mincore - mincore i:aUV mincore
> mlock - mlock i:bU mlock
> mlockall - mlockall i:i mlockall
> mount EXTRA mount i:sssUp __mount mount
> +mount_setattr EXTRA mount_setattr i:isUpi mount_setattr
> move_mount EXTRA move_mount i:isisU move_mount
> munlock - munlock i:aU munlock
> munlockall - munlockall i: munlockall
> diff --git a/sysdeps/unix/sysv/linux/tst-mount.c b/sysdeps/unix/sysv/linux/tst-mount.c
> index 12a665f950..502d7e3433 100644
> --- a/sysdeps/unix/sysv/linux/tst-mount.c
> +++ b/sysdeps/unix/sysv/linux/tst-mount.c
> @@ -23,6 +23,9 @@
> #include <sys/wait.h>
> #include <sys/mount.h>
>
> +_Static_assert (sizeof (struct mount_attr) == MOUNT_ATTR_SIZE_VER0,
> + "sizeof (struct mount_attr) != MOUNT_ATTR_SIZE_VER0");
> +
> static void
> subprocess (void)
> {
> @@ -67,10 +70,31 @@ subprocess (void)
>
> TEST_COMPARE (open_tree (AT_FDCWD, "", 0), -1);
> TEST_COMPARE (errno, ENOENT);
> + int fd_tree = open_tree (AT_FDCWD, "/tmp",
> + OPEN_TREE_CLONE | OPEN_TREE_CLOEXEC);
> + TEST_VERIFY (fd_tree != -1);
> +
> {
> - int fd_tree = open_tree (AT_FDCWD, "/tmp",
> - OPEN_TREE_CLONE | OPEN_TREE_CLOEXEC);
> - TEST_VERIFY (fd_tree != -1);
> + struct mount_attr attr =
> + {
> + .attr_set = MOUNT_ATTR_RDONLY,
> + };
> + mount_setattr (fd_tree, "", AT_EMPTY_PATH, &attr,
> + sizeof (attr));
> + int r = mount_setattr (fd_tree, "", AT_EMPTY_PATH, &attr,
> + sizeof (attr));
> + /* New mount API was added on 5.1, but mount_setattr on 5.12. */
> + if (r == -1)
> + TEST_COMPARE (errno, ENOSYS);
> + else
> + {
> + TEST_COMPARE (mount_setattr (-1, "", AT_EMPTY_PATH, &attr,
> + sizeof (attr)), -1);
> + TEST_COMPARE (errno, EBADF);
> + TEST_COMPARE (mount_setattr (fd_tree, "", AT_EMPTY_PATH, &attr,
> + sizeof (attr) - 8), -1);
> + TEST_COMPARE (errno, EINVAL);
> + }
> }
>
> _exit (0);
> diff --git a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
> index bd7c4ef801..56cad609fe 100644
> --- a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
> @@ -2529,6 +2529,7 @@ GLIBC_2.36 fsconfig F
> GLIBC_2.36 fsmount F
> GLIBC_2.36 fsopen F
> GLIBC_2.36 fspick F
> +GLIBC_2.36 mount_setattr F
> GLIBC_2.36 move_mount F
> GLIBC_2.36 open_tree F
> GLIBC_2.36 pidfd_getfd F
> diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
> index 1c7f60b41a..2ed242a62d 100644
> --- a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
> @@ -2635,6 +2635,7 @@ GLIBC_2.36 fsconfig F
> GLIBC_2.36 fsmount F
> GLIBC_2.36 fsopen F
> GLIBC_2.36 fspick F
> +GLIBC_2.36 mount_setattr F
> GLIBC_2.36 move_mount F
> GLIBC_2.36 open_tree F
> GLIBC_2.36 pidfd_getfd F
Hi,
Le 06/06/2022 à 15:44, Adhemerval Zanella via Libc-alpha a écrit :
> It was added on Linux 5.12 (2a1867219c7b27f928e2545782b86daaf9ad50bd)
> to allow change the properties of a mount or a mount tree using file
> descriptors which the new mount api is based on.
>
> Checked on x86_64-linux-gnu.
> ---
> NEWS | 6 ++--
> 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 +
> .../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 +
> sysdeps/unix/sysv/linux/or1k/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/rv32/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 +
> sysdeps/unix/sysv/linux/sys/mount.h | 22 ++++++++++++++
> sysdeps/unix/sysv/linux/syscalls.list | 1 +
> sysdeps/unix/sysv/linux/tst-mount.c | 30 +++++++++++++++++--
> .../unix/sysv/linux/x86_64/64/libc.abilist | 1 +
> .../unix/sysv/linux/x86_64/x32/libc.abilist | 1 +
> 38 files changed, 87 insertions(+), 6 deletions(-)
>
> diff --git a/NEWS b/NEWS
> index de12657449..696de3962b 100644
> --- a/NEWS
> +++ b/NEWS
> @@ -29,9 +29,9 @@ Major new features:
> memory is carried out in the context of the caller, using the caller's
> CPU affinity, and priority with CPU usage accounted to the caller.
>
> -* On Linux, the fsopen, fsmount, move_mount, fsconfig, fspick, and open_tree
> - have been added. It is a new mount API to allow more flexibility on mount
> - operations, specially when used along namespaces.
> +* On Linux, the fsopen, fsmount, move_mount, fsconfig, fspick, open_tree,
> + and mount_setattr have been added. It is a new mount API to allow more
> + flexibility on mount operations, specially when used along 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 b70530ef40..65d2ceda2c 100644
> --- a/sysdeps/unix/sysv/linux/Versions
> +++ b/sysdeps/unix/sysv/linux/Versions
> @@ -305,6 +305,7 @@ libc {
> fsopen;
> fspick;
> move_mount;
> + mount_setattr;
> open_tree;
> pidfd_open;
> pidfd_getfd;
> diff --git a/sysdeps/unix/sysv/linux/sys/mount.h b/sysdeps/unix/sysv/linux/sys/mount.h
> index eb6705a091..4929d84027 100644
> --- a/sysdeps/unix/sysv/linux/sys/mount.h
> +++ b/sysdeps/unix/sysv/linux/sys/mount.h
> @@ -23,6 +23,8 @@
>
> #include <fcntl.h>
> #include <features.h>
> +#include <stdint.h>
> +#include <stddef.h>
> #include <sys/ioctl.h>
>
> #define BLOCK_SIZE 1024
> @@ -155,6 +157,17 @@ enum
> #define MOUNT_ATTR_NOSYMFOLLOW 0x00200000 /* Do not follow symlinks. */
>
>
> +/* For mount_setattr. */
> +struct mount_attr
> +{
> + uint64_t attr_set;
> + uint64_t attr_clr;
> + uint64_t propagation;
> + uint64_t userns_fd;
> +};
> +
> +#define MOUNT_ATTR_SIZE_VER0 32 /* sizeof first published struct */
> +
> /* move_mount flags. */
> #define MOVE_MOUNT_F_SYMLINKS 0x00000001 /* Follow symlinks on from path */
> #define MOVE_MOUNT_F_AUTOMOUNTS 0x00000002 /* Follow automounts on from path */
> @@ -240,6 +253,15 @@ extern int fspick (int __dfd, const char *__path, unsigned int __flags)
> extern int open_tree (int __dfd, const char *__filename, unsigned int __flags)
> __THROW;
>
> +/* Change the mount proprieties of the mount or an entire mount tree. If
> + PATH is a relative pathname, then it is interpreted relative to the directory
> + referred to by the file descriptor dirfd. Otherwise if DFD is the special
> + value AT_FDCWD then PATH is interpreted relative to the current working
> + directory of the calling process. */
> +extern int mount_setattr (int __dfd, const char *__path, unsigned int __flags,
> + struct mount_attr *__uattr, size_t __usize)
> + __THROW;
> +
I wonder why __uattr is not declared const struct mount_attr * ?
Is it really expected that future mount_setattr() extensions to write
back into the userspace structure ?
> __END_DECLS
>
> #endif /* _SYS_MOUNT_H */
> diff --git a/sysdeps/unix/sysv/linux/syscalls.list b/sysdeps/unix/sysv/linux/syscalls.list
> index e5e2b528fd..f79a519d89 100644
> --- a/sysdeps/unix/sysv/linux/syscalls.list
> +++ b/sysdeps/unix/sysv/linux/syscalls.list
> @@ -39,6 +39,7 @@ mincore - mincore i:aUV mincore
> mlock - mlock i:bU mlock
> mlockall - mlockall i:i mlockall
> mount EXTRA mount i:sssUp __mount mount
> +mount_setattr EXTRA mount_setattr i:isUpi mount_setattr
> move_mount EXTRA move_mount i:isisU move_mount
> munlock - munlock i:aU munlock
> munlockall - munlockall i: munlockall
Regards
On Tue, Jun 07, 2022 at 06:34:46PM +0200, Yann Droneaud wrote:
> Hi,
>
> Le 06/06/2022 à 15:44, Adhemerval Zanella via Libc-alpha a écrit :
> > It was added on Linux 5.12 (2a1867219c7b27f928e2545782b86daaf9ad50bd)
> > to allow change the properties of a mount or a mount tree using file
> > descriptors which the new mount api is based on.
> >
> > Checked on x86_64-linux-gnu.
> > ---
> > NEWS | 6 ++--
> > 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 +
> > .../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 +
> > sysdeps/unix/sysv/linux/or1k/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/rv32/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 +
> > sysdeps/unix/sysv/linux/sys/mount.h | 22 ++++++++++++++
> > sysdeps/unix/sysv/linux/syscalls.list | 1 +
> > sysdeps/unix/sysv/linux/tst-mount.c | 30 +++++++++++++++++--
> > .../unix/sysv/linux/x86_64/64/libc.abilist | 1 +
> > .../unix/sysv/linux/x86_64/x32/libc.abilist | 1 +
> > 38 files changed, 87 insertions(+), 6 deletions(-)
> >
> > diff --git a/NEWS b/NEWS
> > index de12657449..696de3962b 100644
> > --- a/NEWS
> > +++ b/NEWS
> > @@ -29,9 +29,9 @@ Major new features:
> > memory is carried out in the context of the caller, using the caller's
> > CPU affinity, and priority with CPU usage accounted to the caller.
> > -* On Linux, the fsopen, fsmount, move_mount, fsconfig, fspick, and open_tree
> > - have been added. It is a new mount API to allow more flexibility on mount
> > - operations, specially when used along namespaces.
> > +* On Linux, the fsopen, fsmount, move_mount, fsconfig, fspick, open_tree,
> > + and mount_setattr have been added. It is a new mount API to allow more
> > + flexibility on mount operations, specially when used along 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 b70530ef40..65d2ceda2c 100644
> > --- a/sysdeps/unix/sysv/linux/Versions
> > +++ b/sysdeps/unix/sysv/linux/Versions
> > @@ -305,6 +305,7 @@ libc {
> > fsopen;
> > fspick;
> > move_mount;
> > + mount_setattr;
> > open_tree;
> > pidfd_open;
> > pidfd_getfd;
>
> > diff --git a/sysdeps/unix/sysv/linux/sys/mount.h b/sysdeps/unix/sysv/linux/sys/mount.h
> > index eb6705a091..4929d84027 100644
> > --- a/sysdeps/unix/sysv/linux/sys/mount.h
> > +++ b/sysdeps/unix/sysv/linux/sys/mount.h
> > @@ -23,6 +23,8 @@
> > #include <fcntl.h>
> > #include <features.h>
> > +#include <stdint.h>
> > +#include <stddef.h>
> > #include <sys/ioctl.h>
> > #define BLOCK_SIZE 1024
> > @@ -155,6 +157,17 @@ enum
> > #define MOUNT_ATTR_NOSYMFOLLOW 0x00200000 /* Do not follow symlinks. */
> > +/* For mount_setattr. */
> > +struct mount_attr
> > +{
> > + uint64_t attr_set;
> > + uint64_t attr_clr;
> > + uint64_t propagation;
> > + uint64_t userns_fd;
> > +};
> > +
> > +#define MOUNT_ATTR_SIZE_VER0 32 /* sizeof first published struct */
> > +
> > /* move_mount flags. */
> > #define MOVE_MOUNT_F_SYMLINKS 0x00000001 /* Follow symlinks on from path */
> > #define MOVE_MOUNT_F_AUTOMOUNTS 0x00000002 /* Follow automounts on from path */
> > @@ -240,6 +253,15 @@ extern int fspick (int __dfd, const char *__path, unsigned int __flags)
> > extern int open_tree (int __dfd, const char *__filename, unsigned int __flags)
> > __THROW;
> > +/* Change the mount proprieties of the mount or an entire mount tree. If
> > + PATH is a relative pathname, then it is interpreted relative to the directory
> > + referred to by the file descriptor dirfd. Otherwise if DFD is the special
> > + value AT_FDCWD then PATH is interpreted relative to the current working
> > + directory of the calling process. */
> > +extern int mount_setattr (int __dfd, const char *__path, unsigned int __flags,
> > + struct mount_attr *__uattr, size_t __usize)
> > + __THROW;
> > +
>
>
> I wonder why __uattr is not declared const struct mount_attr * ?
>
> Is it really expected that future mount_setattr() extensions to write back
> into the userspace structure ?
I don't think we can in principle rule this out. A const is a bit of a
scary commitment in this regard... I need to think about this a bit.
On 07/06/2022 13:27, Yann Droneaud wrote:
>> +#define MOUNT_ATTR_SIZE_VER0 32 /* sizeof first published struct */
>> +
>> /* move_mount flags. */
>> #define MOVE_MOUNT_F_SYMLINKS 0x00000001 /* Follow symlinks on from path */
>> #define MOVE_MOUNT_F_AUTOMOUNTS 0x00000002 /* Follow automounts on from path */
>> @@ -240,6 +253,15 @@ extern int fspick (int __dfd, const char *__path, unsigned int __flags)
>> extern int open_tree (int __dfd, const char *__filename, unsigned int __flags)
>> __THROW;
>> +/* Change the mount proprieties of the mount or an entire mount tree. If
>
>
> mount properties
>
Ack.
@@ -29,9 +29,9 @@ Major new features:
memory is carried out in the context of the caller, using the caller's
CPU affinity, and priority with CPU usage accounted to the caller.
-* On Linux, the fsopen, fsmount, move_mount, fsconfig, fspick, and open_tree
- have been added. It is a new mount API to allow more flexibility on mount
- operations, specially when used along namespaces.
+* On Linux, the fsopen, fsmount, move_mount, fsconfig, fspick, open_tree,
+ and mount_setattr have been added. It is a new mount API to allow more
+ flexibility on mount operations, specially when used along namespaces.
Deprecated and removed features, and other changes affecting compatibility:
@@ -305,6 +305,7 @@ libc {
fsopen;
fspick;
move_mount;
+ mount_setattr;
open_tree;
pidfd_open;
pidfd_getfd;
@@ -2620,6 +2620,7 @@ GLIBC_2.36 fsconfig F
GLIBC_2.36 fsmount F
GLIBC_2.36 fsopen F
GLIBC_2.36 fspick F
+GLIBC_2.36 mount_setattr F
GLIBC_2.36 move_mount F
GLIBC_2.36 open_tree F
GLIBC_2.36 pidfd_getfd F
@@ -2717,6 +2717,7 @@ GLIBC_2.36 fsconfig F
GLIBC_2.36 fsmount F
GLIBC_2.36 fsopen F
GLIBC_2.36 fspick F
+GLIBC_2.36 mount_setattr F
GLIBC_2.36 move_mount F
GLIBC_2.36 open_tree F
GLIBC_2.36 pidfd_getfd F
@@ -2381,6 +2381,7 @@ GLIBC_2.36 fsconfig F
GLIBC_2.36 fsmount F
GLIBC_2.36 fsopen F
GLIBC_2.36 fspick F
+GLIBC_2.36 mount_setattr F
GLIBC_2.36 move_mount F
GLIBC_2.36 open_tree F
GLIBC_2.36 pidfd_getfd F
@@ -500,6 +500,7 @@ GLIBC_2.36 fsconfig F
GLIBC_2.36 fsmount F
GLIBC_2.36 fsopen F
GLIBC_2.36 fspick F
+GLIBC_2.36 mount_setattr F
GLIBC_2.36 move_mount F
GLIBC_2.36 open_tree F
GLIBC_2.36 pidfd_getfd F
@@ -497,6 +497,7 @@ GLIBC_2.36 fsconfig F
GLIBC_2.36 fsmount F
GLIBC_2.36 fsopen F
GLIBC_2.36 fspick F
+GLIBC_2.36 mount_setattr F
GLIBC_2.36 move_mount F
GLIBC_2.36 open_tree F
GLIBC_2.36 pidfd_getfd F
@@ -2656,6 +2656,7 @@ GLIBC_2.36 fsconfig F
GLIBC_2.36 fsmount F
GLIBC_2.36 fsopen F
GLIBC_2.36 fspick F
+GLIBC_2.36 mount_setattr F
GLIBC_2.36 move_mount F
GLIBC_2.36 open_tree F
GLIBC_2.36 pidfd_getfd F
@@ -2605,6 +2605,7 @@ GLIBC_2.36 fsconfig F
GLIBC_2.36 fsmount F
GLIBC_2.36 fsopen F
GLIBC_2.36 fspick F
+GLIBC_2.36 mount_setattr F
GLIBC_2.36 move_mount F
GLIBC_2.36 open_tree F
GLIBC_2.36 pidfd_getfd F
@@ -2789,6 +2789,7 @@ GLIBC_2.36 fsconfig F
GLIBC_2.36 fsmount F
GLIBC_2.36 fsopen F
GLIBC_2.36 fspick F
+GLIBC_2.36 mount_setattr F
GLIBC_2.36 move_mount F
GLIBC_2.36 open_tree F
GLIBC_2.36 pidfd_getfd F
@@ -2555,6 +2555,7 @@ GLIBC_2.36 fsconfig F
GLIBC_2.36 fsmount F
GLIBC_2.36 fsopen F
GLIBC_2.36 fspick F
+GLIBC_2.36 mount_setattr F
GLIBC_2.36 move_mount F
GLIBC_2.36 open_tree F
GLIBC_2.36 pidfd_getfd F
@@ -501,6 +501,7 @@ GLIBC_2.36 fsconfig F
GLIBC_2.36 fsmount F
GLIBC_2.36 fsopen F
GLIBC_2.36 fspick F
+GLIBC_2.36 mount_setattr F
GLIBC_2.36 move_mount F
GLIBC_2.36 open_tree F
GLIBC_2.36 pidfd_getfd F
@@ -2732,6 +2732,7 @@ GLIBC_2.36 fsconfig F
GLIBC_2.36 fsmount F
GLIBC_2.36 fsopen F
GLIBC_2.36 fspick F
+GLIBC_2.36 mount_setattr F
GLIBC_2.36 move_mount F
GLIBC_2.36 open_tree F
GLIBC_2.36 pidfd_getfd F
@@ -2705,6 +2705,7 @@ GLIBC_2.36 fsconfig F
GLIBC_2.36 fsmount F
GLIBC_2.36 fsopen F
GLIBC_2.36 fspick F
+GLIBC_2.36 mount_setattr F
GLIBC_2.36 move_mount F
GLIBC_2.36 open_tree F
GLIBC_2.36 pidfd_getfd F
@@ -2702,6 +2702,7 @@ GLIBC_2.36 fsconfig F
GLIBC_2.36 fsmount F
GLIBC_2.36 fsopen F
GLIBC_2.36 fspick F
+GLIBC_2.36 mount_setattr F
GLIBC_2.36 move_mount F
GLIBC_2.36 open_tree F
GLIBC_2.36 pidfd_getfd F
@@ -2697,6 +2697,7 @@ GLIBC_2.36 fsconfig F
GLIBC_2.36 fsmount F
GLIBC_2.36 fsopen F
GLIBC_2.36 fspick F
+GLIBC_2.36 mount_setattr F
GLIBC_2.36 move_mount F
GLIBC_2.36 open_tree F
GLIBC_2.36 pidfd_getfd F
@@ -2695,6 +2695,7 @@ GLIBC_2.36 fsconfig F
GLIBC_2.36 fsmount F
GLIBC_2.36 fsopen F
GLIBC_2.36 fspick F
+GLIBC_2.36 mount_setattr F
GLIBC_2.36 move_mount F
GLIBC_2.36 open_tree F
GLIBC_2.36 pidfd_getfd F
@@ -2703,6 +2703,7 @@ GLIBC_2.36 fsconfig F
GLIBC_2.36 fsmount F
GLIBC_2.36 fsopen F
GLIBC_2.36 fspick F
+GLIBC_2.36 mount_setattr F
GLIBC_2.36 move_mount F
GLIBC_2.36 open_tree F
GLIBC_2.36 pidfd_getfd F
@@ -2606,6 +2606,7 @@ GLIBC_2.36 fsconfig F
GLIBC_2.36 fsmount F
GLIBC_2.36 fsopen F
GLIBC_2.36 fspick F
+GLIBC_2.36 mount_setattr F
GLIBC_2.36 move_mount F
GLIBC_2.36 open_tree F
GLIBC_2.36 pidfd_getfd F
@@ -2744,6 +2744,7 @@ GLIBC_2.36 fsconfig F
GLIBC_2.36 fsmount F
GLIBC_2.36 fsopen F
GLIBC_2.36 fspick F
+GLIBC_2.36 mount_setattr F
GLIBC_2.36 move_mount F
GLIBC_2.36 open_tree F
GLIBC_2.36 pidfd_getfd F
@@ -2127,6 +2127,7 @@ GLIBC_2.36 fsconfig F
GLIBC_2.36 fsmount F
GLIBC_2.36 fsopen F
GLIBC_2.36 fspick F
+GLIBC_2.36 mount_setattr F
GLIBC_2.36 move_mount F
GLIBC_2.36 open_tree F
GLIBC_2.36 pidfd_getfd F
@@ -2759,6 +2759,7 @@ GLIBC_2.36 fsconfig F
GLIBC_2.36 fsmount F
GLIBC_2.36 fsopen F
GLIBC_2.36 fspick F
+GLIBC_2.36 mount_setattr F
GLIBC_2.36 move_mount F
GLIBC_2.36 open_tree F
GLIBC_2.36 pidfd_getfd F
@@ -2792,6 +2792,7 @@ GLIBC_2.36 fsconfig F
GLIBC_2.36 fsmount F
GLIBC_2.36 fsopen F
GLIBC_2.36 fspick F
+GLIBC_2.36 mount_setattr F
GLIBC_2.36 move_mount F
GLIBC_2.36 open_tree F
GLIBC_2.36 pidfd_getfd F
@@ -2514,6 +2514,7 @@ GLIBC_2.36 fsconfig F
GLIBC_2.36 fsmount F
GLIBC_2.36 fsopen F
GLIBC_2.36 fspick F
+GLIBC_2.36 mount_setattr F
GLIBC_2.36 move_mount F
GLIBC_2.36 open_tree F
GLIBC_2.36 pidfd_getfd F
@@ -2816,6 +2816,7 @@ GLIBC_2.36 fsconfig F
GLIBC_2.36 fsmount F
GLIBC_2.36 fsopen F
GLIBC_2.36 fspick F
+GLIBC_2.36 mount_setattr F
GLIBC_2.36 move_mount F
GLIBC_2.36 open_tree F
GLIBC_2.36 pidfd_getfd F
@@ -2383,6 +2383,7 @@ GLIBC_2.36 fsconfig F
GLIBC_2.36 fsmount F
GLIBC_2.36 fsopen F
GLIBC_2.36 fspick F
+GLIBC_2.36 mount_setattr F
GLIBC_2.36 move_mount F
GLIBC_2.36 open_tree F
GLIBC_2.36 pidfd_getfd F
@@ -2583,6 +2583,7 @@ GLIBC_2.36 fsconfig F
GLIBC_2.36 fsmount F
GLIBC_2.36 fsopen F
GLIBC_2.36 fspick F
+GLIBC_2.36 mount_setattr F
GLIBC_2.36 move_mount F
GLIBC_2.36 open_tree F
GLIBC_2.36 pidfd_getfd F
@@ -2757,6 +2757,7 @@ GLIBC_2.36 fsconfig F
GLIBC_2.36 fsmount F
GLIBC_2.36 fsopen F
GLIBC_2.36 fspick F
+GLIBC_2.36 mount_setattr F
GLIBC_2.36 move_mount F
GLIBC_2.36 open_tree F
GLIBC_2.36 pidfd_getfd F
@@ -2551,6 +2551,7 @@ GLIBC_2.36 fsconfig F
GLIBC_2.36 fsmount F
GLIBC_2.36 fsopen F
GLIBC_2.36 fspick F
+GLIBC_2.36 mount_setattr F
GLIBC_2.36 move_mount F
GLIBC_2.36 open_tree F
GLIBC_2.36 pidfd_getfd F
@@ -2612,6 +2612,7 @@ GLIBC_2.36 fsconfig F
GLIBC_2.36 fsmount F
GLIBC_2.36 fsopen F
GLIBC_2.36 fspick F
+GLIBC_2.36 mount_setattr F
GLIBC_2.36 move_mount F
GLIBC_2.36 open_tree F
GLIBC_2.36 pidfd_getfd F
@@ -2609,6 +2609,7 @@ GLIBC_2.36 fsconfig F
GLIBC_2.36 fsmount F
GLIBC_2.36 fsopen F
GLIBC_2.36 fspick F
+GLIBC_2.36 mount_setattr F
GLIBC_2.36 move_mount F
GLIBC_2.36 open_tree F
GLIBC_2.36 pidfd_getfd F
@@ -2752,6 +2752,7 @@ GLIBC_2.36 fsconfig F
GLIBC_2.36 fsmount F
GLIBC_2.36 fsopen F
GLIBC_2.36 fspick F
+GLIBC_2.36 mount_setattr F
GLIBC_2.36 move_mount F
GLIBC_2.36 open_tree F
GLIBC_2.36 pidfd_getfd F
@@ -2578,6 +2578,7 @@ GLIBC_2.36 fsconfig F
GLIBC_2.36 fsmount F
GLIBC_2.36 fsopen F
GLIBC_2.36 fspick F
+GLIBC_2.36 mount_setattr F
GLIBC_2.36 move_mount F
GLIBC_2.36 open_tree F
GLIBC_2.36 pidfd_getfd F
@@ -23,6 +23,8 @@
#include <fcntl.h>
#include <features.h>
+#include <stdint.h>
+#include <stddef.h>
#include <sys/ioctl.h>
#define BLOCK_SIZE 1024
@@ -155,6 +157,17 @@ enum
#define MOUNT_ATTR_NOSYMFOLLOW 0x00200000 /* Do not follow symlinks. */
+/* For mount_setattr. */
+struct mount_attr
+{
+ uint64_t attr_set;
+ uint64_t attr_clr;
+ uint64_t propagation;
+ uint64_t userns_fd;
+};
+
+#define MOUNT_ATTR_SIZE_VER0 32 /* sizeof first published struct */
+
/* move_mount flags. */
#define MOVE_MOUNT_F_SYMLINKS 0x00000001 /* Follow symlinks on from path */
#define MOVE_MOUNT_F_AUTOMOUNTS 0x00000002 /* Follow automounts on from path */
@@ -240,6 +253,15 @@ extern int fspick (int __dfd, const char *__path, unsigned int __flags)
extern int open_tree (int __dfd, const char *__filename, unsigned int __flags)
__THROW;
+/* Change the mount proprieties of the mount or an entire mount tree. If
+ PATH is a relative pathname, then it is interpreted relative to the directory
+ referred to by the file descriptor dirfd. Otherwise if DFD is the special
+ value AT_FDCWD then PATH is interpreted relative to the current working
+ directory of the calling process. */
+extern int mount_setattr (int __dfd, const char *__path, unsigned int __flags,
+ struct mount_attr *__uattr, size_t __usize)
+ __THROW;
+
__END_DECLS
#endif /* _SYS_MOUNT_H */
@@ -39,6 +39,7 @@ mincore - mincore i:aUV mincore
mlock - mlock i:bU mlock
mlockall - mlockall i:i mlockall
mount EXTRA mount i:sssUp __mount mount
+mount_setattr EXTRA mount_setattr i:isUpi mount_setattr
move_mount EXTRA move_mount i:isisU move_mount
munlock - munlock i:aU munlock
munlockall - munlockall i: munlockall
@@ -23,6 +23,9 @@
#include <sys/wait.h>
#include <sys/mount.h>
+_Static_assert (sizeof (struct mount_attr) == MOUNT_ATTR_SIZE_VER0,
+ "sizeof (struct mount_attr) != MOUNT_ATTR_SIZE_VER0");
+
static void
subprocess (void)
{
@@ -67,10 +70,31 @@ subprocess (void)
TEST_COMPARE (open_tree (AT_FDCWD, "", 0), -1);
TEST_COMPARE (errno, ENOENT);
+ int fd_tree = open_tree (AT_FDCWD, "/tmp",
+ OPEN_TREE_CLONE | OPEN_TREE_CLOEXEC);
+ TEST_VERIFY (fd_tree != -1);
+
{
- int fd_tree = open_tree (AT_FDCWD, "/tmp",
- OPEN_TREE_CLONE | OPEN_TREE_CLOEXEC);
- TEST_VERIFY (fd_tree != -1);
+ struct mount_attr attr =
+ {
+ .attr_set = MOUNT_ATTR_RDONLY,
+ };
+ mount_setattr (fd_tree, "", AT_EMPTY_PATH, &attr,
+ sizeof (attr));
+ int r = mount_setattr (fd_tree, "", AT_EMPTY_PATH, &attr,
+ sizeof (attr));
+ /* New mount API was added on 5.1, but mount_setattr on 5.12. */
+ if (r == -1)
+ TEST_COMPARE (errno, ENOSYS);
+ else
+ {
+ TEST_COMPARE (mount_setattr (-1, "", AT_EMPTY_PATH, &attr,
+ sizeof (attr)), -1);
+ TEST_COMPARE (errno, EBADF);
+ TEST_COMPARE (mount_setattr (fd_tree, "", AT_EMPTY_PATH, &attr,
+ sizeof (attr) - 8), -1);
+ TEST_COMPARE (errno, EINVAL);
+ }
}
_exit (0);
@@ -2529,6 +2529,7 @@ GLIBC_2.36 fsconfig F
GLIBC_2.36 fsmount F
GLIBC_2.36 fsopen F
GLIBC_2.36 fspick F
+GLIBC_2.36 mount_setattr F
GLIBC_2.36 move_mount F
GLIBC_2.36 open_tree F
GLIBC_2.36 pidfd_getfd F
@@ -2635,6 +2635,7 @@ GLIBC_2.36 fsconfig F
GLIBC_2.36 fsmount F
GLIBC_2.36 fsopen F
GLIBC_2.36 fspick F
+GLIBC_2.36 mount_setattr F
GLIBC_2.36 move_mount F
GLIBC_2.36 open_tree F
GLIBC_2.36 pidfd_getfd F