[libvirt] [PATCHv5 17/28] security: DAC: Implement per-image seclabel restore

Eric Blake eblake at redhat.com
Tue Jul 8 23:17:29 UTC 2014


On 07/04/2014 05:29 AM, Peter Krempa wrote:
> Refactor the existing code to allow re-using it for the per-image label
> restore too.
> ---
>  src/security/security_dac.c | 59 ++++++++++++++++++++++++---------------------
>  1 file changed, 31 insertions(+), 28 deletions(-)
> 

> 
> -    secdef = virDomainDefGetSecurityLabelDef(def, SECURITY_DAC_NAME);
> +    /* Don't restore labels on readoly/shared disks, because other VMs may
> +     * still be accessing these Alternatively we could iterate over all running

Pre-existing typo, but s/these/these./

> +     * domains and try to figure out if it is in use, but this would not work
> +     * for clustered filesystems, since we can't see running VMs using the file
> +     * on other nodes Safest bet is thus to skip the restore step.

s/nodes/nodes./


> -    /* If we have a shared FS & doing migrated, we must not
> -     * change ownership, because that kills access on the
> -     * destination host which is sub-optimal for the guest
> -     * VM's I/O attempts :-)
> +    /* If we have a shared FS & doing migrated, we must not change ownership,

s/doing migrated/are doing migration/

> +     * because that kills access on the destination host which is sub-optimal
> +     * for the guest VM's I/O attempts :-)

Technically, changing SELinux labels kills guests (that takes effect
immediately); but per POSIX, calling chmod() should not (as chmod only
affects future open() calls, but not already-open fds).  But then you
throw in non-POSIX NFS, and there we have a case where chmod() can kill
access to open fds (naughty NFS).  So this comment is true, but only
because of botched file systems :)

ACK with comment cleanups.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 604 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140708/5fdb24dc/attachment-0001.sig>


More information about the libvir-list mailing list