libvirt/src/qemu
Michal Privoznik 8fa0374c5b qemuProcessStop: Remove image metadata for running mirror jobs
If user starts a blockcommit or a blockcopy then we modify access
for qemu on both images and leave it like that until the job
terminates.  So far so good. Problem is, if user instead of
terminating the job (where we would modify the access again so
that the state before the job is restored) calls destroy on the
domain or if qemu dies whilst executing the block job.  In this
case we don't ever clear the access we granted at the beginning.
To fix this, maybe a bit harsh approach is used, but it works:
after all labels were restored (that is after
qemuSecurityRestoreAllLabel() was called), we iterate over each
disk in the domain and remove XATTRs from the whole backing chain
and also from any file the disk is being mirrored to.

This would have been done at the time of pivot, but it isn't
because user decided to kill the domain instead. If we don't do
this and leave some XATTRs behind the domain might be unable to
start.

Also, secdriver can't do this because it doesn't know if there is
any job running. It's outside of its scope - the hypervisor
driver is responsible for calling secdriver's APIs.

Moreover, this is safe to call because we don't remember labels
for any member of a backing chain except of the top layer. But
that one was restored in qemuSecurityRestoreAllLabel() call done
earlier. Therefore, not only we don't remember labels (and thus
this is basically a NOP for other images in the backing chain) it
is also safe to call this when no blockjob was started in the
first place, or if some parts of the backing chain are shared
with some other domains - this is NOP, unless a block job is
active at the time of domain destroy.

https://bugzilla.redhat.com/show_bug.cgi?id=1741456#c19

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2019-11-22 10:48:14 +01:00
..
EVENTHANDLERS.txt qemu/doc: Fix function name for handling events 2017-06-13 09:43:42 +02:00
MIGRATION.txt doc: fix writing of QEMU 2017-03-08 17:33:07 +01:00
Makefile.inc.am qemu: Remove qemu_hotplugpriv.h and qemuDomainRemoveDeviceWaitTime 2019-11-13 15:03:40 -05:00
THREADS.txt qemu: update threading info about domain object refs 2019-09-09 13:01:09 +02:00
libvirtd_qemu.aug qemu-conf: add configurable slirp-helper location 2019-09-06 12:47:47 +02:00
qemu.conf qemu: Warn verbosely if using old loader:nvram pairs 2019-11-12 08:34:37 +01:00
qemu_agent.c replace use of gnulib snprintf by g_snprintf 2019-11-15 15:07:40 +01:00
qemu_agent.h Add API to change qemu agent response timeout 2019-11-14 19:10:01 +01:00
qemu_alias.c qemu: Use g_strdup_printf() instead of virAsprintf() 2019-11-12 16:15:58 +01:00
qemu_alias.h qemu: add dbus-vmstate 2019-09-06 12:47:47 +02:00
qemu_block.c qemu: Separate image metadata removal into a function 2019-11-22 10:48:04 +01:00
qemu_block.h qemu: Separate image metadata removal into a function 2019-11-22 10:48:04 +01:00
qemu_blockjob.c qemu: Separate image metadata removal into a function 2019-11-22 10:48:04 +01:00
qemu_blockjob.h Use G_GNUC_WARN_UNUSED_RESULT instead of ATTRIBUTE_RETURN_CHECK 2019-10-15 11:25:22 +02:00
qemu_capabilities.c domcaps: Remove function initializing domain caps as unsupported 2019-11-22 08:16:51 +01:00
qemu_capabilities.h qemu: Introduce virQEMUCapsGetMachineDefaultCPU 2019-11-20 17:22:06 +01:00
qemu_capspriv.h qemu: Introduce virQEMUCapsProbeCPUDefinitionsTest 2019-11-20 17:22:06 +01:00
qemu_cgroup.c qemu: remove unneeded cleanup labels 2019-11-19 15:22:37 +01:00
qemu_cgroup.h Use G_GNUC_WARN_UNUSED_RESULT instead of ATTRIBUTE_RETURN_CHECK 2019-10-15 11:25:22 +02:00
qemu_checkpoint.c qemu: checkpoint: Use qemuMonitorTransactionBitmapMergeSourceAddBitmap 2019-11-20 15:43:11 +01:00
qemu_checkpoint.h qemu: checkpoint: Extract finalizing steps of checkpoint creation 2019-10-24 19:35:34 +02:00
qemu_command.c qemu: Instantiate pflash via -machine when using blockdev 2019-11-22 08:32:25 +01:00
qemu_command.h qemuBuildHostNetStr: remove unused 'driver' argument 2019-09-18 11:33:17 +02:00
qemu_conf.c qemu: Use g_strdup_printf() instead of virAsprintf() 2019-11-12 16:15:58 +01:00
qemu_conf.h qemu: Use g_strdup_printf() instead of virAsprintf() 2019-11-12 16:15:58 +01:00
qemu_dbus.c qemu: use g_strdup instead of VIR_STRDUP 2019-10-21 12:51:57 +02:00
qemu_dbus.h Use G_DEFINE_AUTOPTR_CLEANUP_FUNC instead of VIR_DEFINE_AUTOPTR_FUNC 2019-10-16 12:06:43 +02:00
qemu_domain.c qemu: domain: Introduce helper to convert <loader> into virStorageSource 2019-11-22 08:32:25 +01:00
qemu_domain.h qemu: domain: Introduce helper to convert <loader> into virStorageSource 2019-11-22 08:32:25 +01:00
qemu_domain_address.c qemu: remove unneeded cleanup labels 2019-11-19 15:22:37 +01:00
qemu_domain_address.h src/qemu: use #pragma once in headers 2019-06-19 17:12:30 +02:00
qemu_driver.c qemu: Rename virQEMUCaps{Get,Fetch}CPUDefinitions 2019-11-20 17:22:05 +01:00
qemu_driver.h src/qemu: use #pragma once in headers 2019-06-19 17:12:30 +02:00
qemu_extdevice.c Use g_autofree instead of VIR_AUTOFREE 2019-10-16 12:06:43 +02:00
qemu_extdevice.h Use G_GNUC_WARN_UNUSED_RESULT instead of ATTRIBUTE_RETURN_CHECK 2019-10-15 11:25:22 +02:00
qemu_firmware.c qemu: Use g_strdup_printf() instead of virAsprintf() 2019-11-12 16:15:58 +01:00
qemu_firmware.h Remove virautoclean.h 2019-10-16 12:06:44 +02:00
qemu_hostdev.c qemu_hostdev: Introduce qemuHostdevNeedsVFIO() 2019-10-21 13:50:24 +02:00
qemu_hostdev.h qemu_hostdev: Introduce qemuHostdevNeedsVFIO() 2019-10-21 13:50:24 +02:00
qemu_hotplug.c qemu: remove unneeded cleanup labels 2019-11-19 15:22:37 +01:00
qemu_hotplug.h qemu_hotplug.c: adding qemuDomainGetUnplugTimeout 2019-11-13 15:03:40 -05:00
qemu_interface.c qemu: remove unneeded cleanup labels 2019-11-19 15:22:37 +01:00
qemu_interface.h qemu-process: prepare slirp-helper 2019-09-06 12:47:47 +02:00
qemu_interop_config.c qemu: Use g_strdup_printf() instead of virAsprintf() 2019-11-12 16:15:58 +01:00
qemu_interop_config.h qemu: generalize qemuFetchConfigs 2019-09-24 12:17:10 -04:00
qemu_migration.c qemu: remove unneeded cleanup labels 2019-11-19 15:22:37 +01:00
qemu_migration.h Use G_GNUC_WARN_UNUSED_RESULT instead of ATTRIBUTE_RETURN_CHECK 2019-10-15 11:25:22 +02:00
qemu_migration_cookie.c cpu_map: Drop pconfig from Icelake-Server CPU model 2019-11-12 20:14:16 +01:00
qemu_migration_cookie.h src/qemu: use #pragma once in headers 2019-06-19 17:12:30 +02:00
qemu_migration_params.c qemu/qemu_migration_params: use virStringParseYesNo helper 2019-11-14 08:14:50 -05:00
qemu_migration_params.h Remove virautoclean.h 2019-10-16 12:06:44 +02:00
qemu_migration_paramspriv.h src/qemu: use #pragma once in headers 2019-06-19 17:12:30 +02:00
qemu_monitor.c qemu: Probe for default CPU types 2019-11-20 17:22:06 +01:00
qemu_monitor.h qemu: Probe for default CPU types 2019-11-20 17:22:06 +01:00
qemu_monitor_json.c qemu: Probe for default CPU types 2019-11-20 17:22:06 +01:00
qemu_monitor_json.h qemu: Introduce qemuMonitorCPUDefs struct 2019-11-20 17:22:05 +01:00
qemu_monitor_priv.h src/qemu: use #pragma once in headers 2019-06-19 17:12:30 +02:00
qemu_monitor_text.c qemu: Use g_strdup_printf() instead of virAsprintf() 2019-11-12 16:15:58 +01:00
qemu_monitor_text.h qemu: Remove qemuMonitorTextSetCPU 2019-06-20 15:59:19 +02:00
qemu_process.c qemuProcessStop: Remove image metadata for running mirror jobs 2019-11-22 10:48:14 +01:00
qemu_process.h qemu: fix build with musl libc 2019-10-17 10:54:32 +02:00
qemu_processpriv.h src/qemu: use #pragma once in headers 2019-06-19 17:12:30 +02:00
qemu_qapi.c Remove all usage of VIR_RETURN_PTR 2019-10-16 15:59:41 +02:00
qemu_qapi.h src/qemu: use #pragma once in headers 2019-06-19 17:12:30 +02:00
qemu_security.c security: Pass @migrated to virSecurityManagerSetAllLabel 2019-10-14 17:14:13 +02:00
qemu_security.h security: Pass @migrated to virSecurityManagerSetAllLabel 2019-10-14 17:14:13 +02:00
qemu_slirp.c qemu: Use g_strdup_printf() instead of virAsprintf() 2019-11-12 16:15:58 +01:00
qemu_slirp.h Use G_DEFINE_AUTOPTR_CLEANUP_FUNC instead of VIR_DEFINE_AUTOPTR_FUNC 2019-10-16 12:06:43 +02:00
qemu_tpm.c qemu: remove unneeded cleanup labels 2019-11-19 15:22:37 +01:00
qemu_tpm.h Use G_GNUC_WARN_UNUSED_RESULT instead of ATTRIBUTE_RETURN_CHECK 2019-10-15 11:25:22 +02:00
qemu_vhost_user.c Drop needless ret variable 2019-10-24 08:10:37 +02:00
qemu_vhost_user.h Remove virautoclean.h 2019-10-16 12:06:44 +02:00
qemu_vhost_user_gpu.c qemu: gpu: Sanitize error values in qemuVhostUserGPUGetPid 2019-11-14 12:42:09 +01:00
qemu_vhost_user_gpu.h Use G_GNUC_WARN_UNUSED_RESULT instead of ATTRIBUTE_RETURN_CHECK 2019-10-15 11:25:22 +02:00
test_libvirtd_qemu.aug.in qemu-conf: add configurable slirp-helper location 2019-09-06 12:47:47 +02:00
virtqemud.service.in qemu: introduce virtqemud daemon 2019-08-09 14:06:31 +01:00