|
|
99cbc7 |
From e751617f83b01eab5799049bc080ab893ae213d9 Mon Sep 17 00:00:00 2001
|
|
|
99cbc7 |
Message-Id: <e751617f83b01eab5799049bc080ab893ae213d9@dist-git>
|
|
|
99cbc7 |
From: Laine Stump <laine@laine.org>
|
|
|
99cbc7 |
Date: Thu, 11 Apr 2019 15:14:50 -0400
|
|
|
99cbc7 |
Subject: [PATCH] qemu_hotplug: audit *all* auditable device types in
|
|
|
99cbc7 |
qemuDomainRemoveAuditDevice
|
|
|
99cbc7 |
|
|
|
99cbc7 |
Although all hotpluggable devices other than lease, controller,
|
|
|
99cbc7 |
watchdof, and vsock can be audited, and *are* audited when an unplug
|
|
|
99cbc7 |
is successful, only disk, net, and hostdev were actually being audited
|
|
|
99cbc7 |
on failure.
|
|
|
99cbc7 |
|
|
|
99cbc7 |
This patch corrects that omission.
|
|
|
99cbc7 |
|
|
|
99cbc7 |
Signed-off-by: Laine Stump <laine@laine.org>
|
|
|
99cbc7 |
ACKed-by: Peter Krempa <pkrempa@redhat.com>
|
|
|
99cbc7 |
(cherry picked from commit 444c5e7c432961c7ecd59b2627dfb69ce787a22a)
|
|
|
99cbc7 |
|
|
|
99cbc7 |
Partially-Resolves: https://bugzilla.redhat.com/1658198
|
|
|
99cbc7 |
Signed-off-by: Laine Stump <laine@redhat.com>
|
|
|
99cbc7 |
Signed-off-by: Laine Stump <laine@laine.org>
|
|
|
99cbc7 |
Message-Id: <20190411191453.24055-39-laine@redhat.com>
|
|
|
99cbc7 |
Acked-by: Michal Privoznik <mprivozn@redhat.com>
|
|
|
99cbc7 |
---
|
|
|
99cbc7 |
src/qemu/qemu_hotplug.c | 27 ++++++++++++++++++---------
|
|
|
99cbc7 |
1 file changed, 18 insertions(+), 9 deletions(-)
|
|
|
99cbc7 |
|
|
|
99cbc7 |
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
|
|
|
99cbc7 |
index 482111c46e..390fc36cf6 100644
|
|
|
99cbc7 |
--- a/src/qemu/qemu_hotplug.c
|
|
|
99cbc7 |
+++ b/src/qemu/qemu_hotplug.c
|
|
|
99cbc7 |
@@ -4665,19 +4665,28 @@ qemuDomainRemoveAuditDevice(virDomainObjPtr vm,
|
|
|
99cbc7 |
case VIR_DOMAIN_DEVICE_HOSTDEV:
|
|
|
99cbc7 |
virDomainAuditHostdev(vm, detach->data.hostdev, "detach", success);
|
|
|
99cbc7 |
break;
|
|
|
99cbc7 |
-
|
|
|
99cbc7 |
case VIR_DOMAIN_DEVICE_INPUT:
|
|
|
99cbc7 |
+ virDomainAuditInput(vm, detach->data.input, "detach", success);
|
|
|
99cbc7 |
+ break;
|
|
|
99cbc7 |
case VIR_DOMAIN_DEVICE_CHR:
|
|
|
99cbc7 |
+ virDomainAuditChardev(vm, detach->data.chr, NULL, "detach", success);
|
|
|
99cbc7 |
+ break;
|
|
|
99cbc7 |
case VIR_DOMAIN_DEVICE_RNG:
|
|
|
99cbc7 |
- case VIR_DOMAIN_DEVICE_MEMORY:
|
|
|
99cbc7 |
- case VIR_DOMAIN_DEVICE_SHMEM:
|
|
|
99cbc7 |
- case VIR_DOMAIN_DEVICE_REDIRDEV:
|
|
|
99cbc7 |
- /*
|
|
|
99cbc7 |
- * These devices are supposed to be audited, but current code
|
|
|
99cbc7 |
- * doesn't audit on failure to remove the device.
|
|
|
99cbc7 |
- */
|
|
|
99cbc7 |
- break;
|
|
|
99cbc7 |
+ virDomainAuditRNG(vm, detach->data.rng, NULL, "detach", success);
|
|
|
99cbc7 |
+ break;
|
|
|
99cbc7 |
+ case VIR_DOMAIN_DEVICE_MEMORY: {
|
|
|
99cbc7 |
+ unsigned long long oldmem = virDomainDefGetMemoryTotal(vm->def);
|
|
|
99cbc7 |
+ unsigned long long newmem = oldmem - detach->data.memory->size;
|
|
|
99cbc7 |
|
|
|
99cbc7 |
+ virDomainAuditMemory(vm, oldmem, newmem, "update", success);
|
|
|
99cbc7 |
+ break;
|
|
|
99cbc7 |
+ }
|
|
|
99cbc7 |
+ case VIR_DOMAIN_DEVICE_SHMEM:
|
|
|
99cbc7 |
+ virDomainAuditShmem(vm, detach->data.shmem, "detach", success);
|
|
|
99cbc7 |
+ break;
|
|
|
99cbc7 |
+ case VIR_DOMAIN_DEVICE_REDIRDEV:
|
|
|
99cbc7 |
+ virDomainAuditRedirdev(vm, detach->data.redirdev, "detach", success);
|
|
|
99cbc7 |
+ break;
|
|
|
99cbc7 |
|
|
|
99cbc7 |
case VIR_DOMAIN_DEVICE_LEASE:
|
|
|
99cbc7 |
case VIR_DOMAIN_DEVICE_CONTROLLER:
|
|
|
99cbc7 |
--
|
|
|
99cbc7 |
2.21.0
|
|
|
99cbc7 |
|