Bug 1266391 - BUG: SELinux is not properly labeling namespace files, e.g. "/proc/1/ns/net"
Summary: BUG: SELinux is not properly labeling namespace files, e.g. "/proc/1/ns/net"
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Miroslav Grepl
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-09-25 07:42 UTC by Jan Pazdziora
Modified: 2016-06-03 13:57 UTC (History)
25 users (show)

Fixed In Version:
Doc Type: Enhancement
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-06-03 13:57:25 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Jan Pazdziora 2015-09-25 07:42:50 UTC
Description of problem:

When docker.service is started or when docker run uses -p option, AVC denial is logged.

Version-Release number of selected component (if applicable):

docker-1.8.2-1.gitf1db8f2.fc22.x86_64
docker-selinux-1.8.2-1.gitf1db8f2.fc22.x86_64
selinux-policy-3.13.1-128.13.fc22.noarch

How reproducible:

Happening often, even if not 100% deterministic.

Steps to Reproduce:
1. dnf install -y docker
2. service docker start
3. docker run -ti -p 80:80 fedora:22 bash

Actual results:

AVC denial

avc:  denied  { read } for  pid=12032 comm="iptables" path="net:[4026531957]" dev="nsfs" ino=4026531957 scontext=system_u:system_r:iptables_t:s0 tcontext=system_u:object_r:unlabeled_t:s0 tclass=file permissive=0

Expected results:

No AVC denial.

Additional info:

Comment 2 Daniel Walsh 2015-09-25 14:42:50 UTC
This seems like an SELinux issue.  iptables has nothing to do with containers, other then working with the docker daemon.

Kernel guys any idea what net:[4026531957] file is?  And why it is unlabeled_t?

Comment 3 Jan Pazdziora 2015-09-25 14:54:08 UTC
(In reply to Daniel Walsh from comment #2)
> 
> Kernel guys any idea what net:[4026531957] file is?

I can see it as "target" of /proc/1/ns/net symlink and of many other processes, including the docker process.

Comment 4 Daniel Walsh 2015-09-25 14:56:28 UTC
ps -eZ | grep unlabeled_t

Comment 5 Paul Moore 2015-09-25 20:44:24 UTC
(In reply to Jan Pazdziora from comment #3)
> (In reply to Daniel Walsh from comment #2)
> > 
> > Kernel guys any idea what net:[4026531957] file is?
> 
> I can see it as "target" of /proc/1/ns/net symlink and of many other
> processes, including the docker process.

Yep, that looks like the network namespace file to me, although I'm not immediately sure why it is unlabeled.

Comment 6 Jan Pazdziora 2015-09-26 14:51:26 UTC
(In reply to Daniel Walsh from comment #4)
> ps -eZ | grep unlabeled_t

Nothing uncovered.

Comment 7 Miroslav Grepl 2015-10-12 12:27:31 UTC
We have more and more bugs like this where we see unlabeled_t related to docker.

Comment 8 Miroslav Grepl 2015-10-12 12:28:05 UTC
Is this a kernel issue?

Comment 9 Paul Moore 2015-10-12 15:10:40 UTC
It looks like it may be a kernel issue, I'll go ahead and reassign this BZ to take a closer look.

Comment 10 Daniel Walsh 2015-10-12 21:26:29 UTC
Yes it seems to be something with namespaces.

Comment 11 Justin M. Forbes 2015-10-20 19:40:11 UTC
*********** MASS BUG UPDATE **************

We apologize for the inconvenience.  There is a large number of bugs to go through and several of them have gone stale.  Due to this, we are doing a mass bug update across all of the Fedora 22 kernel bugs.

Fedora 22 has now been rebased to 4.2.3-200.fc22.  Please test this kernel update (or newer) and let us know if you issue has been resolved or if it is still present with the newer kernel.

If you have moved on to Fedora 23, and are still experiencing this issue, please change the version to Fedora 23.

If you experience different issues, please open a new bug report for those.

Comment 12 Dusty Mabe 2015-10-20 19:45:15 UTC
I still see this in F23.

Comment 13 Paul Moore 2015-10-20 21:40:39 UTC
Moving to Rawhide to avoid Fedora MASS BUG UPDATEs.

Comment 14 Jan Pazdziora 2015-10-21 06:22:25 UTC
Just please note that we will want it addressed in 22 as well, once the solution is found.

Comment 15 Paul Moore 2015-10-21 13:23:40 UTC
Once we know the root cause of the problem and have a solution in place we can backport to whatever versions of Fedora are currently supported.

Comment 16 Seb L. 2015-11-06 07:42:06 UTC
Hi,

See the AVC:

  avc:  denied  { read } for  pid=12032 comm="iptables" path="net:[4026531957]"
  dev="nsfs" ino=4026531957 scontext=system_u:system_r:iptables_t:s0
   tcontext=system_u:object_r:unlabeled_t:s0 tclass=file permissive=0

=> missing context for the nsfs device

Same cause as bug https://bugzilla.redhat.com/show_bug.cgi?id=1234757#c7 , same resolution (see nsfs_fix.patch to be applied to the selinux-policy repo: https://bugzilla.redhat.com/attachment.cgi?id=1090403 ).

Best regards,
Sébastien

Comment 17 Paul Moore 2016-06-02 19:57:16 UTC
Lukas, see Seb's comments in #16 and the other BZ, what do you think?

Comment 18 Lukas Vrabec 2016-06-03 10:54:48 UTC
Paul, 
I tried to reproduce this issue and I don't see any AVC. 

I added SELinux support for nsfs_t filesystem few months ago. 

I suggest to move this BZ to selinux-policy component and close it.

Comment 19 Paul Moore 2016-06-03 13:57:25 UTC
Okay, thanks for the follow-up on this; moving and closing.


Note You need to log in before you can comment on or make changes to this bug.