]> xenbits.xensource.com Git - libvirt.git/commit
qemuDomainSaveMemory: Don't enforce dynamicOwnership
authorMichal Privoznik <mprivozn@redhat.com>
Tue, 26 Jun 2018 13:34:21 +0000 (15:34 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Wed, 25 Jul 2018 06:14:54 +0000 (08:14 +0200)
commit8c8c32339ae965fa6991462e98be1f5890ac7499
tree7f0a8311e52c22bb44ec4c6cd6eb4dc470698752
parent149f0c4e00f738a0a444325db9e2e81979256d65
qemuDomainSaveMemory: Don't enforce dynamicOwnership

https://bugzilla.redhat.com/show_bug.cgi?id=1589115

When doing a memory snapshot qemuOpenFile() is used. This means
that the file where memory is saved is firstly attempted to be
created under root:root (because that's what libvirtd is running
under) and if this fails the second attempt is done under
domain's uid:gid. This does not make much sense - qemu is given
opened FD so it does not need to access the file. Moreover, if
dynamicOwnership is set in qemu.conf and the file lives on a
squashed NFS this is deadly combination and very likely to fail.

The fix consists of using:

  qemuOpenFileAs(fallback_uid = cfg->user,
                 fallback_gid = cfg->group,
                 dynamicOwnership = false)

In other words, dynamicOwnership is turned off for memory
snapshot (chown() will still be attempted if the file does not
live on NFS) and instead of using domain DAC label, configured
user:group is set as fallback.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/qemu/qemu_driver.c