]> xenbits.xensource.com Git - libvirt.git/commit
security_(dac|selinux): Unref remembered security labels on outgoing migration
authorPeter Krempa <pkrempa@redhat.com>
Fri, 2 Aug 2024 13:23:42 +0000 (15:23 +0200)
committerAndrea Bolognani <abologna@redhat.com>
Thu, 3 Oct 2024 11:29:26 +0000 (13:29 +0200)
commiteabeae605f234a5c14411e04c22a4ff1238963d2
tree474cf664065afd514ee9769825f69311aef2f24d
parent2983dd44c5106bfdb0d7d5e4d3a9d40678441f2e
security_(dac|selinux): Unref remembered security labels on outgoing migration

When 'qemuSecurityRestoreAllLabel' is called on outgoing migration it
skips the actual relabeling part of the images in dac/selinux drivers in
order to avoid cutting off access to the image.

As shared filesystems don't really support the trusted XATTR groups,
remembering of security labels never worked on those paths so we never
actually had remembered seclabels for images that could be migrated.

With recent changes we now support migration from local storage to
remote in case the admin declares it as shared. This means that in case
when the VM is started on local storage we'd actually store seclabels,
but when migrating out the XATTRs remembering the seclabels would not
actually be unref'd and thus the seclabels would leak.

As we can't know whether a remote host will be able to use the XATTRs or
not (but really it won't) and at the same time the destination side of
migration will actually call 'qemuSecuritySetAllLabel' setting/refing
it's own seclabels we really need to unref them on our side.

This patch adds the appropriate *RecallLabel() calls on the code paths
in which relabelling is skipped due to migration.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
src/security/security_dac.c
src/security/security_selinux.c