Bug 753395

Summary: virsh iface-start and iface-destroy commands lead to a "very long wait" before finally succeeding
Product: [Fedora] Fedora Reporter: Laine Stump <laine>
Component: selinux-policyAssignee: Miroslav Grepl <mgrepl>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 16CC: dominick.grift, dwalsh, mgrepl
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: selinux-policy-3.10.0-56.fc16 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 753396 (view as bug list) Environment:
Last Closed: 2011-11-21 00:00:45 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 753396    

Description Laine Stump 2011-11-12 08:17:03 UTC
Description of problem:

With "setenforce enforcing" and NetworkManager enabled, any use of libvirt's "virsh iface-start" or "virsh iface-destroy" commands leads to a very long delay (didn't time it, but at least one minute) before the command finally succeeds. During this time, /var/log/audit/audit.log shows the following AVC about once per second:

type=USER_AVC msg=audit(1321058847.893:372): user pid=1906 uid=81 auid=4294967295 ses=4294967295 subj=system_u:system_r:system_dbusd_t:s0-s0:c0.c1023 msg='avc:  denied  { send_msg } for msgtype=method_return dest=:1.103 spid=1917 tpid=10568 scontext=system_u:system_r:NetworkManager_t:s0 tcontext=system_u:system_r:virtd_t:s0-s0:c0.c1023 tclass=dbus : exe="/bin/dbus-daemon" sauid=81 hostname=? addr=? terminal=?'

How reproducible: 100%


Steps to Reproduce:
1. enable NetworkManager (may not be necessary, haven't checked)
2. setenforce enforcing
3. virsh iface-destroy [some interface you can live without for a minute]
  
Actual results:

Very long wait before success

Expected results:

Success within a few seconds (may take several seconds if using DHCP on the interface)

Additional info:

virsh iface-start and virsh iface-destroy are simply calling functions in the netcf library that exec /sbin/ifup and /sbin/ifdown. These shell scripts then call nmcli to do the actual work. dbus-daemon then at some point tries to send a message to nmcli. For some reason, rather than failing immediately, it retries about once a second for a long time, and then the operation succeeds anyway (not the send-msg, but the higher level "ifup/ifdown" operation).

ncftool has similar commands "ncftool ifup" and "ncftool ifdown" which succeed immediately as expected.

On eparis' advice, I created the following temporary policy module, which fixed the problem on my system:

module nmvirttemp 1.0;

require {
	type virtd_t;
	type NetworkManager_t;
	class dbus send_msg;
}

#============= NetworkManager_t ==============
allow NetworkManager_t virtd_t:dbus send_msg;

After discovering this problem on F16, I checked my F14 box and it has the same problem, so I assume it's also a problem on F14. I'm not sure when this crept in - I always run all my boxes with selinux enforcing, but hadn't done anything with these functions recently.

Comment 1 Miroslav Grepl 2011-11-14 11:18:10 UTC
Fixed in selinux-policy-3.10.0-56.fc16

Comment 2 Fedora Update System 2011-11-16 15:22:54 UTC
selinux-policy-3.10.0-56.fc16 has been submitted as an update for Fedora 16.
https://admin.fedoraproject.org/updates/selinux-policy-3.10.0-56.fc16

Comment 3 Fedora Update System 2011-11-17 23:30:36 UTC
Package selinux-policy-3.10.0-56.fc16:
* should fix your issue,
* was pushed to the Fedora 16 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing selinux-policy-3.10.0-56.fc16'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2011-16003/selinux-policy-3.10.0-56.fc16
then log in and leave karma (feedback).

Comment 4 Fedora Update System 2011-11-21 00:00:45 UTC
selinux-policy-3.10.0-56.fc16 has been pushed to the Fedora 16 stable repository.  If problems still persist, please make note of it in this bug report.