* Re: [PATCH v5 8/8] linux: Add mount_setattr [not found] ` <20220606134432.1944534-9-adhemerval.zanella@linaro.org> @ 2022-06-07 16:34 ` Yann Droneaud 2022-06-07 18:10 ` Christian Brauner 0 siblings, 1 reply; 2+ messages in thread From: Yann Droneaud @ 2022-06-07 16:34 UTC (permalink / raw) To: Adhemerval Zanella, Carlos O'Donell, Christian Brauner Cc: GNU C Library, linux-api 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 -- Yann Droneaud OPTEYA ^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH v5 8/8] linux: Add mount_setattr 2022-06-07 16:34 ` [PATCH v5 8/8] linux: Add mount_setattr Yann Droneaud @ 2022-06-07 18:10 ` Christian Brauner 0 siblings, 0 replies; 2+ messages in thread From: Christian Brauner @ 2022-06-07 18:10 UTC (permalink / raw) To: Yann Droneaud Cc: Adhemerval Zanella, Carlos O'Donell, linux-api, GNU C Library 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. ^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-06-07 19:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20220606134432.1944534-1-adhemerval.zanella@linaro.org>
[not found] ` <20220606134432.1944534-9-adhemerval.zanella@linaro.org>
2022-06-07 16:34 ` [PATCH v5 8/8] linux: Add mount_setattr Yann Droneaud
2022-06-07 18:10 ` Christian Brauner
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).