Bug 745996 - RFE: svirt for xen
Summary: RFE: svirt for xen
Keywords:
Status: CLOSED DEFERRED
Alias: None
Product: Virtualization Tools
Classification: Community
Component: libvirt
Version: unspecified
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Libvirt Maintainers
QA Contact:
URL:
Whiteboard:
: 747662 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-10-13 15:27 UTC by Tim Flink
Modified: 2016-03-23 14:30 UTC (History)
15 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-03-23 14:30:34 UTC


Attachments (Terms of Use)

Description Tim Flink 2011-10-13 15:27:18 UTC
Description of problem:
I have a xen domain configured with an LVM snapshot as it's disk. When I try to start the domain from libvirt or xm, I get an error:
 "Error: Disk isn't accessible"

When I switch to permissive mode, the domain starts successfully.

The messages from audit.log are:

type=SYSCALL msg=audit(1318518578.324:133): arch=c000003e syscall=21 success=yes exit=0 a0=7f20dc05f020 a1=4 a2=7f2115c2e4c8 a3=7f21159b6770 items=0 ppid=1 pid=3498 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="xend" exe="/usr/bin/python" subj=system_u:system_r:xend_t:s0 key=(null)
type=AVC msg=audit(1318518578.580:134): avc:  denied  { open } for  pid=3499 comm="pygrub" name="dm-8" dev=devtmpfs ino=10346 scontext=system_u:system_r:xend_t:s0 tcontext=system_u:object_r:fixed_disk_device_t:s0 tclass=blk_file
type=SYSCALL msg=audit(1318518578.580:134): arch=c000003e syscall=2 success=yes exit=4 a0=2253a40 a1=0 a2=1ff a3=7fc3fdffe770 items=0 ppid=1225 pid=3499 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts7 ses=4294967295 comm="pygrub" exe="/usr/bin/python" subj=system_u:system_r:xend_t:s0 key=(null)


Version-Release number of selected component (if applicable):
selinux-policy-3.10.0-38

How reproducible:
every time

Steps to Reproduce:
1. start Xen domain
  
Actual results:
"Error: Disk isn't accessible"

Expected results:
Start domain

Additional info:

Comment 1 Daniel Walsh 2011-10-14 13:31:42 UTC
This looks like a libvirt error since it is supposed to change the label on the fixed disk.

Comment 2 Kyle 2011-10-22 11:34:47 UTC
*** Bug 747662 has been marked as a duplicate of this bug. ***

Comment 3 Pasi Karkkainen 2011-11-01 13:45:44 UTC
Anyone working on this bug?

Comment 4 Kyle 2011-11-01 14:43:38 UTC
Pasi: I don't think so... There's a known workaround, and given what it deals with it's easy to assume that whoever runs into the error would be able to work around it.

I'm just wondering if there's a fix for it - by default, virt-manager (and I'm guessing libvirt) create disk images for VMs. When I created a LVM-backed VM, I manually ran lvcreate, which doesn't label the resulting disk properly for use by xend. 

I don't think libvirt can solve this by itself unless it can relabel stuff, which I don't think it can - otherwise libvirt (and other programs) could subvert SELinux.

I think a note of which label to use could go into the Xen docs (either Fedora or Xen wiki), but I just ended up disabling SELinux on my dom0 instead of messing around with labels.

Comment 5 Daniel Walsh 2011-11-01 15:19:52 UTC
Well libvirt is in charge of labeling devices, Admins are not supposed to care at this point.

I guess the question is why is it running as xend_t rather then virt_t.


What is running as xend_t?

Comment 6 Kyle 2011-11-01 15:50:59 UTC
Ok, I'm a bit confused now. I agree that libvirt should be in charge of labelling devices. But if the LV is created *outside* of libvirt, I don't see how libvirt can relabel the device since libvirt doesn't 'own' the LV. Only way that I see would be to allow libvirt to access LVs.

My error (from bug 747662 which I closed as a dup of this bug) had comm="xend" scontext (source context?) = system_u:system_r:xend_t:s0 - so the xend daemon seems to be xend_t. As to why not virt_t I've got no clue.

Comment 7 Daniel Walsh 2011-11-01 16:38:53 UTC
OK lets step back, is libvirtd starting up the xen image?

Comment 8 Kyle 2011-11-01 16:45:04 UTC
In this specific case, for me, no, because I'm only trying with Xen, not virt-manager/virsh.

The bug author said he tried it with both libvirtd and Xen and ran into this bug.
===
However, if you're asking if libvirtd is directly starting up the xen image, then I'd also say no. From what I understand, libvirtd does tasks like checking the XML-based config file, convirting it into a form Xen can interpret, then hands the VM launching off to the respective hypervisor (Xen or KVM).

Comment 9 Daniel Walsh 2011-11-01 16:57:59 UTC
Well if libvirt is not fixing the label it is up to the administrator to fix the label.


# semanage fcontext -a -t xen_image_t /dev/dm-8
# restorecon -R -v /dev/dm-8

Comment 10 Kyle 2011-11-01 17:12:31 UTC
Yep, which is why I said in comment 4 that the correct labels for Xen LVs should probably just be noted somewhere rather than having this behaviour regarded as a bug.

It's an annoying interaction between xend and SELinux, but it's a consequence of  the fact that LVs are created outside of xend, but are still used by xend.

Comment 11 Fedora Admin XMLRPC Client 2011-11-30 19:32:44 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 12 Fedora Admin XMLRPC Client 2011-11-30 19:36:22 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 13 Fedora Admin XMLRPC Client 2011-11-30 19:43:41 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 14 Fedora Admin XMLRPC Client 2011-11-30 19:54:12 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 15 Cole Robinson 2012-06-07 19:38:20 UTC
The proper way here is to basically do svirt for xen. But I don't really see that happening anytime soon. Moving to the upstream tracker anyways since this is a big chunk of work.

However if basic xen guest creation with virt-manager creating a file image in the default location causes selinux errors, we should fix those, it might just be a virt-manager issue.

Comment 16 Cole Robinson 2016-03-23 14:30:34 UTC
This RFE isn't going to generate any change, so closing. Adding svirt like behavior to xen will be a big task, and no one that watches this tracker is likely to initiate it. You'd probably need to become a suse or citrix customer to get it implemented :)


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