From nobody Sat Feb 7 18:46:32 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1602708318; cv=none; d=zohomail.com; s=zohoarc; b=BFmPhWbSXs9Ei4KdnVsdMfvq4PbSO70G++wtXXjMik++rXJ8ZdbUcSHoLEB1tlV+Zz3H2gzRUSrykfonqlbrzxC4RFFdpOKn8045DYrS98bzxzygLoHAqPIJxfbbieQP+sw9Qdiy7n+YlM6r2Uq7Rme932gTsaGxZWRZNfnIEhQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1602708318; h=Content-Type:Content-Transfer-Encoding:Cc: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=kGDn0WRgovdpLAtI12kzoT7bwR67tndhvmGwI8AFNAg=; b=WirEg9ED9WiORibj7nipkjKrz5ywjZH+sU3munLLZv86jv8ZIrz4TDJqUxA7hrjnBd6vQx6m4hy1PYXEe9zGz9xmD8tg3rXD6nu+GhN3sKGVvYohty2h3Y6MQtTxZ5Lch8ErqAdfmZGyV5bV3kJpnNG0GqUfiIEm/XyAd2bOVTQ= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1602708318176366.27022055363227; Wed, 14 Oct 2020 13:45:18 -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-448-7pwrNE8QOj6CezX4_WNKSg-1; Wed, 14 Oct 2020 16:45:14 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E2398100CD1F; Wed, 14 Oct 2020 20:45:07 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BB4D273661; Wed, 14 Oct 2020 20:45:07 +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 825D28C7C1; Wed, 14 Oct 2020 20:45:07 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 09EKi4Oe028906 for ; Wed, 14 Oct 2020 16:44:04 -0400 Received: by smtp.corp.redhat.com (Postfix) id 22AA2207B2D4; Wed, 14 Oct 2020 20:44:04 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1DB95200A795 for ; Wed, 14 Oct 2020 20:44:01 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id CF328182360F for ; Wed, 14 Oct 2020 20:44:01 +0000 (UTC) Received: from mail-il1-f194.google.com (mail-il1-f194.google.com [209.85.166.194]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-146-IzlymQvcMZueao2QqwCzRQ-1; Wed, 14 Oct 2020 16:43:59 -0400 Received: by mail-il1-f194.google.com with SMTP id p16so1062503ilq.5 for ; Wed, 14 Oct 2020 13:43:59 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c6:5a9b:54fc:df2a:8a5e:989b]) by smtp.gmail.com with ESMTPSA id i4sm492202ilc.27.2020.10.14.13.43.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Oct 2020 13:43:58 -0700 (PDT) X-MC-Unique: 7pwrNE8QOj6CezX4_WNKSg-1 X-MC-Unique: IzlymQvcMZueao2QqwCzRQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=kGDn0WRgovdpLAtI12kzoT7bwR67tndhvmGwI8AFNAg=; b=fMvHAaDBn1fcnF6l4sCBZti3KXuySrfJgYaqnSLuJ/eAFb5+YLzG2/gSsbyKncvd9I zAzqHsaGbgyHWUajGpi7XUWmQd8t+/GhtH1t7LdvyYcNmNaZ0NzHDQOZrgdj93Bkf15a Yz88OBJv1os0Yj9bmOeh2nZsOUFPmcAeYIWj7+tHTNRJA9rAxMVgJ8WI+5NOcRsh6Yst VxBfUZ3hKEC1/m6tB4OBnYlmW3lldwKzG82SyWrMeEOUns8JJzGu8gcayjUZMDyPdSsl 3gO0KYGKptTqyUAqN+Azj6AVy6aoioRuMC/ViyX0R2+qVY3G4Zx9YPn10X/zyhDpeNmk VMGw== X-Gm-Message-State: AOAM531eiYg5wFqL5cccjEnx2wSZrOB9AMWDzWaZ6Bo6z51A3RFv/FyW y/KfLgYMcd1mNvLFtYBIPvtneBvr7oo= X-Google-Smtp-Source: ABdhPJxByehW1M0OP+MfMY5ODTc61zkL7d8PYwfJBnO/ewFx6M4jVDZF/UIxbrnc89eAe8A9XQQbuw== X-Received: by 2002:a92:9903:: with SMTP id p3mr863036ili.166.1602708238400; Wed, 14 Oct 2020 13:43:58 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH v1 24/24] qemu_validate.c: move secure boot checks to qemuValidateDomainDefBoot() Date: Wed, 14 Oct 2020 17:43:07 -0300 Message-Id: <20201014204307.631746-25-danielhb413@gmail.com> In-Reply-To: <20201014204307.631746-1-danielhb413@gmail.com> References: <20201014204307.631746-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza 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.13 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 Content-Type: text/plain; charset="utf-8" Signed-off-by: Daniel Henrique Barboza --- src/qemu/qemu_validate.c | 58 ++++++++++++++++++++-------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index 5b5c2ab3dd..eeec2270e6 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -591,6 +591,35 @@ static int qemuValidateDomainDefBoot(const virDomainDef *def, virQEMUCapsPtr qemuCaps) { + if (def->os.loader && + def->os.loader->secure =3D=3D VIR_TRISTATE_BOOL_YES) { + /* These are the QEMU implementation limitations. But we + * have to live with them for now. */ + + if (!qemuDomainIsQ35(def)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Secure boot is supported with q35 machine ty= pes only")); + return -1; + } + + /* Now, technically it is possible to have secure boot on + * 32bits too, but that would require some -cpu xxx magic + * too. Not worth it unless we are explicitly asked. */ + if (def->os.arch !=3D VIR_ARCH_X86_64) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Secure boot is supported for x86_64 architec= ture only")); + return -1; + } + + /* SMM will be enabled by qemuFirmwareFillDomain() if needed. */ + if (def->os.firmware =3D=3D VIR_DOMAIN_OS_DEF_FIRMWARE_NONE && + def->features[VIR_DOMAIN_FEATURE_SMM] !=3D VIR_TRISTATE_SWITCH= _ON) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Secure boot requires SMM feature enabled")); + return -1; + } + } + if (def->os.bios.rt_set) { if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_REBOOT_TIMEOUT)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", @@ -1103,35 +1132,6 @@ qemuValidateDomainDef(const virDomainDef *def, return -1; } =20 - if (def->os.loader && - def->os.loader->secure =3D=3D VIR_TRISTATE_BOOL_YES) { - /* These are the QEMU implementation limitations. But we - * have to live with them for now. */ - - if (!qemuDomainIsQ35(def)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("Secure boot is supported with q35 machine ty= pes only")); - return -1; - } - - /* Now, technically it is possible to have secure boot on - * 32bits too, but that would require some -cpu xxx magic - * too. Not worth it unless we are explicitly asked. */ - if (def->os.arch !=3D VIR_ARCH_X86_64) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("Secure boot is supported for x86_64 architec= ture only")); - return -1; - } - - /* SMM will be enabled by qemuFirmwareFillDomain() if needed. */ - if (def->os.firmware =3D=3D VIR_DOMAIN_OS_DEF_FIRMWARE_NONE && - def->features[VIR_DOMAIN_FEATURE_SMM] !=3D VIR_TRISTATE_SWITCH= _ON) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("Secure boot requires SMM feature enabled")); - return -1; - } - } - if (def->genidRequested && !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VMGENID)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", --=20 2.26.2