linux/fs/kernfs
Max Kellermann f4dce08ba1 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-23 08:54:51 +01:00
..
dir.c fs/kernfs/dir: obey S_ISGID 2024-02-23 08:54:51 +01:00
file.c kernfs: switch kernfs to use an rwsem 2021-07-27 09:29:15 +02:00
inode.c kernfs: use i_lock to protect concurrent inode updates 2021-07-27 09:29:15 +02:00
Kconfig treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
kernfs-internal.h kernfs: switch kernfs to use an rwsem 2021-07-27 09:29:15 +02:00
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
mount.c kernfs: use i_lock to protect concurrent inode updates 2021-07-27 09:29:15 +02:00
symlink.c kernfs: switch kernfs to use an rwsem 2021-07-27 09:29:15 +02:00