]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commit
NFSv4.2: condition READDIR's mask for security label based on LSM state
authorOlga Kornievskaia <kolga@netapp.com>
Fri, 6 Nov 2020 21:03:38 +0000 (16:03 -0500)
committerPaolo Pisati <paolo.pisati@canonical.com>
Mon, 4 Jan 2021 15:37:11 +0000 (16:37 +0100)
commitc09d0dd78ea1544707ee58abb246ae5986e76bad
treecff1dc5ab2327cc20ed8c2ed450e8659fbfac043
parent9c966b485ed6f2daf0647f26d7710a4ce7133359
NFSv4.2: condition READDIR's mask for security label based on LSM state

BugLink: https://bugs.launchpad.net/bugs/1910111
[ Upstream commit 05ad917561fca39a03338cb21fe9622f998b0f9c ]

Currently, the client will always ask for security_labels if the server
returns that it supports that feature regardless of any LSM modules
(such as Selinux) enforcing security policy. This adds performance
penalty to the READDIR operation.

Client adjusts superblock's support of the security_label based on
the server's support but also current client's configuration of the
LSM modules. Thus, prior to using the default bitmask in READDIR,
this patch checks the server's capabilities and then instructs
READDIR to remove FATTR4_WORD2_SECURITY_LABEL from the bitmask.

v5: fixing silly mistakes of the rushed v4
v4: simplifying logic
v3: changing label's initialization per Ondrej's comment
v2: dropping selinux hook and using the sb cap.

Suggested-by: Ondrej Mosnacek <omosnace@redhat.com>
Suggested-by: Scott Mayhew <smayhew@redhat.com>
Signed-off-by: Olga Kornievskaia <kolga@netapp.com>
Fixes: 2b0143b5c986 ("VFS: normal filesystems (and lustre): d_inode() annotations")
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
fs/nfs/nfs4proc.c