From nobody Tue May 14 04:16:38 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1700746706792730.1254406695526; Thu, 23 Nov 2023 05:38:26 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 9B45018E6; Thu, 23 Nov 2023 08:38:25 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id D9603189B; Thu, 23 Nov 2023 08:36:15 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 995E217F6; Thu, 23 Nov 2023 08:36:09 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 87EC817E8 for ; Thu, 23 Nov 2023 08:36:08 -0500 (EST) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-681-DPTB0GAZMqyk661sVOXOeQ-1; Thu, 23 Nov 2023 08:36:06 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B6EA085A58A for ; Thu, 23 Nov 2023 13:36:06 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.11]) by smtp.corp.redhat.com (Postfix) with ESMTP id 42BC7C1596F for ; Thu, 23 Nov 2023 13:36:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: DPTB0GAZMqyk661sVOXOeQ-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH 1/2] qemu: hotplug: Detect disk backing images before setting up security access Date: Thu, 23 Nov 2023 14:36:03 +0100 Message-ID: <694a3d8518013885ef6081c47aff3a73d7538706.1700746511.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: MRWROEPTDRXQ5FAQNKDCC2UOIZL2LNVD X-Message-ID-Hash: MRWROEPTDRXQ5FAQNKDCC2UOIZL2LNVD X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1700746708056100001 The VM will require access also to the detected images. Unfortunately a recent reordering of the code introduced a bug where the backing chain was probed after setting up cgroups/selinux/namespaces, which caused that any detected images were not allowed/added and qemu was then not able to use them. Fixes: 9b8bb536ff999fa61e41869bd98a026b8e23378f Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_hotplug.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index f197a9d5ff..4e2fc724c0 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -1001,17 +1001,17 @@ qemuDomainAttachDeviceDiskLiveInternal(virQEMUDrive= r *driver, goto cleanup; if (!virStorageSourceIsEmpty(disk->src)) { - if (qemuDomainStorageSourceChainAccessAllow(driver, vm, disk->src)= < 0) - goto cleanup; - - releaseSeclabel =3D true; - if (qemuDomainPrepareDiskSource(disk, priv, cfg) < 0) goto cleanup; if (qemuDomainDetermineDiskChain(driver, vm, disk, NULL) < 0) goto cleanup; + if (qemuDomainStorageSourceChainAccessAllow(driver, vm, disk->src)= < 0) + goto cleanup; + + releaseSeclabel =3D true; + if (qemuProcessPrepareHostStorageDisk(vm, disk) < 0) goto cleanup; --=20 2.42.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org From nobody Tue May 14 04:16:38 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1700746773103668.5202919162545; Thu, 23 Nov 2023 05:39:33 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 06B9117E3; Thu, 23 Nov 2023 08:39:31 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id ED64C18AD; Thu, 23 Nov 2023 08:36:21 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 2224717E2; Thu, 23 Nov 2023 08:36:10 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 84FD21745 for ; Thu, 23 Nov 2023 08:36:09 -0500 (EST) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-67-mtzlb_jaO0Wc_XfptproUw-1; Thu, 23 Nov 2023 08:36:07 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 887AB811E82 for ; Thu, 23 Nov 2023 13:36:07 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.11]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0DCC1C1596F for ; Thu, 23 Nov 2023 13:36:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: mtzlb_jaO0Wc_XfptproUw-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH 2/2] qemu: block: Don't try to merge bitmaps into 'raw' images Date: Thu, 23 Nov 2023 14:36:04 +0100 Message-ID: <9151dc37a7fa58c1bf2abd4ac0044e1b0bb72e91.1700746511.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: X42YD7AFVPGD43S2T23T7CT5GAJ3C6NT X-Message-ID-Hash: X42YD7AFVPGD43S2T23T7CT5GAJ3C6NT X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1700746774387100001 If any of the images in a chain above a raw image have bitmaps, libvirt would attempt to merge them when doing a block commit or block copy operation, which would result into a error in the logs as creating persistent bitmaps in a raw image is not supported. Since libvirt cares only about persisten bitmaps we can simply skip the operation if the target of a block copy or block commit is a raw image. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_block.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index fab122942a..359595367b 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -3074,6 +3074,11 @@ qemuBlockBitmapsHandleBlockcopy(virStorageSource *sr= c, { virStorageSource *base =3D NULL; + /* if copy destination is a 'raw' image there's no point in attempting= to + * merge the bitmaps into it */ + if (mirror->format =3D=3D VIR_STORAGE_FILE_RAW) + return 0; + if (shallow) base =3D src->backingStore; @@ -3107,6 +3112,11 @@ qemuBlockBitmapsHandleCommitFinish(virStorageSource = *topsrc, { virStorageSource *writebitmapsrc =3D NULL; + /* if base is a 'raw' image there's no point in attempting to merge the + * bitmaps into it */ + if (basesrc->format =3D=3D VIR_STORAGE_FILE_RAW) + return 0; + if (active) writebitmapsrc =3D basesrc; --=20 2.42.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org