Bug 1420825

Summary: Failed to setup network for pod. Statfs \"/proc/49939/ns/net\": no such file or directory
Product: Red Hat Enterprise Linux 7 Reporter: Jaroslav Henner <jhenner>
Component: container-selinuxAssignee: Lokesh Mandvekar <lsm5>
Status: CLOSED ERRATA QA Contact: Martin Jenner <mjenner>
Severity: high Docs Contact:
Priority: unspecified    
Version: 7.2CC: dwalsh, jhenner, lsu
Target Milestone: rcFlags: jhenner: needinfo-
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: container-selinux-2:2.9-2 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-03-02 19:11:20 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jaroslav Henner 2017-02-09 15:16:26 UTC
Description of problem:
The deployments of router on opensift-3.4 started failing. I found this in 

# oc describe pods router-1-deploy
...
  1m	1m	1	{kubelet ose3-master-828ml.828ml...}		Warning	FailedSync	Error syncing pod, skipping: failed to "SetupNetwork" for "router-1-deploy_default" with SetupNetworkError: "Failed to setup network for pod \"router-1-deploy_default(7e333bd8-eecb-11e6-802a-fa163eb77bb0)\" using network plugins \"cni\": failed to Statfs \"/proc/49939/ns/net\": no such file or directory; Skipping pod"

It smelled like a selinux issue and it seems it is.
# sudo setenforce 0

Fixed it:
  3s	3s	1	{kubelet ose3-master-828ml.828ml...}	spec.containers{deployment}	Normal	Created		Created container with docker id 626b82664835; Security:[seccomp=unconfined]
  3s	3s	1	{kubelet ose3-master-828ml.828ml.cmqe...}	spec.containers{deployment}	Normal	Started		Started container with docker id 626b82664835


Version-Release number of selected component (if applicable):
atomic-openshift-sdn-ovs-3.4.0.40-1.git.0.787e974.el7.x86_64
docker-1.12.6-2.el7.x86_64
selinux-policy-targeted-3.13.1-60.el7.noarch
container-selinux-2.7-1.el7.noarch


How reproducible:
Always

Steps to Reproduce:
1. Try deploying openshift with openshift-ansible
2. It will fail, so does manual issuing the command to create router
# oadm router jhenner-router --replicas=1 --service-account=router

[root@ose3-master-th4j5 cloud-user]# sudo audit2allow -a
#============= svirt_lxc_net_t ==============
allow svirt_lxc_net_t unconfined_service_t:process sigchld;

#============= unconfined_service_t ==============
allow unconfined_service_t svirt_lxc_net_t:process transition;

these rules seem to help.


Actual results:
router (and registry) pod failing to spawn.

type=AVC msg=audit(1486651160.007:6487): avc:  denied  { transition } for  pid=111533 comm="exe" path="/usr/bin/pod" dev="dm-2" ino=33601336 scontext=system_u:system_r:unconfined_service_t:s0 tcontext=system_u:system_r:svirt_lxc_net_t:s0:c0,c1 tclass=process
type=AVC msg=audit(1486651206.979:6537): avc:  denied  { sigchld } for  pid=112095 comm="docker-containe" scontext=system_u:system_r:svirt_lxc_net_t:s0:c4,c7 tcontext=system_u:system_r:unconfined_service_t:s0 tclass=process


Expected results:


Additional info:
Maybe it is needed to issue these commands to get the whole thing working:
# oadm policy add-scc-to-user privileged -z router
# oc deploy --cancel jhenner-router
# oc deploy --retry jhenner-router

Comment 2 Daniel Walsh 2017-02-13 15:17:56 UTC
This should be fixed in container-selinux-2.8
This is a blocker and needs to be rebuilt for RHEL ASAP.

Comment 3 Jaroslav Henner 2017-02-13 15:57:35 UTC
Note that I am not sure is this the proper place to report this bug. It also may be the case there is some problem with the router image which showed up as selinux denials. Maybe the code is now doing something it shouldn't do. I didn't check that. I just needed the system working and found that the two rules seems to help. I didn't pay any attention to security implications of them!

Comment 7 errata-xmlrpc 2017-03-02 19:11:20 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHEA-2017-0416.html