vfs: Add new setgid_create_acl test v2022.09.04
authorYang Xu <xuyang2018.jy@fujitsu.com>
Wed, 31 Aug 2022 07:33:27 +0000 (15:33 +0800)
committerZorro Lang <zlang@kernel.org>
Sun, 4 Sep 2022 13:49:31 +0000 (21:49 +0800)
commit890c50823b6430bf0929d9a57e76b9b4d6bbc25f
treeccbbd2367a03eeea8f907ad0643695aafd58ae14
parentc875434286737e792d200cda2eb679e2a8441837
vfs: Add new setgid_create_acl test

The current_umask() is stripped from the mode directly in the vfs if the
filesystem either doesn't support acls or the filesystem has been
mounted without posic acl support.

If the filesystem does support acls then current_umask() stripping is
deferred to posix_acl_create(). So when the filesystem calls
posix_acl_create() and there are no acls set or not supported then
current_umask() will be stripped.

If the parent directory has a default acl then permissions are based off
of that and current_umask() is ignored. Specifically, if the ACL has an
ACL_MASK entry, the group permissions correspond to the permissions of
the ACL_MASK entry. Otherwise, if the ACL has no ACL_MASK entry, the
group permissions correspond to the permissions of the ACL_GROUP_OBJ
entry.

Here we only use setfacl to set default acl or add ACL_MASK to check
whether inode strip  S_ISGID works correctly.

Like umask test, this patch is also designed to test kernel patchset behaviour
"move S_ISGID stripping into the vfs* helper"

Tested-by: Christian Brauner (Microsoft) <brauner@kernel.org>
Reviewed-by: Christian Brauner (Microsoft) <brauner@kernel.org>
Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
src/vfs/idmapped-mounts.c
src/vfs/idmapped-mounts.h
src/vfs/vfstest.c
tests/generic/697 [new file with mode: 0755]
tests/generic/697.out [new file with mode: 0644]