Files
linux-stable-mirror/include/linux
Yang XuandGreg Kroah-Hartman 347750e1b6 fs: add mode_strip_sgid() helper
commit 2b3416ceff upstream.

[remove userns argument of helper for 5.10.y backport]

Add a dedicated helper to handle the setgid bit when creating a new file
in a setgid directory. This is a preparatory patch for moving setgid
stripping into the vfs. The patch contains no functional changes.

Currently the setgid stripping logic is open-coded directly in
inode_init_owner() and the individual filesystems are responsible for
handling setgid inheritance. Since this has proven to be brittle as
evidenced by old issues we uncovered over the last months (see [1] to
[3] below) we will try to move this logic into the vfs.

Link: e014f37db1 ("xfs: use setattr_copy to set vfs inode attributes") [1]
Link: 01ea173e10 ("xfs: fix up non-directory creation in SGID directories") [2]
Link: fd84bfdddd ("ceph: fix up non-directory creation in SGID directories") [3]
Link: https://lore.kernel.org/r/1657779088-2242-1-git-send-email-xuyang2018.jy@fujitsu.com
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christian Brauner (Microsoft) <brauner@kernel.org>
Reviewed-and-Tested-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-03-22 13:30:07 +01:00
..
2022-12-02 17:40:03 +01:00
2022-08-21 15:16:16 +02:00
2023-02-01 08:23:19 +01:00
2022-10-26 13:25:35 +02:00
2022-07-07 17:52:17 +02:00
2023-03-22 13:30:07 +01:00
2022-10-26 13:25:42 +02:00
2022-04-13 21:00:56 +02:00
2023-03-17 08:45:07 +01:00
2023-03-17 08:45:07 +01:00
2022-08-21 15:16:08 +02:00
2021-11-18 14:03:37 +01:00
2022-08-21 15:15:21 +02:00
2021-06-30 08:47:26 -04:00
2023-01-04 11:39:16 +01:00
2023-03-17 08:45:14 +01:00
2023-01-04 11:39:23 +01:00
2021-05-14 09:50:31 +02:00