Linux Security Modules development
 help / color / mirror / Atom feed
From: Christian Brauner <brauner@kernel.org>
To: Paul Moore <paul@paul-moore.com>
Cc: Ondrej Mosnacek <omosnace@redhat.com>,
	Alexander Viro <viro@zeniv.linux.org.uk>,
	linux-fsdevel@vger.kernel.org,
	linux-security-module@vger.kernel.org, selinux@vger.kernel.org,
	linux-kernel@vger.kernel.org, Martin Pitt <mpitt@redhat.com>
Subject: Re: [PATCH v2] fs: don't audit the capability check in simple_xattr_list()
Date: Sat, 5 Nov 2022 12:34:13 +0100	[thread overview]
Message-ID: <20221105113413.lzgwdlcobmliq32b@wittgenstein> (raw)
In-Reply-To: <CAHC9VhS460B4Jpk8kqmhTBZv_dMuysNb9yH=6hB4-+Oc35UkAQ@mail.gmail.com>

On Sat, Nov 05, 2022 at 12:38:57AM -0400, Paul Moore wrote:
> On Thu, Nov 3, 2022 at 11:13 AM Ondrej Mosnacek <omosnace@redhat.com> wrote:
> >
> > 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@redhat.com>
> > Suggested-by: Christian Brauner (Microsoft) <brauner@kernel.org>
> > Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
> > ---
> >
> > v1 -> v2: switch to simpler and better solution as suggested by Christian
> >
> > v1: https://lore.kernel.org/selinux/CAFqZXNuC7c0Ukx_okYZ7rsKycQY5P1zpMPmmq_T5Qyzbg-x7yQ@mail.gmail.com/T/
> >
> >  fs/xattr.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> VFS folks, this should really go through a vfs tree, but if nobody
> wants to pick it up *and* there are no objections to the change, I can
> take this via the LSM tree.

I can pick this up as I'm currently massaging the simple xattr
infrastructure. I think the fix is pretty straightforward otherwise.

Christian

  reply	other threads:[~2022-11-05 11:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-03 15:12 [PATCH v2] fs: don't audit the capability check in simple_xattr_list() Ondrej Mosnacek
2022-11-03 15:30 ` Christian Brauner
2022-11-05  4:38 ` Paul Moore
2022-11-05 11:34   ` Christian Brauner [this message]
2022-11-06 22:50     ` Paul Moore

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221105113413.lzgwdlcobmliq32b@wittgenstein \
    --to=brauner@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=mpitt@redhat.com \
    --cc=omosnace@redhat.com \
    --cc=paul@paul-moore.com \
    --cc=selinux@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox