Patch "fs: don't audit the capability check in simple_xattr_list()" has been added to the 5.4-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    fs: don't audit the capability check in simple_xattr_list()

to the 5.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     fs-don-t-audit-the-capability-check-in-simple_xattr_.patch
and it can be found in the queue-5.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 7001106a08fb4fc4cd38d2ee710cd421a52bff0d
Author: Ondrej Mosnacek <omosnace@xxxxxxxxxx>
Date:   Thu Nov 3 16:12:05 2022 +0100

    fs: don't audit the capability check in simple_xattr_list()
    
    [ Upstream commit e7eda157c4071cd1e69f4b1687b0fbe1ae5e6f46 ]
    
    The check being unconditional may lead to unwanted denials reported by
    LSMs when a process has the capability granted by DAC, but denied by an
    LSM. In the case of SELinux such denials are a problem, since they can't
    be effectively filtered out via the policy and when not silenced, they
    produce noise that may hide a true problem or an attack.
    
    Checking for the capability only if any trusted xattr is actually
    present wouldn't really address the issue, since calling listxattr(2) on
    such node on its own doesn't indicate an explicit attempt to see the
    trusted xattrs. Additionally, it could potentially leak the presence of
    trusted xattrs to an unprivileged user if they can check for the denials
    (e.g. through dmesg).
    
    Therefore, it's best (and simplest) to keep the check unconditional and
    instead use ns_capable_noaudit() that will silence any associated LSM
    denials.
    
    Fixes: 38f38657444d ("xattr: extract simple_xattr code from tmpfs")
    Reported-by: Martin Pitt <mpitt@xxxxxxxxxx>
    Suggested-by: Christian Brauner (Microsoft) <brauner@xxxxxxxxxx>
    Signed-off-by: Ondrej Mosnacek <omosnace@xxxxxxxxxx>
    Reviewed-by: Christian Brauner (Microsoft) <brauner@xxxxxxxxxx>
    Reviewed-by: Paul Moore <paul@xxxxxxxxxxxxxx>
    Signed-off-by: Christian Brauner (Microsoft) <brauner@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/fs/xattr.c b/fs/xattr.c
index f2854570d411..ee78012ec3a5 100644
--- a/fs/xattr.c
+++ b/fs/xattr.c
@@ -1013,7 +1013,7 @@ static int xattr_list_one(char **buffer, ssize_t *remaining_size,
 ssize_t simple_xattr_list(struct inode *inode, struct simple_xattrs *xattrs,
 			  char *buffer, size_t size)
 {
-	bool trusted = capable(CAP_SYS_ADMIN);
+	bool trusted = ns_capable_noaudit(&init_user_ns, CAP_SYS_ADMIN);
 	struct simple_xattr *xattr;
 	ssize_t remaining_size = size;
 	int err = 0;



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux