Summary: SELinux is preventing /usr/sbin/libvirtd from creating a file with a context of svirt_image_t on a filesystem. Detailed Description: SELinux is preventing libvirtd from creating a file with a context of svirt_image_t on a filesystem. Usually this happens when you ask the cp command to maintain the context of a file when copying between file systems, "cp -a" for example. Not all file contexts should be maintained between the file systems. For example, a read-only file type like iso9660_t should not be placed on a r/w system. "cp -P" might be a better solution, as this will adopt the default file context for the destination. Allowing Access: Use a command like "cp -P" to preserve all permissions except SELinux context. Additional Information: Source Context system_u:object_r:svirt_image_t:s0:c825,c887 Target Context system_u:object_r:sysfs_t:s0 Target Objects resource [ filesystem ] Source libvirtd Source Path /usr/sbin/libvirtd Port <Unknown> Host (removed) Source RPM Packages libvirt-0.7.1-15.fc12 Target RPM Packages Policy RPM selinux-policy-3.6.32-92.fc12 Selinux Enabled True Policy Type targeted Enforcing Mode Enforcing Plugin Name filesystem_associate Host Name (removed) Platform Linux (removed) 2.6.32.9-70.fc12.x86_64 #1 SMP Wed Mar 3 04:40:41 UTC 2010 x86_64 x86_64 Alert Count 1 First Seen Thu 11 Mar 2010 04:38:17 PM PST Last Seen Thu 11 Mar 2010 04:38:17 PM PST Local ID 26d8aacd-208c-46ad-8895-9cc33a9d38e8 Line Numbers Raw Audit Messages node=(removed) type=AVC msg=audit(1268354297.607:28584): avc: denied { associate } for pid=9574 comm="libvirtd" name="resource" dev=sysfs ino=2367 scontext=system_u:object_r:svirt_image_t:s0:c825,c887 tcontext=system_u:object_r:sysfs_t:s0 tclass=filesystem node=(removed) type=SYSCALL msg=audit(1268354297.607:28584): arch=c000003e syscall=188 success=no exit=-13 a0=7fb2e8dc4830 a1=3cb1815669 a2=7fb2e8d616a0 a3=2d items=0 ppid=1 pid=9574 auid=500 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=1 comm="libvirtd" exe="/usr/sbin/libvirtd" subj=unconfined_u:system_r:virtd_t:s0-s0:c0.c1023 key=(null) Hash String generated from filesystem_associate,libvirtd,svirt_image_t,sysfs_t,filesystem,associate audit2allow suggests: #============= svirt_image_t ============== allow svirt_image_t sysfs_t:filesystem associate;
Does this mean sysfs now supports labeling?
With a new enough kernel, yes, sysfs does support labeling
Specifically 2.6.32 and later. The sysfs labeling support was added for this purpose, to allow libvirt to label the nodes. The policy should still use genfscon for it though to provide a default label for the sysfs nodes, but userspace can relabel as long as it is allowed by policy.
Created attachment 399702 [details] Miroslav add this patch to allow this access. Add this patch to allow libvirt to set svirt_image_t label on sysfs.
Dan - we do NOT want fs_use_xattr for sysfs. That tells SELinux to use ->getxattr() to fetch the initial value for sysfs inodes. Instead, we want to keep genfscon, but the kernel has changed (as of 2.6.32 and later) to allow userspace to override the genfscon default via setxattr/setfilecon.
So just removing fs_use_xattr sysfs gen_context(system_u:object_r:sysfs_t,s0); is fine. and add the associate functions.
Fixed in selinux-policy-3.6.32-102.fc12
selinux-policy-3.6.32-103.fc12 has been submitted as an update for Fedora 12. http://admin.fedoraproject.org/updates/selinux-policy-3.6.32-103.fc12
selinux-policy-3.6.32-103.fc12 has been pushed to the Fedora 12 testing repository. If problems still persist, please make note of it in this bug report. If you want to test the update, you can install it with su -c 'yum --enablerepo=updates-testing update selinux-policy'. You can provide feedback for this update here: http://admin.fedoraproject.org/updates/selinux-policy-3.6.32-103.fc12
selinux-policy-3.6.32-103.fc12 has been pushed to the Fedora 12 stable repository. If problems still persist, please make note of it in this bug report.