Bug 527003 - SELinux Fix Command Does Not Work (same instance as Bug #527002)
SELinux Fix Command Does Not Work (same instance as Bug #527002)
Status: CLOSED DUPLICATE of bug 515521
Product: Fedora
Classification: Fedora
Component: qemu (Show other bugs)
x86_64 Linux
low Severity medium
: ---
: ---
Assigned To: Glauber Costa
Fedora Extras Quality Assurance
: 527002 (view as bug list)
Depends On:
  Show dependency treegraph
Reported: 2009-10-02 20:47 EDT by Mark Walker
Modified: 2009-10-09 06:11 EDT (History)
10 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 527002
Last Closed: 2009-10-09 06:11:03 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Mark Walker 2009-10-02 20:47:05 EDT
+++ This bug was initially created as a clone of Bug #527002 +++

Description of problem:
SELinux consistently blocks qemu in virt-manager from running image, even after fixes applied multiple times.

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

How reproducible:
Start virtual machine.  Watch hang on boot from virtual hard drive.

Steps to Reproduce:
1. Open Virtual Machine Manager 0.7.0
2. Select VM to run
3. Run VM
Actual results:
VM hangs at "Booting from Hard Disk..."
Multiple AVC errors occur

Expected results:
VM to run as installed

Additional info:

Fix command does not help.


SELinux is preventing pt_chown (ptchown_t) "read write" to
/var/lib/libvirt/images/WinXP.img (svirt_image_t).

Detailed Description:

SELinux denied access requested by pt_chown. /var/lib/libvirt/images/WinXP.img
may be a mislabeled. /var/lib/libvirt/images/WinXP.img default SELinux type is
virt_image_t, but its current type is svirt_image_t. Changing this file back to
the default type, may fix your problem.

File contexts can be assigned to a file in the following ways.

  * Files created in a directory receive the file context of the parent
    directory by default.
  * The SELinux policy might override the default label inherited from the
    parent directory by specifying a process running in context A which creates
    a file in a directory labeled B will instead create the file with label C.
    An example of this would be the dhcp client running with the dhclient_t type
    and creates a file in the directory /etc. This file would normally receive
    the etc_t type due to parental inheritance but instead the file is labeled
    with the net_conf_t type because the SELinux policy specifies this.
  * Users can change the file context on a file using tools such as chcon, or

This file could have been mislabeled either by user error, or if an normally
confined application was run under the wrong domain.

However, this might also indicate a bug in SELinux because the file should not
have been labeled with this type.

If you believe this is a bug, please file a bug report
(http://bugzilla.redhat.com/bugzilla/enter_bug.cgi) against this package.

Allowing Access:

You can restore the default system context to this file by executing the
restorecon command. restorecon '/var/lib/libvirt/images/WinXP.img', if this file
is a directory, you can recursively restore using restorecon -R

Fix Command:

restorecon '/var/lib/libvirt/images/WinXP.img'

Additional Information:

Source Context                system_u:system_r:ptchown_t:s0:c660,c775
Target Context                system_u:object_r:svirt_image_t:s0:c660,c775
Target Objects                /var/lib/libvirt/images/WinXP.img [ file ]
Source                        pt_chown
Source Path                   /usr/libexec/pt_chown
Port                          <Unknown>
Host                          Penna
Source RPM Packages           glibc-common-2.10.1-5
Target RPM Packages           
Policy RPM                    selinux-policy-3.6.12-83.fc11
Selinux Enabled               True
Policy Type                   targeted
MLS Enabled                   True
Enforcing Mode                Enforcing
Plugin Name                   restorecon
Host Name                     Penna
Platform                      Linux Penna #1 SMP Fri Sep
                              25 04:43:32 EDT 2009 x86_64 x86_64
Alert Count                   2
First Seen                    Fri 02 Oct 2009 08:36:23 PM EDT
Last Seen                     Fri 02 Oct 2009 08:36:23 PM EDT
Local ID                      3f4d1b5a-d1f6-4fa6-a1bf-9a90355b561b
Line Numbers                  

Raw Audit Messages            

node=Penna type=AVC msg=audit(1254530183.927:29676): avc:  denied  { read write } for  pid=21358 comm="pt_chown" path="/var/lib/libvirt/images/WinXP.img" dev=dm-0 ino=139452 scontext=system_u:system_r:ptchown_t:s0:c660,c775 tcontext=system_u:object_r:svirt_image_t:s0:c660,c775 tclass=file

node=Penna type=AVC msg=audit(1254530183.927:29676): avc:  denied  { read write } for  pid=21358 comm="pt_chown" path="/dev/net/tun" dev=tmpfs ino=2635 scontext=system_u:system_r:ptchown_t:s0:c660,c775 tcontext=system_u:object_r:tun_tap_device_t:s0 tclass=chr_file

node=Penna type=SYSCALL msg=audit(1254530183.927:29676): arch=c000003e syscall=59 success=yes exit=0 a0=38ef734ebe a1=7fffcbfd9ef0 a2=0 a3=38f0417220 items=0 ppid=21354 pid=21358 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="pt_chown" exe="/usr/libexec/pt_chown" subj=system_u:system_r:ptchown_t:s0:c660,c775 key=(null)
Comment 1 Daniel Walsh 2009-10-03 06:36:49 EDT
This is actually a leaked file descriptor, but it is being triggered by a bug in anaconda.

If you fix the devpts like in /etc/fstab to look like 

devpts                  /dev/pts                devpts  gid=5,mode=620  0 0

And later reboot, you will not see this problem any longer.

The setroubleshoot should have noticed this as a leak.
Comment 2 Daniel Walsh 2009-10-03 06:38:27 EDT
I will fix the priority of the plugins for the next release, so leaks will fire before restorecon.
Comment 3 Daniel Walsh 2009-10-03 06:39:40 EDT
*** Bug 527002 has been marked as a duplicate of this bug. ***
Comment 4 Mark McLoughlin 2009-10-09 06:11:03 EDT
Okay, I've filed bug #528134 for dealing with the leak

Marking this as a dup of bug #515521

*** This bug has been marked as a duplicate of bug 515521 ***

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