selinux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ondrej Mosnacek <omosnace@redhat.com>
To: selinux@vger.kernel.org, Paul Moore <paul@paul-moore.com>,
	cgroups@vger.kernel.org, Tejun Heo <tj@kernel.org>
Cc: Stephen Smalley <sds@tycho.nsa.gov>,
	Li Zefan <lizefan@huawei.com>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Ondrej Mosnacek <omosnace@redhat.com>
Subject: [RFC PATCH 0/3] Fix SELinux context mount with the cgroup filesystem
Date: Thu, 13 Dec 2018 15:17:36 +0100	[thread overview]
Message-ID: <20181213141739.8534-1-omosnace@redhat.com> (raw)

This series contains three independent bugfixes that together make it possible
to mount the cgroup filesystem with the 'context=' option under SELinux.

The first patch is trivial and fixes cgroupfs to correctly handle the case when
the mount options are just an empty string.

The second patch fixes SELinux to always disallow relabeling inodes that
belong to a 'context=' mount.

The third patch fixes SELinux to ignore security_inode_notifysecctx() calls
on inodes that belong to a 'context=' mount.

Paul, Stephen, please have a quick look at the last two patches, I'm not 100%
sure that I understand the expected behavior of the context mounts correctly.
(My assumption is that in a context mount we want the whole subtree to be
labeled with the given label, no matter what.)

Also, I'm not entirely satisfied with the code style in the second patch (and
it produces an annoying false positive with checkpatch.pl), but I didn't see
a better way to write it...

I haven't had time to do much testing on the patches (other than the
reproducers mentioned in the commit messages). I'd like to make sure that
I'm going in the right direction first.

Thanks,

O.M.

--
Ondrej Mosnacek (3):
  cgroup: fix parsing empty mount option string
  selinux: never allow relabeling on context mounts
  selinux: do not override context on context mounts

 kernel/cgroup/cgroup.c   |  2 +-
 security/selinux/hooks.c | 48 ++++++++++++++++++++++++++++++----------
 2 files changed, 37 insertions(+), 13 deletions(-)

-- 
2.19.2


             reply	other threads:[~2018-12-13 14:19 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-13 14:17 Ondrej Mosnacek [this message]
2018-12-13 14:17 ` [RFC PATCH 1/3] cgroup: fix parsing empty mount option string Ondrej Mosnacek
2018-12-13 16:03   ` Tejun Heo
2018-12-28 15:14     ` Ondrej Mosnacek
2018-12-28 18:32       ` Tejun Heo
2018-12-13 14:17 ` [RFC PATCH 2/3] selinux: never allow relabeling on context mounts Ondrej Mosnacek
2018-12-13 16:18   ` Stephen Smalley
2018-12-18 15:38     ` Ondrej Mosnacek
2018-12-13 14:17 ` [RFC PATCH 3/3] selinux: do not override context " Ondrej Mosnacek
2018-12-13 16:27   ` Stephen Smalley
2018-12-18 15:50     ` Ondrej Mosnacek
2018-12-18 19:22       ` Stephen Smalley
2018-12-19 11:44         ` Ondrej Mosnacek

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=20181213141739.8534-1-omosnace@redhat.com \
    --to=omosnace@redhat.com \
    --cc=cgroups@vger.kernel.org \
    --cc=hannes@cmpxchg.org \
    --cc=lizefan@huawei.com \
    --cc=paul@paul-moore.com \
    --cc=sds@tycho.nsa.gov \
    --cc=selinux@vger.kernel.org \
    --cc=tj@kernel.org \
    /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).