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