Commit 2b3416c
fs: add mode_strip_sgid() helper
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: e014f37 ("xfs: use setattr_copy to set vfs inode attributes") [1]
Link: 01ea173 ("xfs: fix up non-directory creation in SGID directories") [2]
Link: fd84bfd ("ceph: fix up non-directory creation in SGID directories") [3]
Link: https://lore.kernel.org/r/[email protected]
Reviewed-by: Darrick J. Wong <[email protected]>
Reviewed-by: Christian Brauner (Microsoft) <[email protected]>
Reviewed-and-Tested-by: Jeff Layton <[email protected]>
Signed-off-by: Yang Xu <[email protected]>
Signed-off-by: Christian Brauner (Microsoft) <[email protected]>1 parent ff69927 commit 2b3416c
2 files changed
+34
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2246 | 2246 | | |
2247 | 2247 | | |
2248 | 2248 | | |
2249 | | - | |
2250 | | - | |
2251 | | - | |
2252 | | - | |
| 2249 | + | |
| 2250 | + | |
2253 | 2251 | | |
2254 | 2252 | | |
2255 | 2253 | | |
| |||
2405 | 2403 | | |
2406 | 2404 | | |
2407 | 2405 | | |
| 2406 | + | |
| 2407 | + | |
| 2408 | + | |
| 2409 | + | |
| 2410 | + | |
| 2411 | + | |
| 2412 | + | |
| 2413 | + | |
| 2414 | + | |
| 2415 | + | |
| 2416 | + | |
| 2417 | + | |
| 2418 | + | |
| 2419 | + | |
| 2420 | + | |
| 2421 | + | |
| 2422 | + | |
| 2423 | + | |
| 2424 | + | |
| 2425 | + | |
| 2426 | + | |
| 2427 | + | |
| 2428 | + | |
| 2429 | + | |
| 2430 | + | |
| 2431 | + | |
| 2432 | + | |
| 2433 | + | |
| 2434 | + | |
| 2435 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1903 | 1903 | | |
1904 | 1904 | | |
1905 | 1905 | | |
| 1906 | + | |
| 1907 | + | |
1906 | 1908 | | |
1907 | 1909 | | |
1908 | 1910 | | |
| |||
0 commit comments