From nobody Tue Feb 10 09:59:17 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1553534708283944.8979018382241; Mon, 25 Mar 2019 10:25:08 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 853A231688F8; Mon, 25 Mar 2019 17:24:55 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5F5731B477; Mon, 25 Mar 2019 17:24:55 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 25234180338B; Mon, 25 Mar 2019 17:24:55 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x2PHOqCg029900 for ; Mon, 25 Mar 2019 13:24:52 -0400 Received: by smtp.corp.redhat.com (Postfix) id ECF9E64294; Mon, 25 Mar 2019 17:24:52 +0000 (UTC) Received: from vhost2.laine.org (ovpn-116-122.phx2.redhat.com [10.3.116.122]) by smtp.corp.redhat.com (Postfix) with ESMTP id 921B8642A5; Mon, 25 Mar 2019 17:24:50 +0000 (UTC) From: Laine Stump To: libvir-list@redhat.com Date: Mon, 25 Mar 2019 13:24:33 -0400 Message-Id: <20190325172436.17069-12-laine@laine.org> In-Reply-To: <20190325172436.17069-1-laine@laine.org> References: <20190325172436.17069-1-laine@laine.org> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH v2 11/14] qemu_hotplug: audit *all* auditable device types in qemuDomainRemoveAuditDevice X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Mon, 25 Mar 2019 17:25:01 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Although all hotpluggable devices other than lease, controller, watchdof, and vsock can be audited, and *are* audited when an unplug is successful, only disk, net, and hostdev were actually being audited on failure. This patch corrects that omission. Signed-off-by: Laine Stump --- NEW PATCH in V2 - previously a part of patch 10/14 src/qemu/qemu_hotplug.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 92d4e7d0f9..e9d6c8622b 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -5223,19 +5223,28 @@ qemuDomainRemoveAuditDevice(virDomainObjPtr vm, case VIR_DOMAIN_DEVICE_HOSTDEV: virDomainAuditHostdev(vm, detach->data.hostdev, "detach", success); break; - case VIR_DOMAIN_DEVICE_INPUT: + virDomainAuditInput(vm, detach->data.input, "detach", success); + break; case VIR_DOMAIN_DEVICE_CHR: + virDomainAuditChardev(vm, detach->data.chr, NULL, "detach", succes= s); + break; case VIR_DOMAIN_DEVICE_RNG: - case VIR_DOMAIN_DEVICE_MEMORY: + virDomainAuditRNG(vm, detach->data.rng, NULL, "detach", success); + break; + case VIR_DOMAIN_DEVICE_MEMORY: { + unsigned long long oldmem =3D virDomainDefGetMemoryTotal(vm->def); + unsigned long long newmem =3D oldmem - detach->data.memory->size; + + virDomainAuditMemory(vm, oldmem, newmem, "update", success); + break; + } case VIR_DOMAIN_DEVICE_SHMEM: + virDomainAuditShmem(vm, detach->data.shmem, "detach", success); + break; case VIR_DOMAIN_DEVICE_REDIRDEV: - /* - * These devices are supposed to be audited, but current code - * doesn't audit on failure to remove the device. - */ - break; - + virDomainAuditRedirdev(vm, detach->data.redirdev, "detach", succes= s); + break; =20 case VIR_DOMAIN_DEVICE_LEASE: case VIR_DOMAIN_DEVICE_CONTROLLER: --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list