linux/fs/kernfs
Max Kellermann 089ebfab24 fs/kernfs/dir: obey S_ISGID
[ Upstream commit 5133bee62f ]

Handling of S_ISGID is usually done by inode_init_owner() in all other
filesystems, but kernfs doesn't use that function.  In kernfs, struct
kernfs_node is the primary data structure, and struct inode is only
created from it on demand.  Therefore, inode_init_owner() can't be
used and we need to imitate its behavior.

S_ISGID support is useful for the cgroup filesystem; it allows
subtrees managed by an unprivileged process to retain a certain owner
gid, which then enables sharing access to the subtree with another
unprivileged process.

--
v1 -> v2: minor coding style fix (comment)

Signed-off-by: Max Kellermann <max.kellermann@ionos.com>
Acked-by: Tejun Heo <tj@kernel.org>
Link: https://lore.kernel.org/r/20231208093310.297233-2-max.kellermann@ionos.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-02-05 20:12:58 +00:00
..
dir.c fs/kernfs/dir: obey S_ISGID 2024-02-05 20:12:58 +00:00
file.c kernfs: Skip kernfs_drain_open_files() more aggressively 2022-09-01 18:08:44 +02:00
inode.c kernfs: switch global kernfs_rwsem lock to per-fs lock 2021-11-24 13:55:16 +01:00
Kconfig treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
kernfs-internal.h kernfs: Skip kernfs_drain_open_files() more aggressively 2022-09-01 18:08:44 +02:00
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
mount.c kernfs: Replace global kernfs_open_file_mutex with hashed mutexes. 2022-06-27 16:46:15 +02:00
symlink.c kernfs: switch global kernfs_rwsem lock to per-fs lock 2021-11-24 13:55:16 +01:00