From: Stephen Smalley <sds@tycho.nsa.gov>
To: "Roberts, William C" <william.c.roberts@intel.com>,
"seandroid-list@tycho.nsa.gov" <seandroid-list@tycho.nsa.gov>,
SELinux <selinux@tycho.nsa.gov>, Eric Paris <eparis@redhat.com>
Subject: Re: kernel access to device comm is kdevtmpfs
Date: Fri, 28 Aug 2015 09:21:35 -0400 [thread overview]
Message-ID: <55E0605F.7070002@tycho.nsa.gov> (raw)
In-Reply-To: <20150826140659.GA26572@x250>
On 08/26/2015 10:07 AM, Dominick Grift wrote:
> On Wed, Aug 26, 2015 at 09:47:31AM -0400, Stephen Smalley wrote:
>
> <snip>
>
>
>> Fedora has tried to work around this by defining name-based type
>> transitions for the kernel domain on /dev to label the device nodes
>> correctly on creation. However, name-based type transitions aren't well
>> suited to that purpose; they only support exact match (no prefix, glob,
>> or regex matching), they only match the last component, and they were
>> only intended to cover exceptional cases where regular type transitions
>> weren't sufficiently granular and one couldn't modify the creating
>> program to explicitly label the file based on file_contexts (so they
>> aren't designed to scale well). Maybe we could use genfs_contexts
>> instead (i.e. add devtmpfs to the list of filesystems that have
>> SE_SBGENFS set in sbsec->flags, then you can specify path prefixes
>> relative to the root of devtmpfs and label them that way).
>
> This sounds like a good idea to me.
Unfortunately, I was wrong. Merely setting SE_SBGENFS in sbsec->flags
for devtmpfs filesystems does NOT enable genfs_context-based labeling of
devtmpfs files, because devtmpfs is tmpfs-backed, and tmpfs, like ext4,
calls security_inode_init_security() upon new inode creation to
explicitly initialize the in-core inode security state and to obtain the
xattr name/value pair. That's why type transitions work for devtmpfs
(and tmpfs). Filesystems that use genfscon-based labeling (e.g. proc,
sysfs, debugfs, pstore) do not support userspace file creation and
therefore do not call that hook and their inode security state is
initialized upon security_d_instantiate(), at which point we have a
dentry and can therefore generate a path relative to the root.
So we can't do this as a one-liner patch; it would be more involved.
devtmpfs/tmpfs does ultimately call d_instantiate() ->
security_d_instantiate(), but at that point the inode security state is
already initialized in the usual way and we therefore don't do anything
further with it. We would need to rework the way inode security
initialization works, and do it in a way that avoids weird side effects
(e.g. if the policy defines a type transition, as in current Fedora
policy, we don't want to override that with a genfscon-based lookup).
next prev parent reply other threads:[~2015-08-28 13:21 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <476DC76E7D1DF2438D32BFADF679FC56010597CC@ORSMSX103.amr.corp.intel.com>
2015-08-26 13:47 ` kernel access to device comm is kdevtmpfs Stephen Smalley
2015-08-26 14:07 ` Dominick Grift
2015-08-28 13:21 ` Stephen Smalley [this message]
2015-08-28 14:11 ` William Roberts
2015-08-28 14:27 ` Dominick Grift
2015-08-28 14:58 ` William Roberts
2015-08-26 16:10 ` Nick Kralevich
2015-08-26 16:25 ` Stephen Smalley
2015-08-26 16:47 ` William Roberts
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=55E0605F.7070002@tycho.nsa.gov \
--to=sds@tycho.nsa.gov \
--cc=eparis@redhat.com \
--cc=seandroid-list@tycho.nsa.gov \
--cc=selinux@tycho.nsa.gov \
--cc=william.c.roberts@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.