linux: Add open_tree

It was added on Linux 5.2 (a07b20004793d8926f78d63eb5980559f7813404)
to return a O_PATH-opened file descriptor to an existing mountpoint.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
This commit is contained in:
Adhemerval Zanella 2022-06-24 16:59:17 -03:00
parent 60f574e140
commit 78a408ee7b
38 changed files with 51 additions and 6 deletions

10
NEWS
View File

@ -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.
* localedef now accepts locale definition files encoded in UTF-8.
Previously, input bytes not within the ASCII range resulted in

View File

@ -305,6 +305,7 @@ libc {
fsopen;
fspick;
move_mount;
open_tree;
pidfd_open;
pidfd_getfd;
pidfd_send_signal;

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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 */

View File

@ -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

View File

@ -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__':

View File

@ -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

View File

@ -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