linux: Add move_mount

It was added on Linux 5.2 (2db154b3ea8e14b04fee23e3fdfd5e9d17fbc6ae)
as way t move a mount from one place to another and, in the next
commit, allow to attach an unattached mount tree.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
This commit is contained in:
Adhemerval Zanella 2022-01-31 10:04:57 -03:00
parent b4deb7beb8
commit 5b41b2659d
38 changed files with 59 additions and 5 deletions

8
NEWS
View file

@ -41,10 +41,10 @@ Major new features:
have adverse impact. It is incompatible with EDNS0 usage and DNSSEC
validation by applications.
* On Linux, the fsopen and fsmount 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, and move_mount 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:

View file

@ -302,6 +302,7 @@ libc {
GLIBC_2.36 {
fsmount;
fsopen;
move_mount;
pidfd_open;
pidfd_getfd;
pidfd_send_signal;

View file

@ -2618,6 +2618,7 @@ GLIBC_2.35 epoll_pwait2 F
GLIBC_2.35 posix_spawn_file_actions_addtcsetpgrp_np F
GLIBC_2.36 fsmount F
GLIBC_2.36 fsopen F
GLIBC_2.36 move_mount F
GLIBC_2.36 pidfd_getfd F
GLIBC_2.36 pidfd_open F
GLIBC_2.36 pidfd_send_signal F

View file

@ -2715,6 +2715,7 @@ GLIBC_2.35 epoll_pwait2 F
GLIBC_2.35 posix_spawn_file_actions_addtcsetpgrp_np F
GLIBC_2.36 fsmount F
GLIBC_2.36 fsopen F
GLIBC_2.36 move_mount F
GLIBC_2.36 pidfd_getfd F
GLIBC_2.36 pidfd_open F
GLIBC_2.36 pidfd_send_signal F

View file

@ -2379,6 +2379,7 @@ GLIBC_2.35 epoll_pwait2 F
GLIBC_2.35 posix_spawn_file_actions_addtcsetpgrp_np F
GLIBC_2.36 fsmount F
GLIBC_2.36 fsopen F
GLIBC_2.36 move_mount F
GLIBC_2.36 pidfd_getfd F
GLIBC_2.36 pidfd_open F
GLIBC_2.36 pidfd_send_signal F

View file

@ -498,6 +498,7 @@ GLIBC_2.35 epoll_pwait2 F
GLIBC_2.35 posix_spawn_file_actions_addtcsetpgrp_np F
GLIBC_2.36 fsmount F
GLIBC_2.36 fsopen F
GLIBC_2.36 move_mount F
GLIBC_2.36 pidfd_getfd F
GLIBC_2.36 pidfd_open F
GLIBC_2.36 pidfd_send_signal F

View file

@ -495,6 +495,7 @@ GLIBC_2.35 epoll_pwait2 F
GLIBC_2.35 posix_spawn_file_actions_addtcsetpgrp_np F
GLIBC_2.36 fsmount F
GLIBC_2.36 fsopen F
GLIBC_2.36 move_mount F
GLIBC_2.36 pidfd_getfd F
GLIBC_2.36 pidfd_open F
GLIBC_2.36 pidfd_send_signal F

View file

@ -2654,6 +2654,7 @@ GLIBC_2.35 epoll_pwait2 F
GLIBC_2.35 posix_spawn_file_actions_addtcsetpgrp_np F
GLIBC_2.36 fsmount F
GLIBC_2.36 fsopen F
GLIBC_2.36 move_mount F
GLIBC_2.36 pidfd_getfd F
GLIBC_2.36 pidfd_open F
GLIBC_2.36 pidfd_send_signal F

View file

@ -2603,6 +2603,7 @@ GLIBC_2.35 epoll_pwait2 F
GLIBC_2.35 posix_spawn_file_actions_addtcsetpgrp_np F
GLIBC_2.36 fsmount F
GLIBC_2.36 fsopen F
GLIBC_2.36 move_mount F
GLIBC_2.36 pidfd_getfd F
GLIBC_2.36 pidfd_open F
GLIBC_2.36 pidfd_send_signal F

View file

@ -2787,6 +2787,7 @@ GLIBC_2.35 epoll_pwait2 F
GLIBC_2.35 posix_spawn_file_actions_addtcsetpgrp_np F
GLIBC_2.36 fsmount F
GLIBC_2.36 fsopen F
GLIBC_2.36 move_mount F
GLIBC_2.36 pidfd_getfd F
GLIBC_2.36 pidfd_open F
GLIBC_2.36 pidfd_send_signal F

View file

@ -2553,6 +2553,7 @@ GLIBC_2.35 epoll_pwait2 F
GLIBC_2.35 posix_spawn_file_actions_addtcsetpgrp_np F
GLIBC_2.36 fsmount F
GLIBC_2.36 fsopen F
GLIBC_2.36 move_mount F
GLIBC_2.36 pidfd_getfd F
GLIBC_2.36 pidfd_open F
GLIBC_2.36 pidfd_send_signal F

View file

@ -499,6 +499,7 @@ GLIBC_2.35 epoll_pwait2 F
GLIBC_2.35 posix_spawn_file_actions_addtcsetpgrp_np F
GLIBC_2.36 fsmount F
GLIBC_2.36 fsopen F
GLIBC_2.36 move_mount F
GLIBC_2.36 pidfd_getfd F
GLIBC_2.36 pidfd_open F
GLIBC_2.36 pidfd_send_signal F

View file

@ -2730,6 +2730,7 @@ GLIBC_2.35 epoll_pwait2 F
GLIBC_2.35 posix_spawn_file_actions_addtcsetpgrp_np F
GLIBC_2.36 fsmount F
GLIBC_2.36 fsopen F
GLIBC_2.36 move_mount F
GLIBC_2.36 pidfd_getfd F
GLIBC_2.36 pidfd_open F
GLIBC_2.36 pidfd_send_signal F

View file

@ -2703,6 +2703,7 @@ GLIBC_2.35 epoll_pwait2 F
GLIBC_2.35 posix_spawn_file_actions_addtcsetpgrp_np F
GLIBC_2.36 fsmount F
GLIBC_2.36 fsopen F
GLIBC_2.36 move_mount F
GLIBC_2.36 pidfd_getfd F
GLIBC_2.36 pidfd_open F
GLIBC_2.36 pidfd_send_signal F

View file

@ -2700,6 +2700,7 @@ GLIBC_2.35 epoll_pwait2 F
GLIBC_2.35 posix_spawn_file_actions_addtcsetpgrp_np F
GLIBC_2.36 fsmount F
GLIBC_2.36 fsopen F
GLIBC_2.36 move_mount F
GLIBC_2.36 pidfd_getfd F
GLIBC_2.36 pidfd_open F
GLIBC_2.36 pidfd_send_signal F

View file

@ -2695,6 +2695,7 @@ GLIBC_2.35 epoll_pwait2 F
GLIBC_2.35 posix_spawn_file_actions_addtcsetpgrp_np F
GLIBC_2.36 fsmount F
GLIBC_2.36 fsopen F
GLIBC_2.36 move_mount F
GLIBC_2.36 pidfd_getfd F
GLIBC_2.36 pidfd_open F
GLIBC_2.36 pidfd_send_signal F

View file

@ -2693,6 +2693,7 @@ GLIBC_2.35 epoll_pwait2 F
GLIBC_2.35 posix_spawn_file_actions_addtcsetpgrp_np F
GLIBC_2.36 fsmount F
GLIBC_2.36 fsopen F
GLIBC_2.36 move_mount F
GLIBC_2.36 pidfd_getfd F
GLIBC_2.36 pidfd_open F
GLIBC_2.36 pidfd_send_signal F

View file

@ -2701,6 +2701,7 @@ GLIBC_2.35 epoll_pwait2 F
GLIBC_2.35 posix_spawn_file_actions_addtcsetpgrp_np F
GLIBC_2.36 fsmount F
GLIBC_2.36 fsopen F
GLIBC_2.36 move_mount F
GLIBC_2.36 pidfd_getfd F
GLIBC_2.36 pidfd_open F
GLIBC_2.36 pidfd_send_signal F

View file

@ -2604,6 +2604,7 @@ GLIBC_2.35 epoll_pwait2 F
GLIBC_2.35 posix_spawn_file_actions_addtcsetpgrp_np F
GLIBC_2.36 fsmount F
GLIBC_2.36 fsopen F
GLIBC_2.36 move_mount F
GLIBC_2.36 pidfd_getfd F
GLIBC_2.36 pidfd_open F
GLIBC_2.36 pidfd_send_signal F

View file

@ -2742,6 +2742,7 @@ GLIBC_2.35 epoll_pwait2 F
GLIBC_2.35 posix_spawn_file_actions_addtcsetpgrp_np F
GLIBC_2.36 fsmount F
GLIBC_2.36 fsopen F
GLIBC_2.36 move_mount F
GLIBC_2.36 pidfd_getfd F
GLIBC_2.36 pidfd_open F
GLIBC_2.36 pidfd_send_signal F

View file

@ -2125,6 +2125,7 @@ GLIBC_2.35 writev F
GLIBC_2.35 wscanf F
GLIBC_2.36 fsmount F
GLIBC_2.36 fsopen F
GLIBC_2.36 move_mount F
GLIBC_2.36 pidfd_getfd F
GLIBC_2.36 pidfd_open F
GLIBC_2.36 pidfd_send_signal F

View file

@ -2757,6 +2757,7 @@ GLIBC_2.35 epoll_pwait2 F
GLIBC_2.35 posix_spawn_file_actions_addtcsetpgrp_np F
GLIBC_2.36 fsmount F
GLIBC_2.36 fsopen F
GLIBC_2.36 move_mount F
GLIBC_2.36 pidfd_getfd F
GLIBC_2.36 pidfd_open F
GLIBC_2.36 pidfd_send_signal F

View file

@ -2790,6 +2790,7 @@ GLIBC_2.35 epoll_pwait2 F
GLIBC_2.35 posix_spawn_file_actions_addtcsetpgrp_np F
GLIBC_2.36 fsmount F
GLIBC_2.36 fsopen F
GLIBC_2.36 move_mount F
GLIBC_2.36 pidfd_getfd F
GLIBC_2.36 pidfd_open F
GLIBC_2.36 pidfd_send_signal F

View file

@ -2512,6 +2512,7 @@ GLIBC_2.35 epoll_pwait2 F
GLIBC_2.35 posix_spawn_file_actions_addtcsetpgrp_np F
GLIBC_2.36 fsmount F
GLIBC_2.36 fsopen F
GLIBC_2.36 move_mount F
GLIBC_2.36 pidfd_getfd F
GLIBC_2.36 pidfd_open F
GLIBC_2.36 pidfd_send_signal F

View file

@ -2814,6 +2814,7 @@ GLIBC_2.35 epoll_pwait2 F
GLIBC_2.35 posix_spawn_file_actions_addtcsetpgrp_np F
GLIBC_2.36 fsmount F
GLIBC_2.36 fsopen F
GLIBC_2.36 move_mount F
GLIBC_2.36 pidfd_getfd F
GLIBC_2.36 pidfd_open F
GLIBC_2.36 pidfd_send_signal F

View file

@ -2381,6 +2381,7 @@ GLIBC_2.35 epoll_pwait2 F
GLIBC_2.35 posix_spawn_file_actions_addtcsetpgrp_np F
GLIBC_2.36 fsmount F
GLIBC_2.36 fsopen F
GLIBC_2.36 move_mount F
GLIBC_2.36 pidfd_getfd F
GLIBC_2.36 pidfd_open F
GLIBC_2.36 pidfd_send_signal F

View file

@ -2581,6 +2581,7 @@ GLIBC_2.35 epoll_pwait2 F
GLIBC_2.35 posix_spawn_file_actions_addtcsetpgrp_np F
GLIBC_2.36 fsmount F
GLIBC_2.36 fsopen F
GLIBC_2.36 move_mount F
GLIBC_2.36 pidfd_getfd F
GLIBC_2.36 pidfd_open F
GLIBC_2.36 pidfd_send_signal F

View file

@ -2755,6 +2755,7 @@ GLIBC_2.35 epoll_pwait2 F
GLIBC_2.35 posix_spawn_file_actions_addtcsetpgrp_np F
GLIBC_2.36 fsmount F
GLIBC_2.36 fsopen F
GLIBC_2.36 move_mount F
GLIBC_2.36 pidfd_getfd F
GLIBC_2.36 pidfd_open F
GLIBC_2.36 pidfd_send_signal F

View file

@ -2549,6 +2549,7 @@ GLIBC_2.35 epoll_pwait2 F
GLIBC_2.35 posix_spawn_file_actions_addtcsetpgrp_np F
GLIBC_2.36 fsmount F
GLIBC_2.36 fsopen F
GLIBC_2.36 move_mount F
GLIBC_2.36 pidfd_getfd F
GLIBC_2.36 pidfd_open F
GLIBC_2.36 pidfd_send_signal F

View file

@ -2610,6 +2610,7 @@ GLIBC_2.35 epoll_pwait2 F
GLIBC_2.35 posix_spawn_file_actions_addtcsetpgrp_np F
GLIBC_2.36 fsmount F
GLIBC_2.36 fsopen F
GLIBC_2.36 move_mount F
GLIBC_2.36 pidfd_getfd F
GLIBC_2.36 pidfd_open F
GLIBC_2.36 pidfd_send_signal F

View file

@ -2607,6 +2607,7 @@ GLIBC_2.35 epoll_pwait2 F
GLIBC_2.35 posix_spawn_file_actions_addtcsetpgrp_np F
GLIBC_2.36 fsmount F
GLIBC_2.36 fsopen F
GLIBC_2.36 move_mount F
GLIBC_2.36 pidfd_getfd F
GLIBC_2.36 pidfd_open F
GLIBC_2.36 pidfd_send_signal F

View file

@ -2750,6 +2750,7 @@ GLIBC_2.35 epoll_pwait2 F
GLIBC_2.35 posix_spawn_file_actions_addtcsetpgrp_np F
GLIBC_2.36 fsmount F
GLIBC_2.36 fsopen F
GLIBC_2.36 move_mount F
GLIBC_2.36 pidfd_getfd F
GLIBC_2.36 pidfd_open F
GLIBC_2.36 pidfd_send_signal F

View file

@ -2576,6 +2576,7 @@ GLIBC_2.35 epoll_pwait2 F
GLIBC_2.35 posix_spawn_file_actions_addtcsetpgrp_np F
GLIBC_2.36 fsmount F
GLIBC_2.36 fsopen F
GLIBC_2.36 move_mount F
GLIBC_2.36 pidfd_getfd F
GLIBC_2.36 pidfd_open F
GLIBC_2.36 pidfd_send_signal F

View file

@ -154,6 +154,16 @@ enum
#define MOUNT_ATTR_NOSYMFOLLOW 0x00200000 /* Do not follow symlinks. */
/* 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 */
#define MOVE_MOUNT_F_EMPTY_PATH 0x00000004 /* Empty from path permitted */
#define MOVE_MOUNT_T_SYMLINKS 0x00000010 /* Follow symlinks on to path */
#define MOVE_MOUNT_T_AUTOMOUNTS 0x00000020 /* Follow automounts on to path */
#define MOVE_MOUNT_T_EMPTY_PATH 0x00000040 /* Empty to path permitted */
#define MOVE_MOUNT_SET_GROUP 0x00000100 /* Set sharing group instead */
__BEGIN_DECLS
/* Mount a filesystem. */
@ -176,6 +186,13 @@ extern int fsopen (const char *__fs_name, unsigned int __flags) __THROW;
extern int fsmount (int __fd, unsigned int __flags,
unsigned int __ms_flags) __THROW;
/* Add the mounted FROM_DFD referenced by FROM_PATHNAME filesystem returned
by fsmount in the hierarchy in the place TO_DFD reference by TO_PATHNAME
using FLAGS. */
extern int move_mount (int __from_dfd, const char *__from_pathname,
int __to_dfd, const char *__to_pathname,
unsigned int flags) __THROW;
__END_DECLS
#endif /* _SYS_MOUNT_H */

View file

@ -37,6 +37,7 @@ mincore - mincore i:aUV mincore
mlock - mlock i:bU mlock
mlockall - mlockall i:i mlockall
mount EXTRA mount i:sssUp __mount mount
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

View file

@ -51,7 +51,9 @@ def main():
status = max(
check('FSOPEN_.*'),
check('FSMOUNT_.*'))
check('FSMOUNT_.*'),
# MOVE_MOUNT__MASK may vary depending of the kernel version.
check('MOVE_MOUNT_.*', 'MOVE_MOUNT__MASK'))
sys.exit(status)
if __name__ == '__main__':

View file

@ -2527,6 +2527,7 @@ GLIBC_2.35 epoll_pwait2 F
GLIBC_2.35 posix_spawn_file_actions_addtcsetpgrp_np F
GLIBC_2.36 fsmount F
GLIBC_2.36 fsopen F
GLIBC_2.36 move_mount F
GLIBC_2.36 pidfd_getfd F
GLIBC_2.36 pidfd_open F
GLIBC_2.36 pidfd_send_signal F

View file

@ -2633,6 +2633,7 @@ GLIBC_2.35 epoll_pwait2 F
GLIBC_2.35 posix_spawn_file_actions_addtcsetpgrp_np F
GLIBC_2.36 fsmount F
GLIBC_2.36 fsopen F
GLIBC_2.36 move_mount F
GLIBC_2.36 pidfd_getfd F
GLIBC_2.36 pidfd_open F
GLIBC_2.36 pidfd_send_signal F