Centos-kernel-stream-10/fs/ecryptfs
Ming Lei 7ba91894f9 fs: Simplify getattr interface function checking AT_GETATTR_NOSEC flag
JIRA: https://issues.redhat.com/browse/RHEL-83595

commit 95f567f81e43a1bcb5fbf0559e55b7505707300d
Author: Stefan Berger <stefanb@linux.ibm.com>
Date:   Fri Nov 1 15:37:03 2024 -0400

    fs: Simplify getattr interface function checking AT_GETATTR_NOSEC flag

    Commit 8a924db2d7 ("fs: Pass AT_GETATTR_NOSEC flag to getattr interface
    function")' introduced the AT_GETATTR_NOSEC flag to ensure that the
    call paths only call vfs_getattr_nosec if it is set instead of vfs_getattr.
    Now, simplify the getattr interface functions of filesystems where the flag
    AT_GETATTR_NOSEC is checked.

    There is only a single caller of inode_operations getattr function and it
    is located in fs/stat.c in vfs_getattr_nosec. The caller there is the only
    one from which the AT_GETATTR_NOSEC flag is passed from.

    Two filesystems are checking this flag in .getattr and the flag is always
    passed to them unconditionally from only vfs_getattr_nosec:

    - ecryptfs:  Simplify by always calling vfs_getattr_nosec in
                 ecryptfs_getattr. From there the flag is passed to no other
                 function and this function is not called otherwise.

    - overlayfs: Simplify by always calling vfs_getattr_nosec in
                 ovl_getattr. From there the flag is passed to no other
                 function and this function is not called otherwise.

    The query_flags in vfs_getattr_nosec will mask-out AT_GETATTR_NOSEC from
    any caller using AT_STATX_SYNC_TYPE as mask so that the flag is not
    important inside this function. Also, since no filesystem is checking the
    flag anymore, remove the flag entirely now, including the BUG_ON check that
    never triggered.

    The net change of the changes here combined with the original commit is
    that ecryptfs and overlayfs do not call vfs_getattr but only
    vfs_getattr_nosec.

    Fixes: 8a924db2d7 ("fs: Pass AT_GETATTR_NOSEC flag to getattr interface function")
    Reported-by: Al Viro <viro@zeniv.linux.org.uk>
    Closes: https://lore.kernel.org/linux-fsdevel/20241101011724.GN1350452@ZenIV/T/#u
    Cc: Tyler Hicks <code@tyhicks.com>
    Cc: ecryptfs@vger.kernel.org
    Cc: Miklos Szeredi <miklos@szeredi.hu>
    Cc: Amir Goldstein <amir73il@gmail.com>
    Cc: linux-unionfs@vger.kernel.org
    Cc: Christian Brauner <brauner@kernel.org>
    Cc: linux-fsdevel@vger.kernel.org
    Reviewed-by: Christian Brauner <brauner@kernel.org>
    Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
    Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Signed-off-by: Ming Lei <ming.lei@redhat.com>
2025-05-21 18:17:33 +08:00
..
Kconfig
Makefile
crypto.c move asm/unaligned.h to linux/unaligned.h 2024-10-02 17:23:23 -04:00
debug.c
dentry.c
ecryptfs_kernel.h ecryptfs: move ecryptfs_xattr_handlers to .rodata 2023-10-09 16:24:17 +02:00
file.c splice: Use filemap_splice_read() instead of generic_file_splice_read() 2023-05-24 08:42:17 -06:00
inode.c fs: Simplify getattr interface function checking AT_GETATTR_NOSEC flag 2025-05-21 18:17:33 +08:00
keystore.c ecryptfs: Fix buffer size for tag 66 packet 2024-04-05 15:53:46 +02:00
kthread.c
main.c fs: ecryptfs: replace deprecated strncpy with strscpy 2024-04-24 16:57:38 -07:00
messaging.c
miscdev.c
mmap.c move asm/unaligned.h to linux/unaligned.h 2024-10-02 17:23:23 -04:00
read_write.c fs/ecryptfs: Use kmap_local_page() in ecryptfs_write() 2023-07-10 14:36:10 +02:00
super.c