]> git.baikalelectronics.ru Git - kernel.git/commit
ceph: fix up non-directory creation in SGID directories
authorChristian Brauner <christian.brauner@ubuntu.com>
Mon, 29 Nov 2021 11:16:39 +0000 (12:16 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 22 Dec 2021 08:32:36 +0000 (09:32 +0100)
commitd41f0f3a160cb182eaaeeeed1f8f2a44f98cdf78
treedfd01d058585d6379d2778027a6d53d794f1fa41
parentdc50184d91967aa8890299c129c98bce269c7480
ceph: fix up non-directory creation in SGID directories

commit 3725be669fb99710b49efb4267db81829820b82c upstream.

Ceph always inherits the SGID bit if it is set on the parent inode,
while the generic inode_init_owner does not do this in a few cases where
it can create a possible security problem (cf. [1]).

Update ceph to strip the SGID bit just as inode_init_owner would.

This bug was detected by the mapped mount testsuite in [3]. The
testsuite tests all core VFS functionality and semantics with and
without mapped mounts. That is to say it functions as a generic VFS
testsuite in addition to a mapped mount testsuite. While working on
mapped mount support for ceph, SIGD inheritance was the only failing
test for ceph after the port.

The same bug was detected by the mapped mount testsuite in XFS in
January 2021 (cf. [2]).

[1]: commit ea228d760707 ("Fix up non-directory creation in SGID directories")
[2]: commit 1db3fee044c4 ("xfs: fix up non-directory creation in SGID directories")
[3]: https://git.kernel.org/fs/xfs/xfstests-dev.git

Cc: stable@vger.kernel.org
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/ceph/file.c