linux/fs/9p
Christian Brauner e65ce2a50c
acl: handle idmapped mounts
The posix acl permission checking helpers determine whether a caller is
privileged over an inode according to the acls associated with the
inode. Add helpers that make it possible to handle acls on idmapped
mounts.

The vfs and the filesystems targeted by this first iteration make use of
posix_acl_fix_xattr_from_user() and posix_acl_fix_xattr_to_user() to
translate basic posix access and default permissions such as the
ACL_USER and ACL_GROUP type according to the initial user namespace (or
the superblock's user namespace) to and from the caller's current user
namespace. Adapt these two helpers to handle idmapped mounts whereby we
either map from or into the mount's user namespace depending on in which
direction we're translating.
Similarly, cap_convert_nscap() is used by the vfs to translate user
namespace and non-user namespace aware filesystem capabilities from the
superblock's user namespace to the caller's user namespace. Enable it to
handle idmapped mounts by accounting for the mount's user namespace.

In addition the fileystems targeted in the first iteration of this patch
series make use of the posix_acl_chmod() and, posix_acl_update_mode()
helpers. Both helpers perform permission checks on the target inode. Let
them handle idmapped mounts. These two helpers are called when posix
acls are set by the respective filesystems to handle this case we extend
the ->set() method to take an additional user namespace argument to pass
the mount's user namespace down.

Link: https://lore.kernel.org/r/20210121131959.646623-9-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>
2021-01-24 14:27:17 +01:00
..
acl.c acl: handle idmapped mounts 2021-01-24 14:27:17 +01:00
acl.h 9p: switch v9fs_set_create_acl() to inode+fid, do it before d_instantiate() 2013-02-26 02:46:07 -05:00
cache.c 9p/cache.c: Fix memory leak in v9fs_cache_session_get_cookie 2019-09-03 11:07:39 +00:00
cache.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 188 2019-05-30 11:29:21 -07:00
fid.c 9p: Remove unnecessary IS_ERR() check 2020-12-01 08:19:02 +01:00
fid.h 9p: apply review requests for fid refcounting 2020-11-19 17:21:34 +01:00
Kconfig 9p: Fix Kconfig indentation 2020-03-27 09:29:56 +00:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
v9fs.c 9p: Fix memory leak in v9fs_mount 2020-07-19 14:58:47 +02:00
v9fs.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 188 2019-05-30 11:29:21 -07:00
v9fs_vfs.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 188 2019-05-30 11:29:21 -07:00
vfs_addr.c 9p: pass the correct prototype to read_cache_page 2019-07-12 11:05:43 -07:00
vfs_dentry.c 9p: add refcount to p9_fid struct 2020-11-19 17:20:39 +01:00
vfs_dir.c 9p: add refcount to p9_fid struct 2020-11-19 17:20:39 +01:00
vfs_file.c 9p for 5.11-rc1 2020-12-21 10:28:02 -08:00
vfs_inode.c attr: handle idmapped mounts 2021-01-24 14:27:16 +01:00
vfs_inode_dotl.c attr: handle idmapped mounts 2021-01-24 14:27:16 +01:00
vfs_super.c 9p: add refcount to p9_fid struct 2020-11-19 17:20:39 +01:00
xattr.c acl: handle idmapped mounts 2021-01-24 14:27:17 +01:00
xattr.h 9p: xattr simplifications 2015-11-13 20:34:33 -05:00