selinux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: James Carter <jwcart2@gmail.com>
To: Ondrej Mosnacek <omosnace@redhat.com>
Cc: SElinux list <selinux@vger.kernel.org>,
	Stephen Smalley <stephen.smalley.work@gmail.com>,
	Paul Moore <paul@paul-moore.com>, Vivek Goyal <vgoyal@redhat.com>,
	Daniel Walsh <dwalsh@redhat.com>,
	Zdenek Pytela <zpytela@redhat.com>
Subject: Re: virtiofs and its optional xattr support vs. fs_use_xattr
Date: Mon, 7 Dec 2020 12:17:45 -0500	[thread overview]
Message-ID: <CAP+JOzSWW6HFtN1VSyvKacKeZdtRkBo7TWR7JS4a0ewiopuKww@mail.gmail.com> (raw)
In-Reply-To: <CAFqZXNsGabHBfV36nNAVLJgEzjkBev-O3YZ1vnmXyVoaDdjiHQ@mail.gmail.com>

On Mon, Dec 7, 2020 at 9:45 AM Ondrej Mosnacek <omosnace@redhat.com> wrote:
>
> Hi everyone,
>
> In [1] we ran into a problem with the current handling of filesystem
> labeling rules. Basically, it is only possible to specify either
> genfscon or fs_use_xattr for a given filesystem, but in the case of
> virtiofs, certain mounts may support security xattrs, while other ones
> may not.
>
> So we can't use the xattr support by adding fs_use_xattr virtiofs
> (...); to the policy, because then a non-xattr mount will fail
> (SELinux does a mount-time check on the root inode to make sure that
> the xattr handler works), but we also don't want to stay on genfscon,
> because then we can't relabel files.
>
> So my question is how to best address this? One option is to use a
> similar "hack" as for cgroupfs; i.e. do a kind of mixed genfs-xattr
> labeling, but that's ugly and requires hard-coding another FS name in
> the selinux code. The only other alternative I could come up with is
> to add a new FS labeling statement that would specify some kind of
> mixed genfscon / fs_use_xattr behavior. That would be a better
> long-term solution, but leads to more questions on how such statement
> should actually work... Should it work the cgroupfs way, giving a
> default label to everything and allowing to set/change labels via
> xattrs? Or should it rather just detect xattrs support and switch
> between SECURITY_FS_USE_XATTR and SECURITY_FS_USE_GENFS behavior based
> on that? In the latter case, should the statement specify two contexts
> (one for fs_use_xattr and another one for genfscon) or just one for
> both behaviors?
>

I don't think adding a new statement is necessary. It seems like
allowing both fs_use_xattr and genfscon rules for the filesystem in
policy and then using the fs_use_xattr rule if xattrs are supported
while falling back to the genfscon rule if they are not would do what
you need.

Jim

> Any thoughts/pointers welcome.
>
> [1] https://github.com/fedora-selinux/selinux-policy/pull/478
>
> --
> Ondrej Mosnacek
> Software Engineer, Platform Security - SELinux kernel
> Red Hat, Inc.
>

  parent reply	other threads:[~2020-12-07 17:18 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-07 14:42 virtiofs and its optional xattr support vs. fs_use_xattr Ondrej Mosnacek
2020-12-07 15:03 ` Paul Moore
2020-12-07 20:52   ` Vivek Goyal
2020-12-07 21:22     ` Dominick Grift
2020-12-08 14:33       ` Vivek Goyal
2020-12-08 15:13         ` Dominick Grift
2020-12-08 23:41     ` Paul Moore
2020-12-07 17:17 ` James Carter [this message]
2020-12-08 23:45   ` Paul Moore
2020-12-09 15:37     ` James Carter
2020-12-10  2:39       ` Paul Moore
2020-12-10  9:29         ` Ondrej Mosnacek
2020-12-10 22:17           ` Vivek Goyal
2020-12-10 22:24             ` Ondrej Mosnacek
2020-12-10 22:30               ` Vivek Goyal
2020-12-11  9:15                 ` Ondrej Mosnacek
2020-12-11 13:29                   ` Vivek Goyal
2021-01-04 20:14                   ` Vivek Goyal
2021-01-05 14:00                     ` Ondrej Mosnacek
2021-01-05 14:21                       ` Vivek Goyal

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=CAP+JOzSWW6HFtN1VSyvKacKeZdtRkBo7TWR7JS4a0ewiopuKww@mail.gmail.com \
    --to=jwcart2@gmail.com \
    --cc=dwalsh@redhat.com \
    --cc=omosnace@redhat.com \
    --cc=paul@paul-moore.com \
    --cc=selinux@vger.kernel.org \
    --cc=stephen.smalley.work@gmail.com \
    --cc=vgoyal@redhat.com \
    --cc=zpytela@redhat.com \
    /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;
as well as URLs for NNTP newsgroup(s).