Ubuntu-focal-kernel/fs/kernfs
Max Kellermann e8a68b9a75 fs/kernfs/dir: obey S_ISGID
BugLink: https://bugs.launchpad.net/bugs/2058948

[ Upstream commit 5133bee62f0ea5d4c316d503cc0040cac5637601 ]

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>
Signed-off-by: Manuel Diewald <manuel.diewald@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
2024-03-28 15:18:38 +01:00
..
Kconfig
Makefile
dir.c fs/kernfs/dir: obey S_ISGID 2024-03-28 15:18:38 +01:00
file.c
inode.c
kernfs-internal.h
mount.c new helper: lookup_positive_unlocked() 2023-10-30 11:42:07 +01:00
symlink.c