linux-stable/fs/gfs2
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 treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 398 2019-06-05 17:37:12 +02:00
aops.c gfs2: Fix case in which ail writes are done to jdata holes 2020-11-12 18:55:20 +01:00
aops.h gfs2: mark stuffed_readpage static 2019-07-03 14:45:18 +02:00
bmap.c Revert "gfs2: Ignore journal log writes for jdata holes" 2020-11-12 18:41:57 +01:00
bmap.h gfs2: use iomap for buffered I/O in ordered and writeback mode 2020-10-14 23:54:42 +02:00
dentry.c gfs2: untangle the logic in gfs2_drevalidate 2019-09-03 09:42:41 +02:00
dir.c mm: remove the pgprot argument to __vmalloc 2020-06-02 10:59:11 -07:00
dir.h gfs2: Delete an unnecessary check before brelse() 2019-09-04 20:22:17 +02:00
export.c gfs2: Minor gfs2_lookup_by_inum cleanup 2020-06-05 20:19:21 +02:00
file.c inode: make init and permission helpers idmapped mount aware 2021-01-24 14:27:16 +01:00
gfs2.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 398 2019-06-05 17:37:12 +02:00
glock.c Revert "GFS2: Prevent delete work from occurring on glocks used for create" 2020-12-01 00:25:21 +01:00
glock.h Merge branch 'gfs2-iopen' into for-next 2020-06-05 21:25:36 +02:00
glops.c gfs2: Don't freeze the file system during unmount 2020-11-25 18:12:08 +01:00
glops.h gfs2: Split up gfs2_meta_sync into inode and rgrp versions 2020-10-29 22:16:46 +01:00
incore.h Revert "GFS2: Prevent delete work from occurring on glocks used for create" 2020-12-01 00:25:21 +01:00
inode.c acl: handle idmapped mounts 2021-01-24 14:27:17 +01:00
inode.h gfs2: Make inode operations static 2020-12-01 00:25:21 +01:00
Kconfig treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
lock_dlm.c gfs2: Force withdraw to replay journals and wait for it to finish 2020-02-27 07:53:12 -06:00
log.c gfs2: Fix case in which ail writes are done to jdata holes 2020-11-12 18:55:20 +01:00
log.h gfs2: Wipe jdata and ail1 in gfs2_journal_wipe, formerly gfs2_meta_wipe 2020-10-15 14:29:03 +02:00
lops.c gfs2: Split up gfs2_meta_sync into inode and rgrp versions 2020-10-29 22:16:46 +01:00
lops.h gfs2: Split up gfs2_meta_sync into inode and rgrp versions 2020-10-29 22:16:46 +01:00
main.c gfs2: eliminate GIF_ORDERED in favor of list_empty 2020-07-03 12:05:34 +02:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
meta_io.c gfs2: Wipe jdata and ail1 in gfs2_journal_wipe, formerly gfs2_meta_wipe 2020-10-15 14:29:03 +02:00
meta_io.h gfs2: Wipe jdata and ail1 in gfs2_journal_wipe, formerly gfs2_meta_wipe 2020-10-15 14:29:03 +02:00
ops_fstype.c gfs2: don't initialize statfs_change inodes in spectator mode 2020-10-29 22:16:46 +01:00
quota.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
quota.h gfs2: move privileged user check to gfs2_quota_lock_check 2020-05-08 18:47:58 +02:00
recovery.c gfs2: Split up gfs2_meta_sync into inode and rgrp versions 2020-10-29 22:16:46 +01:00
recovery.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 398 2019-06-05 17:37:12 +02:00
rgrp.c gfs2: check for empty rgrp tree in gfs2_ri_update 2020-11-25 18:10:55 +01:00
rgrp.h gfs2: Fix NULL pointer dereference in gfs2_rgrp_dump 2020-10-14 23:54:43 +02:00
super.c gfs2: Remove sb_start_write from gfs2_statfs_sync 2020-12-03 17:04:24 +01:00
super.h gfs2: lookup local statfs inodes prior to journal recovery 2020-10-23 15:47:14 +02:00
sys.c gfs2: use-after-free in sysfs deregistration 2020-10-14 23:54:43 +02:00
sys.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 398 2019-06-05 17:37:12 +02:00
trace_gfs2.h gfs2: eliminate GLF_QUEUED flag in favor of list_empty(gl_holders) 2020-10-15 17:04:53 +02:00
trans.c gfs2: add some much needed cleanup for log flushes that fail 2020-08-24 13:54:07 +02:00
trans.h gfs2: new slab for transactions 2020-06-05 21:24:25 +02:00
util.c gfs2: in signal_our_withdraw wait for unfreeze of _this_ fs only 2020-12-03 17:04:41 +01:00
util.h gfs2: remove trailing semicolons from macro definitions 2020-12-01 00:25:21 +01:00
xattr.c acl: handle idmapped mounts 2021-01-24 14:27:17 +01:00
xattr.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 398 2019-06-05 17:37:12 +02:00