]> git.baikalelectronics.ru Git - kernel.git/commit
attr: handle idmapped mounts
authorChristian Brauner <christian.brauner@ubuntu.com>
Thu, 21 Jan 2021 13:19:26 +0000 (14:19 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Sun, 24 Jan 2021 13:27:16 +0000 (14:27 +0100)
commitf8ec3ee89f723bf41da625159e3c284a09a6c728
tree3d136e3ade1492f1ab59e09546ffa6f2d723f76d
parentbc47f7b71021c03720ab5887c996b677662af1ed
attr: handle idmapped mounts

When file attributes are changed most filesystems rely on the
setattr_prepare(), setattr_copy(), and notify_change() helpers for
initialization and permission checking. Let them handle idmapped mounts.
If the inode is accessed through an idmapped mount map it into the
mount's user namespace. Afterwards the checks are identical to
non-idmapped mounts. If the initial user namespace is passed nothing
changes so non-idmapped mounts will see identical behavior as before.

Helpers that perform checks on the ia_uid and ia_gid fields in struct
iattr assume that ia_uid and ia_gid are intended values and have already
been mapped correctly at the userspace-kernelspace boundary as we
already do today. If the initial user namespace is passed nothing
changes so non-idmapped mounts will see identical behavior as before.

Link: https://lore.kernel.org/r/20210121131959.646623-8-christian.brauner@ubuntu.com
Cc: Christoph Hellwig <hch@lst.de>
Cc: David Howells <dhowells@redhat.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: linux-fsdevel@vger.kernel.org
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
57 files changed:
arch/powerpc/platforms/cell/spufs/inode.c
drivers/base/devtmpfs.c
fs/9p/vfs_inode.c
fs/9p/vfs_inode_dotl.c
fs/adfs/inode.c
fs/affs/inode.c
fs/attr.c
fs/btrfs/inode.c
fs/cachefiles/interface.c
fs/ceph/inode.c
fs/cifs/inode.c
fs/ecryptfs/inode.c
fs/exfat/file.c
fs/ext2/inode.c
fs/ext4/inode.c
fs/f2fs/file.c
fs/fat/file.c
fs/fuse/dir.c
fs/gfs2/inode.c
fs/hfs/inode.c
fs/hfsplus/inode.c
fs/hostfs/hostfs_kern.c
fs/hpfs/inode.c
fs/hugetlbfs/inode.c
fs/inode.c
fs/jffs2/fs.c
fs/jfs/file.c
fs/kernfs/inode.c
fs/libfs.c
fs/minix/file.c
fs/nfsd/nfsproc.c
fs/nfsd/vfs.c
fs/nilfs2/inode.c
fs/ntfs/inode.c
fs/ocfs2/dlmfs/dlmfs.c
fs/ocfs2/file.c
fs/omfs/file.c
fs/open.c
fs/orangefs/inode.c
fs/overlayfs/copy_up.c
fs/overlayfs/dir.c
fs/overlayfs/inode.c
fs/overlayfs/super.c
fs/proc/base.c
fs/proc/generic.c
fs/proc/proc_sysctl.c
fs/ramfs/file-nommu.c
fs/reiserfs/inode.c
fs/sysv/file.c
fs/ubifs/file.c
fs/udf/file.c
fs/ufs/inode.c
fs/utimes.c
fs/xfs/xfs_iops.c
fs/zonefs/super.c
include/linux/fs.h
mm/shmem.c