mirror of
https://github.com/linux-msm/laptops-kernel.git
synced 2026-08-13 14:19:53 -07:00
Merge tag 'vfs-6.15-rc1.mount' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs
Pull vfs mount updates from Christian Brauner:
- Mount notifications
The day has come where we finally provide a new api to listen for
mount topology changes outside of /proc/<pid>/mountinfo. A mount
namespace file descriptor can be supplied and registered with
fanotify to listen for mount topology changes.
Currently notifications for mount, umount and moving mounts are
generated. The generated notification record contains the unique
mount id of the mount.
The listmount() and statmount() api can be used to query detailed
information about the mount using the received unique mount id.
This allows userspace to figure out exactly how the mount topology
changed without having to generating diffs of /proc/<pid>/mountinfo
in userspace.
- Support O_PATH file descriptors with FSCONFIG_SET_FD in the new mount
api
- Support detached mounts in overlayfs
Since last cycle we support specifying overlayfs layers via file
descriptors. However, we don't allow detached mounts which means
userspace cannot user file descriptors received via
open_tree(OPEN_TREE_CLONE) and fsmount() directly. They have to
attach them to a mount namespace via move_mount() first.
This is cumbersome and means they have to undo mounts via umount().
Allow them to directly use detached mounts.
- Allow to retrieve idmappings with statmount
Currently it isn't possible to figure out what idmapping has been
attached to an idmapped mount. Add an extension to statmount() which
allows to read the idmapping from the mount.
- Allow creating idmapped mounts from mounts that are already idmapped
So far it isn't possible to allow the creation of idmapped mounts
from already idmapped mounts as this has significant lifetime
implications. Make the creation of idmapped mounts atomic by allow to
pass struct mount_attr together with the open_tree_attr() system call
allowing to solve these issues without complicating VFS lookup in any
way.
The system call has in general the benefit that creating a detached
mount and applying mount attributes to it becomes an atomic operation
for userspace.
- Add a way to query statmount() for supported options
Allow userspace to query which mount information can be retrieved
through statmount().
- Allow superblock owners to force unmount
* tag 'vfs-6.15-rc1.mount' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs: (21 commits)
umount: Allow superblock owners to force umount
selftests: add tests for mount notification
selinux: add FILE__WATCH_MOUNTNS
samples/vfs: fix printf format string for size_t
fs: allow changing idmappings
fs: add kflags member to struct mount_kattr
fs: add open_tree_attr()
fs: add copy_mount_setattr() helper
fs: add vfs_open_tree() helper
statmount: add a new supported_mask field
samples/vfs: add STATMOUNT_MNT_{G,U}IDMAP
selftests: add tests for using detached mount with overlayfs
samples/vfs: check whether flag was raised
statmount: allow to retrieve idmappings
uidgid: add map_id_range_up()
fs: allow detached mounts in clone_private_mount()
selftests/overlayfs: test specifying layers as O_PATH file descriptors
fs: support O_PATH fds with FSCONFIG_SET_FD
vfs: add notifications for mount attach and detach
fanotify: notify on mount attach and detach
...
This commit is contained in:
@@ -506,3 +506,4 @@
|
||||
574 common getxattrat sys_getxattrat
|
||||
575 common listxattrat sys_listxattrat
|
||||
576 common removexattrat sys_removexattrat
|
||||
577 common open_tree_attr sys_open_tree_attr
|
||||
|
||||
@@ -481,3 +481,4 @@
|
||||
464 common getxattrat sys_getxattrat
|
||||
465 common listxattrat sys_listxattrat
|
||||
466 common removexattrat sys_removexattrat
|
||||
467 common open_tree_attr sys_open_tree_attr
|
||||
|
||||
@@ -478,3 +478,4 @@
|
||||
464 common getxattrat sys_getxattrat
|
||||
465 common listxattrat sys_listxattrat
|
||||
466 common removexattrat sys_removexattrat
|
||||
467 common open_tree_attr sys_open_tree_attr
|
||||
|
||||
@@ -466,3 +466,4 @@
|
||||
464 common getxattrat sys_getxattrat
|
||||
465 common listxattrat sys_listxattrat
|
||||
466 common removexattrat sys_removexattrat
|
||||
467 common open_tree_attr sys_open_tree_attr
|
||||
|
||||
@@ -472,3 +472,4 @@
|
||||
464 common getxattrat sys_getxattrat
|
||||
465 common listxattrat sys_listxattrat
|
||||
466 common removexattrat sys_removexattrat
|
||||
467 common open_tree_attr sys_open_tree_attr
|
||||
|
||||
@@ -405,3 +405,4 @@
|
||||
464 n32 getxattrat sys_getxattrat
|
||||
465 n32 listxattrat sys_listxattrat
|
||||
466 n32 removexattrat sys_removexattrat
|
||||
467 n32 open_tree_attr sys_open_tree_attr
|
||||
|
||||
@@ -381,3 +381,4 @@
|
||||
464 n64 getxattrat sys_getxattrat
|
||||
465 n64 listxattrat sys_listxattrat
|
||||
466 n64 removexattrat sys_removexattrat
|
||||
467 n64 open_tree_attr sys_open_tree_attr
|
||||
|
||||
@@ -454,3 +454,4 @@
|
||||
464 o32 getxattrat sys_getxattrat
|
||||
465 o32 listxattrat sys_listxattrat
|
||||
466 o32 removexattrat sys_removexattrat
|
||||
467 o32 open_tree_attr sys_open_tree_attr
|
||||
|
||||
@@ -465,3 +465,4 @@
|
||||
464 common getxattrat sys_getxattrat
|
||||
465 common listxattrat sys_listxattrat
|
||||
466 common removexattrat sys_removexattrat
|
||||
467 common open_tree_attr sys_open_tree_attr
|
||||
|
||||
@@ -557,3 +557,4 @@
|
||||
464 common getxattrat sys_getxattrat
|
||||
465 common listxattrat sys_listxattrat
|
||||
466 common removexattrat sys_removexattrat
|
||||
467 common open_tree_attr sys_open_tree_attr
|
||||
|
||||
@@ -469,3 +469,4 @@
|
||||
464 common getxattrat sys_getxattrat sys_getxattrat
|
||||
465 common listxattrat sys_listxattrat sys_listxattrat
|
||||
466 common removexattrat sys_removexattrat sys_removexattrat
|
||||
467 common open_tree_attr sys_open_tree_attr sys_open_tree_attr
|
||||
|
||||
@@ -470,3 +470,4 @@
|
||||
464 common getxattrat sys_getxattrat
|
||||
465 common listxattrat sys_listxattrat
|
||||
466 common removexattrat sys_removexattrat
|
||||
467 common open_tree_attr sys_open_tree_attr
|
||||
|
||||
@@ -512,3 +512,4 @@
|
||||
464 common getxattrat sys_getxattrat
|
||||
465 common listxattrat sys_listxattrat
|
||||
466 common removexattrat sys_removexattrat
|
||||
467 common open_tree_attr sys_open_tree_attr
|
||||
|
||||
@@ -472,3 +472,4 @@
|
||||
464 i386 getxattrat sys_getxattrat
|
||||
465 i386 listxattrat sys_listxattrat
|
||||
466 i386 removexattrat sys_removexattrat
|
||||
467 i386 open_tree_attr sys_open_tree_attr
|
||||
|
||||
@@ -390,6 +390,7 @@
|
||||
464 common getxattrat sys_getxattrat
|
||||
465 common listxattrat sys_listxattrat
|
||||
466 common removexattrat sys_removexattrat
|
||||
467 common open_tree_attr sys_open_tree_attr
|
||||
|
||||
#
|
||||
# Due to a historical design error, certain syscalls are numbered differently
|
||||
|
||||
@@ -437,3 +437,4 @@
|
||||
464 common getxattrat sys_getxattrat
|
||||
465 common listxattrat sys_listxattrat
|
||||
466 common removexattrat sys_removexattrat
|
||||
467 common open_tree_attr sys_open_tree_attr
|
||||
|
||||
@@ -218,6 +218,8 @@ void autofs_clean_ino(struct autofs_info *);
|
||||
|
||||
static inline int autofs_check_pipe(struct file *pipe)
|
||||
{
|
||||
if (pipe->f_mode & FMODE_PATH)
|
||||
return -EINVAL;
|
||||
if (!(pipe->f_mode & FMODE_CAN_WRITE))
|
||||
return -EINVAL;
|
||||
if (!S_ISFIFO(file_inode(pipe)->i_mode))
|
||||
|
||||
+1
-1
@@ -453,7 +453,7 @@ SYSCALL_DEFINE5(fsconfig,
|
||||
case FSCONFIG_SET_FD:
|
||||
param.type = fs_value_is_file;
|
||||
ret = -EBADF;
|
||||
param.file = fget(aux);
|
||||
param.file = fget_raw(aux);
|
||||
if (!param.file)
|
||||
goto out_key;
|
||||
param.dirfd = aux;
|
||||
|
||||
@@ -338,3 +338,4 @@ static inline bool path_mounted(const struct path *path)
|
||||
}
|
||||
void file_f_owner_release(struct file *file);
|
||||
bool file_seek_cur_needs_f_lock(struct file *file);
|
||||
int statmount_mnt_idmap(struct mnt_idmap *idmap, struct seq_file *seq, bool uid_map);
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <linux/mnt_idmapping.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/user_namespace.h>
|
||||
#include <linux/seq_file.h>
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
@@ -334,3 +335,53 @@ void mnt_idmap_put(struct mnt_idmap *idmap)
|
||||
free_mnt_idmap(idmap);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(mnt_idmap_put);
|
||||
|
||||
int statmount_mnt_idmap(struct mnt_idmap *idmap, struct seq_file *seq, bool uid_map)
|
||||
{
|
||||
struct uid_gid_map *map, *map_up;
|
||||
u32 idx, nr_mappings;
|
||||
|
||||
if (!is_valid_mnt_idmap(idmap))
|
||||
return 0;
|
||||
|
||||
/*
|
||||
* Idmappings are shown relative to the caller's idmapping.
|
||||
* This is both the most intuitive and most useful solution.
|
||||
*/
|
||||
if (uid_map) {
|
||||
map = &idmap->uid_map;
|
||||
map_up = ¤t_user_ns()->uid_map;
|
||||
} else {
|
||||
map = &idmap->gid_map;
|
||||
map_up = ¤t_user_ns()->gid_map;
|
||||
}
|
||||
|
||||
for (idx = 0, nr_mappings = 0; idx < map->nr_extents; idx++) {
|
||||
uid_t lower;
|
||||
struct uid_gid_extent *extent;
|
||||
|
||||
if (map->nr_extents <= UID_GID_MAP_MAX_BASE_EXTENTS)
|
||||
extent = &map->extent[idx];
|
||||
else
|
||||
extent = &map->forward[idx];
|
||||
|
||||
/*
|
||||
* Verify that the whole range of the mapping can be
|
||||
* resolved in the caller's idmapping. If it cannot be
|
||||
* resolved skip the mapping.
|
||||
*/
|
||||
lower = map_id_range_up(map_up, extent->lower_first, extent->count);
|
||||
if (lower == (uid_t) -1)
|
||||
continue;
|
||||
|
||||
seq_printf(seq, "%u %u %u", extent->first, lower, extent->count);
|
||||
|
||||
seq->count++; /* mappings are separated by \0 */
|
||||
if (seq_has_overflowed(seq))
|
||||
return -EAGAIN;
|
||||
|
||||
nr_mappings++;
|
||||
}
|
||||
|
||||
return nr_mappings;
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user