mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Moreland <smoreland@google.com>
To: Stephen Smalley <sds@tycho.nsa.gov>
Cc: paul@paul-moore.com, eparis@parisplace.org,
	keescook@chromium.org, anton@enomsg.org,
	Colin Cross <ccross@android.com>,
	tony.luck@intel.com, selinux@vger.kernel.org,
	linux-kernel@vger.kernel.org, kernel-team@android.com,
	"Connor O'Brien" <connoro@google.com>
Subject: Re: [PATCH] security: selinux: allow per-file labeling for bpffs
Date: Thu, 6 Feb 2020 09:41:41 -0800	[thread overview]
Message-ID: <CAKLm694DMH0JCpHuT4HgMd4yCNJZPFMpex8iEiRF9kRjPb0d6g@mail.gmail.com> (raw)
In-Reply-To: <c61fc8f6-55c2-c717-5090-e535b7bdbb4f@tycho.nsa.gov>

On Thu, Feb 6, 2020 at 9:35 AM Stephen Smalley <sds@tycho.nsa.gov> wrote:
>
> On 2/6/20 12:21 PM, Stephen Smalley wrote:
> > On 2/6/20 11:55 AM, Steven Moreland wrote:
> >> From: Connor O'Brien <connoro@google.com>
> >>
> >> Add support for genfscon per-file labeling of bpffs files. This allows
> >> for separate permissions for different pinned bpf objects, which may
> >> be completely unrelated to each other.
> >
> > Do you want bpf fs to also support userspace labeling of files via
> > setxattr()?  If so, you'll want to also add it to
> > selinux_is_genfs_special_handling() as well.
> >

Android doesn't currently have this use case.

> > The only caveat I would note here is that it appears that bpf fs
> > supports rename, link, unlink, rmdir etc by userspace, which means that
> > name-based labeling via genfscon isn't necessarily safe/stable.  See
> > https://github.com/SELinuxProject/selinux-kernel/issues/2
> >

Android restricts ownership of these files to a single process (bpfloader) and
so this isn't a concern in our architecture. Is it a concern in general?

> >> Change-Id: I03ae28d3afea70acd6dc53ebf810b34b357b6eb5
> >
> > Drop Change-Ids from patches submitted upstream please since they aren't
> > meaningful outside of Android.
> >

Yeah, will resubmit, thanks.

> >> Signed-off-by: Connor O'Brien <connoro@google.com>
> >> Signed-off-by: Steven Moreland <smoreland@google.com>
> >> ---
> >>   security/selinux/hooks.c | 1 +
> >>   1 file changed, 1 insertion(+)
> >>
> >> diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
> >> index de4887742d7c..4f9396e6ce8c 100644
> >> --- a/security/selinux/hooks.c
> >> +++ b/security/selinux/hooks.c
> >> @@ -872,6 +872,7 @@ static int selinux_set_mnt_opts(struct super_block
> >> *sb,
> >>           !strcmp(sb->s_type->name, "sysfs") ||
> >>           !strcmp(sb->s_type->name, "pstore") ||
> >>           !strcmp(sb->s_type->name, "binder") ||
> >> +        !strcmp(sb->s_type->name, "bpf") ||
> >>           !strcmp(sb->s_type->name, "cgroup") ||
> >>           !strcmp(sb->s_type->name, "cgroup2"))
> >>           sbsec->flags |= SE_SBGENFS;
> >>
>
> Also, your patch appears to be based on an old kernel and won't apply
> upstream; see
> https://github.com/SELinuxProject/selinux-kernel/blob/master/README.md
>

Will resubmit, thanks.

  reply	other threads:[~2020-02-06 17:41 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-06 16:55 Steven Moreland
2020-02-06 17:21 ` Stephen Smalley
2020-02-06 17:35   ` Stephen Smalley
2020-02-06 17:41     ` Steven Moreland [this message]
2020-02-06 18:12       ` Stephen Smalley
2020-02-12  3:17         ` Paul Moore
2020-02-12 17:46           ` Steven Moreland
2020-02-12 18:09             ` Stephen Smalley

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=CAKLm694DMH0JCpHuT4HgMd4yCNJZPFMpex8iEiRF9kRjPb0d6g@mail.gmail.com \
    --to=smoreland@google.com \
    --cc=anton@enomsg.org \
    --cc=ccross@android.com \
    --cc=connoro@google.com \
    --cc=eparis@parisplace.org \
    --cc=keescook@chromium.org \
    --cc=kernel-team@android.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paul@paul-moore.com \
    --cc=sds@tycho.nsa.gov \
    --cc=selinux@vger.kernel.org \
    --cc=tony.luck@intel.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

all inboxes | Powered by JetHome®