WSL2-Linux-Kernel/fs
Christian Brauner 138060ba92
fs: pass dentry to set acl method
The current way of setting and getting posix acls through the generic
xattr interface is error prone and type unsafe. The vfs needs to
interpret and fixup posix acls before storing or reporting it to
userspace. Various hacks exist to make this work. The code is hard to
understand and difficult to maintain in it's current form. Instead of
making this work by hacking posix acls through xattr handlers we are
building a dedicated posix acl api around the get and set inode
operations. This removes a lot of hackiness and makes the codepaths
easier to maintain. A lot of background can be found in [1].

Since some filesystem rely on the dentry being available to them when
setting posix acls (e.g., 9p and cifs) they cannot rely on set acl inode
operation. But since ->set_acl() is required in order to use the generic
posix acl xattr handlers filesystems that do not implement this inode
operation cannot use the handler and need to implement their own
dedicated posix acl handlers.

Update the ->set_acl() inode method to take a dentry argument. This
allows all filesystems to rely on ->set_acl().

As far as I can tell all codepaths can be switched to rely on the dentry
instead of just the inode. Note that the original motivation for passing
the dentry separate from the inode instead of just the dentry in the
xattr handlers was because of security modules that call
security_d_instantiate(). This hook is called during
d_instantiate_new(), d_add(), __d_instantiate_anon(), and
d_splice_alias() to initialize the inode's security context and possibly
to set security.* xattrs. Since this only affects security.* xattrs this
is completely irrelevant for posix acls.

Link: https://lore.kernel.org/all/20220801145520.1532837-1-brauner@kernel.org [1]
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>
2022-10-19 12:55:42 +02:00
..
9p
adfs
affs
afs struct file-related stuff 2022-10-06 17:13:18 -07:00
autofs
befs
bfs
btrfs fs: pass dentry to set acl method 2022-10-19 12:55:42 +02:00
cachefiles
ceph fs: pass dentry to set acl method 2022-10-19 12:55:42 +02:00
cifs smb3: improve SMB3 change notification support 2022-10-15 10:05:53 -05:00
coda
configfs
cramfs
crypto STATX_DIOALIGN for 6.1 2022-10-03 20:33:41 -07:00
debugfs
devpts
dlm Networking changes for 6.1. 2022-10-04 13:38:03 -07:00
ecryptfs whack-a-mole: constifying struct path * 2022-10-06 17:31:02 -07:00
efivarfs
efs
erofs for-6.1/block-2022-10-03 2022-10-07 09:19:14 -07:00
exfat treewide: use get_random_u32() when possible 2022-10-11 17:42:58 -06:00
exportfs
ext2 fs: pass dentry to set acl method 2022-10-19 12:55:42 +02:00
ext4 fs: pass dentry to set acl method 2022-10-19 12:55:42 +02:00
f2fs fs: pass dentry to set acl method 2022-10-19 12:55:42 +02:00
fat treewide: use get_random_u32() when possible 2022-10-11 17:42:58 -06:00
freevxfs
fscache
fuse fs: pass dentry to set acl method 2022-10-19 12:55:42 +02:00
gfs2 fs: pass dentry to set acl method 2022-10-19 12:55:42 +02:00
hfs
hfsplus
hostfs
hpfs
hugetlbfs tmpfile API change 2022-10-10 19:45:17 -07:00
iomap
isofs - hfs and hfsplus kmap API modernization from Fabio Francesco 2022-10-12 11:00:22 -07:00
jbd2 - Yu Zhao's Multi-Gen LRU patches are here. They've been under test in 2022-10-10 17:53:04 -07:00
jffs2 fs: pass dentry to set acl method 2022-10-19 12:55:42 +02:00
jfs fs: pass dentry to set acl method 2022-10-19 12:55:42 +02:00
kernfs
ksmbd fs: pass dentry to set acl method 2022-10-19 12:55:42 +02:00
lockd
minix
netfs
nfs fs: pass dentry to set acl method 2022-10-19 12:55:42 +02:00
nfs_common
nfsd fs: pass dentry to set acl method 2022-10-19 12:55:42 +02:00
nilfs2 Five hotfixes - three for nilfs2, two for MM. For are cc:stable, one is 2022-10-12 11:16:58 -07:00
nls
notify Merge tag 'fsnotify-for_v6.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs 2022-10-07 08:28:50 -07:00
ntfs - hfs and hfsplus kmap API modernization from Fabio Francesco 2022-10-12 11:00:22 -07:00
ntfs3 fs: pass dentry to set acl method 2022-10-19 12:55:42 +02:00
ocfs2 fs: pass dentry to set acl method 2022-10-19 12:55:42 +02:00
omfs
openpromfs
orangefs fs: pass dentry to set acl method 2022-10-19 12:55:42 +02:00
overlayfs tmpfile API change 2022-10-10 19:45:17 -07:00
proc - hfs and hfsplus kmap API modernization from Fabio Francesco 2022-10-12 11:00:22 -07:00
pstore
qnx4
qnx6
quota
ramfs tmpfile API change 2022-10-10 19:45:17 -07:00
reiserfs fs: pass dentry to set acl method 2022-10-19 12:55:42 +02:00
romfs
smbfs_common smb3: define missing create contexts 2022-10-05 01:55:27 -05:00
squashfs
sysfs
sysv
tracefs
ubifs Random number generator fixes for Linux 6.1-rc1. 2022-10-16 15:27:07 -07:00
udf tmpfile API change 2022-10-10 19:45:17 -07:00
ufs
unicode
vboxsf
verity for-6.1-tag 2022-10-06 17:36:48 -07:00
xfs fs: pass dentry to set acl method 2022-10-19 12:55:42 +02:00
zonefs
Kconfig
Kconfig.binfmt Xtensa updates for v6.1 2022-10-10 14:21:11 -07:00
Makefile
aio.c
anon_inodes.c
attr.c
bad_inode.c fs: pass dentry to set acl method 2022-10-19 12:55:42 +02:00
binfmt_elf.c
binfmt_elf_fdpic.c
binfmt_elf_test.c
binfmt_flat.c
binfmt_misc.c
binfmt_script.c
buffer.c - hfs and hfsplus kmap API modernization from Fabio Francesco 2022-10-12 11:00:22 -07:00
char_dev.c
compat_binfmt_elf.c
coredump.c - Yu Zhao's Multi-Gen LRU patches are here. They've been under test in 2022-10-10 17:53:04 -07:00
d_path.c
dax.c
dcache.c tmpfile API change 2022-10-10 19:45:17 -07:00
direct-io.c
drop_caches.c
eventfd.c
eventpoll.c
exec.c - Yu Zhao's Multi-Gen LRU patches are here. They've been under test in 2022-10-10 17:53:04 -07:00
fcntl.c
fhandle.c
file.c
file_table.c
filesystems.c
fs-writeback.c
fs_context.c
fs_parser.c
fs_pin.c
fs_struct.c
fs_types.c
fsopen.c
init.c
inode.c saner inode_init_always() 2022-10-06 16:49:00 -07:00
internal.h whack-a-mole: constifying struct path * 2022-10-06 17:31:02 -07:00
ioctl.c
kernel_read_file.c
libfs.c fs: uninline inode_maybe_inc_iversion() 2022-10-03 14:21:43 -07:00
locks.c
mbcache.c
mount.h
mpage.c
namei.c tmpfile API change 2022-10-10 19:45:17 -07:00
namespace.c
no-block.c
nsfs.c
open.c struct file-related stuff 2022-10-06 17:13:18 -07:00
pipe.c
pnode.c
pnode.h
posix_acl.c fs: pass dentry to set acl method 2022-10-19 12:55:42 +02:00
proc_namespace.c
read_write.c
readdir.c
remap_range.c
select.c
seq_file.c
signalfd.c
splice.c
stack.c
stat.c
statfs.c
super.c
sync.c
sysctls.c
timerfd.c
userfaultfd.c - Yu Zhao's Multi-Gen LRU patches are here. They've been under test in 2022-10-10 17:53:04 -07:00
utimes.c
xattr.c