From nobody Mon Apr 29 19:06:36 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1629459576; cv=none; d=zohomail.com; s=zohoarc; b=MDIX7Ff8piRCXpKOXcEDa9vWVy1skT4Hys3uXPT1xRUPm4cp+ugG8CzIBKkFbSIffDMfZq4HlyELHEZB1bUUEhkoKQx0Cf8HQyBnh3eZk+0u+YeueVKli36eLB2hF1vrkKeOyYfy2WyzeaICMEhVSq/oIRV2HIHcUzQvF2QD+Ho= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1629459576; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=14RL3YeklVfnh/yIfGNvxGpMfOujiO72Qdq+lNO90Ec=; b=MoE7DyLZA95LplBEisVkW1/A4YV7HeTkJsRCEdPfvAkFWlcvIID4+5dfi8+t951o8aq1J8e+/Ve1+KirPebFjNJOY6P8k1KvBBGJAFJs/ZZ5fecMkyFJZ27C5tXy6pU2WkrBo5SZ6WFUcApe7OY5LsZVMjVDiF4EnSu6+mJt/y8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1629459576710228.64709631528615; Fri, 20 Aug 2021 04:39:36 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-196-pln9Rwb0PIipmNVobWyV3Q-1; Fri, 20 Aug 2021 07:39:34 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 761CD344B1; Fri, 20 Aug 2021 11:39:29 +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 28CDF1970F; Fri, 20 Aug 2021 11:39:29 +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 E08FF181A2A8; Fri, 20 Aug 2021 11:39:28 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 17KBdPsx006336 for ; Fri, 20 Aug 2021 07:39:25 -0400 Received: by smtp.corp.redhat.com (Postfix) id B38AE13AC8; Fri, 20 Aug 2021 11:39:25 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.33]) by smtp.corp.redhat.com (Postfix) with ESMTP id 20CEC5D9FC for ; Fri, 20 Aug 2021 11:39:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1629459575; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=14RL3YeklVfnh/yIfGNvxGpMfOujiO72Qdq+lNO90Ec=; b=CmPEDQjiUDjOcip53UdoLGq5pFkH2TFh7gJaggde29n0b2FaR5CYs03RLoQT+F8FHrhUV1 fAKNtD3F1exCWAd4aX7aw7CAWnGv+tHFLs17ovC2S1G0L3OdJD4ZUrmN7q0ytmJeSDkVkV 4ogW7SzRqV+jp1oP02T5O+ux/vEZcmA= X-MC-Unique: pln9Rwb0PIipmNVobWyV3Q-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 1/2] qemu: block: Use correct format name when formatting overlay of qcow2+luks Date: Fri, 20 Aug 2021 13:39:18 +0200 Message-Id: <02d961d2a1e44d4827345e441e07d24ee15e41c4.1629459524.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1629459577780100001 Content-Type: text/plain; charset="utf-8" A logic bug in the code creating overlays on existing images resulted into wrongly using "luks" instead of "qcow2" for the backing format if the backing image is an luks-encrypted qcow2. The special format munging is needed only for raw luks images. In practice the impact is not as critical as to use encrypted images in the backing chain the user must fully describe the backing chain including backing images to provide encryption keys, which overrides the metadata recorded in the qcow2 header. Signed-off-by: Peter Krempa --- src/qemu/qemu_block.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index e09c7e66c8..0bc92f6a23 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -2264,7 +2264,8 @@ qemuBlockStorageSourceCreateAddBacking(virStorageSour= ce *backing, return 0; if (format) { - if (backing->encryption && + if (backing->format =3D=3D VIR_STORAGE_FILE_RAW && + backing->encryption && backing->encryption->format =3D=3D VIR_STORAGE_ENCRYPTION_FORM= AT_LUKS) backingFormatStr =3D "luks"; else --=20 2.31.1 From nobody Mon Apr 29 19:06:36 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1629459576; cv=none; d=zohomail.com; s=zohoarc; b=cWCU/GrrVYj4Kxq39+m0xEf0V3RimCCZjSzgNabSfqz+QkXz6+FQiqnWpmLYur6TyRSeMKMlwxqT39cVDvNa93bPkj+oZ9fA7ntf1NM7VzwirGb1NDJfzKr9MfierCzcFJfiLthzuwI2dXQF+yOf1yun4Qu6Q/pkTqQgZIhSZSc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1629459576; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=VMCKW69qP/F72TiiARDtzcFnLKy9Z3onjAFjaik6MSc=; b=QW4juTOguiN/eOnP8tJwISLxLezrFwc4JibJornCifRmxwZjzr/bM3lC4mn6BEWLMkF8XgV7yA4USH35M7Gk4aLw0AeiPjuKf4aStrLCwt3oiiYhE0OU1jHKvQrIja2PXqYa/CwGdI3vEhpRwhjv+GOO/ow/oAwBVShzURuSj8E= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 162945957670917.82647308677349; Fri, 20 Aug 2021 04:39:36 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-591-dpCtGDJRPqugYG0klAcoqg-1; Fri, 20 Aug 2021 07:39:34 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3E6EA801AEB; Fri, 20 Aug 2021 11:39:29 +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 1F95B5D9FC; Fri, 20 Aug 2021 11:39:29 +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 DCF51181A2A7; Fri, 20 Aug 2021 11:39:28 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 17KBdQ1Q006359 for ; Fri, 20 Aug 2021 07:39:26 -0400 Received: by smtp.corp.redhat.com (Postfix) id C978613AC8; Fri, 20 Aug 2021 11:39:26 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.33]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2B0D75D9FC for ; Fri, 20 Aug 2021 11:39:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1629459575; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=VMCKW69qP/F72TiiARDtzcFnLKy9Z3onjAFjaik6MSc=; b=aniyFCJ2wPyH5g/sPedlUs5ggwDyymHDZBDWawUGDjNcH8rfxTdoMEFBRqI3tneRBXYols eYWM9oLzTIyvQEsRLrB8ajjPxYXn0XzqV7OQjyQCo3Oil7HkdM8Kqth1VKEwjcfa8YJFDK QEc3Nfl2SNsfbJSK4I+BZr11c0KAvrM= X-MC-Unique: dpCtGDJRPqugYG0klAcoqg-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 2/2] qemublocktest: Add test for creating a qcow2 on top of an luks-encrypted qcow2 Date: Fri, 20 Aug 2021 13:39:19 +0200 Message-Id: <3cd181bc7efe1cdf89e7542efccea0d14bad19fd.1629459524.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1629460480041100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Peter Krempa --- tests/qemublocktest.c | 1 + .../imagecreate/qcow2-backing-qcow2luks.json | 15 +++++++++++++++ .../imagecreate/qcow2-backing-qcow2luks.xml | 1 + 3 files changed, 17 insertions(+) create mode 100644 tests/qemublocktestdata/imagecreate/qcow2-backing-qcow2= luks.json create mode 120000 tests/qemublocktestdata/imagecreate/qcow2-backing-qcow2= luks.xml diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c index 308668f2b8..4af8862c5b 100644 --- a/tests/qemublocktest.c +++ b/tests/qemublocktest.c @@ -1216,6 +1216,7 @@ mymain(void) TEST_IMAGE_CREATE("qcow2-backing-raw", "raw"); TEST_IMAGE_CREATE("qcow2-backing-raw-nbd", "raw-nbd"); TEST_IMAGE_CREATE("qcow2-backing-luks", "luks-noopts"); + TEST_IMAGE_CREATE("qcow2-backing-qcow2luks", "qcow2-luks-noopts"); TEST_IMAGE_CREATE("qcow2-luks-encopts-backing", "qcow2"); TEST_IMAGE_CREATE("qcow2-backing-raw-slice", "raw-slice"); TEST_IMAGE_CREATE("qcow2-backing-qcow2-slice", "qcow2-slice"); diff --git a/tests/qemublocktestdata/imagecreate/qcow2-backing-qcow2luks.js= on b/tests/qemublocktestdata/imagecreate/qcow2-backing-qcow2luks.json new file mode 100644 index 0000000000..1dac76f6be --- /dev/null +++ b/tests/qemublocktestdata/imagecreate/qcow2-backing-qcow2luks.json @@ -0,0 +1,15 @@ +protocol: +{ + "driver": "file", + "filename": "/var/lib/libvirt/images/i.qcow2", + "size": 4294967296 +} + +format: +{ + "driver": "qcow2", + "file": "0123456789ABCDEF0123456789ABCDE", + "size": 8589934590, + "backing-file": "/var/lib/libvirt/images/i.qcow2", + "backing-fmt": "qcow2" +} diff --git a/tests/qemublocktestdata/imagecreate/qcow2-backing-qcow2luks.xm= l b/tests/qemublocktestdata/imagecreate/qcow2-backing-qcow2luks.xml new file mode 120000 index 0000000000..5769c2c866 --- /dev/null +++ b/tests/qemublocktestdata/imagecreate/qcow2-backing-qcow2luks.xml @@ -0,0 +1 @@ +qcow2.xml \ No newline at end of file --=20 2.31.1