Re: [PATCH 2/2] fs/kernfs/dir: obey S_ISGID

From: Tejun Heo
Date: Fri Dec 01 2023 - 11:59:54 EST


On Fri, Dec 01, 2023 at 01:56:38PM +0100, Max Kellermann wrote:
> 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.
>
> Signed-off-by: Max Kellermann <max.kellermann@xxxxxxxxx>

Acked-by: Tejun Heo <tj@xxxxxxxxxx>

Thanks.

--
tejun