]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commit
storage: qemu: Fix security labelling of new image chain elements
authorPeter Krempa <pkrempa@redhat.com>
Wed, 19 Nov 2014 17:54:43 +0000 (18:54 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Fri, 21 Nov 2014 08:28:26 +0000 (09:28 +0100)
commit7e130e8b3505ce0f821081dffde8c13a7ff921b3
treee5bf9de5f71a88e8560575b473f31ec1abd2343d
parentbe90aa002621a6f0693f56aa5421186ca94c169e
storage: qemu: Fix security labelling of new image chain elements

When creating a disk image snapshot the libvirt code would blindly copy
the parents label to the newly created image. This runs into problems
when you start a VM from an image hosted on NFS (or other storage system
that doesn't support selinux labels) and the snapshot destination is on
a storage system that does support selinux labels. Libvirt's code in
that case generates a different security label for the image hosted on
NFS. This label is valid only for NFS images and doesn't allow access in
case of a locally stored image.

To fix this issue libvirt needs to refrain from copying security
information in cases where the default domain seclabel is a better
choice.

This patch repurposes the now unused @force argument of
virStorageSourceInitChainElement to denote whether a copy of the
security labelling stuff should be attempted or not. This allows to
fine-control the copy operation for cases where we need to keep the
label of the old disk vs. the cases where we need to keep the label
unset to use the default domain imagelabel.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1151718
src/qemu/qemu_driver.c
src/qemu/qemu_process.c
src/util/virstoragefile.c