From nobody Mon Feb 9 17:34:46 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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.129.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=1656000930; cv=none; d=zohomail.com; s=zohoarc; b=l+BHh9ShFXAodt95kltpKbY6h7Tkp/7TzJIBBeG0BaeGccVHAdM+1C+LsN96agdNRkyz05NqCkYi4KQG1wNEwmgkFKxWQytChxxD5uTnMh09y4H6c8S97HOT3tRaG+VDY4qSAaWqj0pHlueQdLEW808cPeWy/MTRcRuIkiknu7M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1656000930; 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=48u8BWfeIf5TVQq2lybjEmgfLF4dxzs5kP+bSFj/UUQ=; b=AmyM1EL4spQa0l0PjDPgDLxJtOvxeNip0xNcdL1PliVpDGzyXbdw20BEFNEhAlalAaDfqQerQEWey3Wcb6S9NAnMssYLuj+WDlvLaxnVTReHKOhNiE/6vzhj6Cyvdbou9lB6GxI0FdKDV4Ir12VqGpxUgWzRN2zoSRA7fkud3jo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.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.129.124]) by mx.zohomail.com with SMTPS id 1656000930326817.624397369692; Thu, 23 Jun 2022 09:15:30 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-277-L3p-ElSWOWyPRJLxX7ogOw-1; Thu, 23 Jun 2022 12:15:23 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C451810AF6E1; Thu, 23 Jun 2022 16:14:59 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id AE6FC1131D; Thu, 23 Jun 2022 16:14:59 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 84251194B959; Thu, 23 Jun 2022 16:14:59 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id C0EC2194B959 for ; Thu, 23 Jun 2022 16:14:57 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 9E5FA112132C; Thu, 23 Jun 2022 16:14:57 +0000 (UTC) Received: from harajuku.homenet.telecomitalia.it (unknown [10.40.194.79]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2A72F1121319 for ; Thu, 23 Jun 2022 16:14:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1656000929; 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=48u8BWfeIf5TVQq2lybjEmgfLF4dxzs5kP+bSFj/UUQ=; b=Jm+Hb43xO8HukhUIe/Q9G5j7NhGk71ZKuRHXW2ZLGdugVE0JZnRwGh4eDMHsYHumWPnDQt /Xj0UNthaoNew4EuJAk4V3o3mR3oVdScz4y4AQVK0qmdNaA++WLhDdbboUrw0dda6hPLQc lvCPqh7LJZMG6z0/4+E2uWF0tTVYN9k= X-MC-Unique: L3p-ElSWOWyPRJLxX7ogOw-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Andrea Bolognani To: libvir-list@redhat.com Subject: [libvirt PATCH 19/28] conf: Reject enrolled-keys=yes with secure-boot=no Date: Thu, 23 Jun 2022 18:14:31 +0200 Message-Id: <20220623161440.61653-20-abologna@redhat.com> In-Reply-To: <20220623161440.61653-1-abologna@redhat.com> References: <20220623161440.61653-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 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: 1656000931742100009 Content-Type: text/plain; charset="utf-8" This combination doesn't make sense and so the firmware autoselection logic will not be able to find a suitable firmware, but it's more user-friendly to report a detailed error upfront. Note that this check would ideally happen in the validate phase, but if we moved it there we would no longer be able to automatically enable secure-boot when enrolled-keys=3Dyes. Since the combination never resulted in a working configuration, the chances of this causing real-world VMs to disappear are extremely low. Signed-off-by: Andrea Bolognani --- src/conf/domain_conf.c | 7 +++++++ ...enrolled-keys-no-secboot.x86_64-latest.err | 1 + ...ware-auto-efi-enrolled-keys-no-secboot.xml | 21 +++++++++++++++++++ tests/qemuxml2argvtest.c | 1 + 4 files changed, 30 insertions(+) create mode 100644 tests/qemuxml2argvdata/firmware-auto-efi-enrolled-keys-= no-secboot.x86_64-latest.err create mode 100644 tests/qemuxml2argvdata/firmware-auto-efi-enrolled-keys-= no-secboot.xml diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index d88d352fb6..0c6504348c 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -4879,6 +4879,13 @@ virDomainDefPostParseOs(virDomainDef *def) if (def->os.firmwareFeatures && def->os.firmwareFeatures[VIR_DOMAIN_OS_DEF_FIRMWARE_FEATURE_ENROLL= ED_KEYS] =3D=3D VIR_TRISTATE_BOOL_YES) { =20 + if (def->os.firmwareFeatures[VIR_DOMAIN_OS_DEF_FIRMWARE_FEATURE_SE= CURE_BOOT] =3D=3D VIR_TRISTATE_BOOL_NO) { + virReportError(VIR_ERR_XML_DETAIL, "%s", + _("firmware feature 'enrolled-keys' cannot be e= nabled when " + "firmware feature 'secure-boot' is disabled")= ); + return -1; + } + /* For all non-broken firmware builds, enrolled-keys implies * secure-boot, and having the Secure Boot keys in the NVRAM file * when the firmware doesn't support the Secure Boot feature doesn= 't diff --git a/tests/qemuxml2argvdata/firmware-auto-efi-enrolled-keys-no-secb= oot.x86_64-latest.err b/tests/qemuxml2argvdata/firmware-auto-efi-enrolled-k= eys-no-secboot.x86_64-latest.err new file mode 100644 index 0000000000..989d3dbf5a --- /dev/null +++ b/tests/qemuxml2argvdata/firmware-auto-efi-enrolled-keys-no-secboot.x86= _64-latest.err @@ -0,0 +1 @@ +firmware feature 'enrolled-keys' cannot be enabled when firmware feature '= secure-boot' is disabled diff --git a/tests/qemuxml2argvdata/firmware-auto-efi-enrolled-keys-no-secb= oot.xml b/tests/qemuxml2argvdata/firmware-auto-efi-enrolled-keys-no-secboot= .xml new file mode 100644 index 0000000000..722793684c --- /dev/null +++ b/tests/qemuxml2argvdata/firmware-auto-efi-enrolled-keys-no-secboot.xml @@ -0,0 +1,21 @@ + + fedora + 63840878-0deb-4095-97e6-fc444d9bc9fa + 8192 + 1 + + hvm + + + + + + + + + + /usr/bin/qemu-system-x86_64 + + + + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index d21b2d9154..b01ad8d4e9 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1224,6 +1224,7 @@ mymain(void) DO_TEST_CAPS_LATEST("firmware-auto-efi-no-secboot"); DO_TEST_CAPS_LATEST("firmware-auto-efi-enrolled-keys"); DO_TEST_CAPS_LATEST("firmware-auto-efi-no-enrolled-keys"); + DO_TEST_CAPS_LATEST_PARSE_ERROR("firmware-auto-efi-enrolled-keys-no-se= cboot"); DO_TEST_CAPS_ARCH_LATEST("firmware-auto-efi-aarch64", "aarch64"); =20 DO_TEST_NOCAPS("clock-utc"); --=20 2.35.3