From: Dominick Grift <dac.override@gmail.com>
To: Stephen Smalley <sds@tycho.nsa.gov>
Cc: Jeffrey Vander Stoep <jeffv@google.com>,
selinux@vger.kernel.org, Joel Galenson <jgalenson@google.com>,
Petr Lautrbach <plautrba@redhat.com>,
Paul Moore <paul@paul-moore.com>,
Ondrej Mosnacek <omosnace@redhat.com>
Subject: Re: Mislabeled /proc/<pid>/ns/mnt files?
Date: Fri, 10 May 2019 16:40:40 +0200 [thread overview]
Message-ID: <20190510144040.GF5967@brutus.lan> (raw)
In-Reply-To: <31b10fd2-bb1b-1a01-9bc3-f876404449a5@tycho.nsa.gov>
[-- Attachment #1: Type: text/plain, Size: 3785 bytes --]
On Fri, May 10, 2019 at 10:28:50AM -0400, Stephen Smalley wrote:
> On 5/10/19 3:12 AM, Dominick Grift wrote:
> > On Thu, May 09, 2019 at 02:47:30PM -0700, Jeffrey Vander Stoep wrote:
> > > From: Stephen Smalley <sds@tycho.nsa.gov>
> > > Date: Thu, May 9, 2019 at 2:17 PM
> > > To: Jeffrey Vander Stoep, <selinux@vger.kernel.org>, Joel Galenson,
> > > Petr Lautrbach
> > >
> > > > On 5/9/19 3:56 PM, Jeffrey Vander Stoep wrote:
> > > > > I expected files here would have the process's context, but they
> > > > > don't. The files are actually all symlinks so it's entirely possible
> > > > > that the they shouldn't have the process's context. If that's the
> > > > > case, how can I provide different labels for them? Neither "proc" nor
> > > > > "unlabeled" are appropriate.
> > > > >
> > > > > On a device with a 3.18 kernel they have the "proc" context:
> > > > > sailfish:/ # ls -LZ1 /proc/1/ns
> > > > > u:object_r:proc:s0 mnt
> > > > > u:object_r:proc:s0 net
> > > > >
> > > > > On a device with the 4.9 kernel the have the "unlabeled" context:
> > > > > blueline:/ # ls -LZ1 /proc/1/ns
> > > > > u:object_r:unlabeled:s0 cgroup
> > > > > u:object_r:unlabeled:s0 mnt
> > > > > u:object_r:unlabeled:s0 net
> > > >
> > > > First, ls -L dereferences symlinks so you are going to get the context
> > > > of the object referenced by the symlink, not the context of the symlink
> > > > itself.
> > >
> > > I'm seeing a denial on the object not the symlink, so -L is what I want.
> > >
> > > >
> > > > Second, the task context is only assigned to proc inodes created via
> > > > proc_pid_make_inode(), which has never been the case of /proc/pid/ns
> > > > inodes - those have their own implementations and operations.
> > > >
> > > > Third, /proc/pid/ns migrated from proc to its own pseudo filesystem,
> > > > nsfs, which requires a corresponding fs_use or genfscon rule in policy
> > > > or they will be unlabeled. refpolicy has a genfscon rule. Confusingly
> > > > there appears to be both in Fedora policy, a fs_use_task and a genfscon
> > > > rule, and it appears that fs_use_task is being applied here. I don't
> > > > know why or what exactly that means. It won't be the task context for
> > > > the task associated with that /proc/pid directory but instead would be
> > > > whichever task context instantiates the inode.
> > > >
> > >
> > > So, how do I label these files in genfs_contexts?
> > >
> > > "mount | grep nsfs" returns nothing.
> >
> > # seinfo --genfs | grep nsfs
> > genfscon nsfs / sys.id:sys.role:fs.nsfs.fs:s0
> >
> > Yes, i think this is a step backwards. In the past we got a nice list of objects that have no context associated when policy is loaded.
> > That list was removed. So sometimes its hard to determine whether something needs a genfscon if its not listen with `mount.
>
> So, to be specific, commit 2088d60e3b2f53d0c9590a0202eeff85b288b1eb
> ("selinux: quiet the filesystem labeling behavior message") removed the
> logging of which filesystem labeling behavior was selected for each
> filesystem, and then the last remnant was dropped by commit
> 270e8573145a26de924e2dc644596332d400445b ("selinux: Remove redundant check
> for unknown labeling behavior"). The second commit makes sense given the
> prior one, but perhaps we do need/want to retain some kind of log message
> when mounting a filesystem that is not configured for labeling (i.e.
> SECURITY_FS_USE_NONE)? We could add back a log message just for that case
> without reverting the other changes.
I would appreciate that, yes.
--
Key fingerprint = 5F4D 3CDB D3F8 3652 FBD8 02D5 3B6C 5F1D 2C7B 6B02
https://sks-keyservers.net/pks/lookup?op=get&search=0x3B6C5F1D2C7B6B02
Dominick Grift
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]
next prev parent reply other threads:[~2019-05-10 14:40 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-09 19:56 Mislabeled /proc/<pid>/ns/mnt files? Jeffrey Vander Stoep
2019-05-09 21:11 ` Stephen Smalley
2019-05-09 21:47 ` Jeffrey Vander Stoep
2019-05-10 7:12 ` Dominick Grift
2019-05-10 14:28 ` Stephen Smalley
2019-05-10 14:40 ` Dominick Grift [this message]
[not found] ` <CAB9W1A2LPEk_XixkFU5mVgr9c2yNoiGzBjXYjpc3vDM1b2VpyA@mail.gmail.com>
2019-05-10 12:38 ` Stephen Smalley
2019-05-10 14:55 ` Stephen Smalley
2019-05-14 20:13 ` 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=20190510144040.GF5967@brutus.lan \
--to=dac.override@gmail.com \
--cc=jeffv@google.com \
--cc=jgalenson@google.com \
--cc=omosnace@redhat.com \
--cc=paul@paul-moore.com \
--cc=plautrba@redhat.com \
--cc=sds@tycho.nsa.gov \
--cc=selinux@vger.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).