Hide Forgot
Description of problem: In qemu it's possible to set arbitrary "URIs" as backing sources. Where by "URI" I mean some qemu URI such as nbd://... eg: $ getenforce Enforcing $ nbdkit -r /usr/lib64/nbdkit/plugins/nbdkit-xz-plugin.so \ file=/tmp/f17x64.img.xz -f -U /tmp/socket & $ qemu-img create -f qcow2 -b 'nbd:unix:/tmp/socket' overlay.qcow2 Formatting 'overlay.qcow2', fmt=qcow2 size=34359738368 backing_file='nbd:unix:/tmp/socket' encryption=off cluster_size=65536 lazy_refcounts=off $ qemu-img info overlay.qcow2 image: overlay.qcow2 file format: qcow2 virtual size: 32G (34359738368 bytes) disk size: 196K cluster_size: 65536 backing file: nbd:unix:/tmp/socket <--- note $ guestfish -a overlay.qcow2 -i -v [...] libguestfs: [06549ms] launch libvirt guest libguestfs: error: could not create appliance through libvirt: internal error process exited while connecting to monitor: qemu-system-x86_64: -drive file=/tmp/overlay.qcow2,if=none,id=drive-scsi0-0-0-0,format=qcow2,cache=writeback: Failed to connect to socket: Permission denied qemu-system-x86_64: -drive file=/tmp/overlay.qcow2,if=none,id=drive-scsi0-0-0-0,format=qcow2,cache=writeback: could not open disk image /tmp/overlay.qcow2: Permission denied [code=1 domain=10] $ killall nbdkit ; rm /tmp/socket The SELinux error is: time->Mon Sep 23 15:44:55 2013 type=SYSCALL msg=audit(1379947495.028:30674): arch=c000003e syscall=42 success=no exit=-13 a0=d a1=7fff50eb1e80 a2=6e a3=b items=0 ppid=1 pid=13478 auid=1000 uid=1000 gid=1000 euid=1000 suid=1000 fsuid=1000 egid=1000 sgid=1000 fsgid=1000 ses=1 tty=(none) comm="qemu-system-x86" exe="/usr/bin/qemu-system-x86_64" subj=unconfined_u:system_r:svirt_t:s0:c244,c608 key=(null) type=AVC msg=audit(1379947495.028:30674): avc: denied { write } for pid=13478 comm="qemu-system-x86" name="socket" dev="dm-2" ino=1968389 scontext=unconfined_u:system_r:svirt_t:s0:c244,c608 tcontext=unconfined_u:object_r:user_tmp_t:s0 tclass=sock_file which indicates that the socket has not been relabelled. Version-Release number of selected component (if applicable): libvirt-1.0.5.5-1.fc19.x86_64 How reproducible: 100% Steps to Reproduce: 1. See above. Additional information: This works fine if SELinux is permissive.
BTW this is no mere theoretical oddity. It affects a useful use-case for virt-resize: http://rwmj.wordpress.com/2013/09/23/virt-resize-from-an-nbd-source/#content
Following those steps with F24 libvirt works fine... the appliance starts up (verified I could see seabios output in the logs). So this appears to be fixed