Re: [PATCH v2 2/2] fanotify: support watching filesystems and mounts inside userns

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, 19 Apr 2025 at 12:07, Amir Goldstein <amir73il@xxxxxxxxx> wrote:

> @@ -1987,12 +1988,27 @@ static int do_fanotify_mark(int fanotify_fd, unsigned int flags, __u64 mask,
>                 obj = inode;
>         } else if (obj_type == FSNOTIFY_OBJ_TYPE_VFSMOUNT) {
>                 obj = path.mnt;
> +               user_ns = real_mount(obj)->mnt_ns->user_ns;
>         } else if (obj_type == FSNOTIFY_OBJ_TYPE_SB) {
>                 obj = path.mnt->mnt_sb;
> +               user_ns = path.mnt->mnt_sb->s_user_ns;

The patch header notes that user_ns != &init_user_ns implies
FS_USERNS_MOUNT, but it'd be nice to document this with a WARN_ON() in
the code as well.

>         } else if (obj_type == FSNOTIFY_OBJ_TYPE_MNTNS) {
>                 obj = mnt_ns_from_dentry(path.dentry);
> +               user_ns = ((struct mnt_namespace *)obj)->user_ns;

It would be much more elegant if the type wasn't lost before this assignment.

Otherwise looks good:

Reviewed-by: Miklos Szeredi <mszeredi@xxxxxxxxxx>

Thanks,
Miklos




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux