From nobody Mon Sep 16 19:30:24 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=1679081358; cv=none; d=zohomail.com; s=zohoarc; b=HALSE4gd33zxpJZElGzij6LoOiVN7uAEddpQDvkgyuHvmZXiKfzA1aFraKcqS8PaJzthPWfezQl+ueUQ+nXkodItfVi603uNYt9K13Y+xTr9ueIWZ8D38ZQ6iSjR3UJoY3Y/Xk7eE/ObTURW8qvFNUxig5Pb4DA2leVp10wpLn0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1679081358; 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=iVsIZm33BvvtteL7ZJqIh5hZWPlBjSTbNPW9A2AcYF8=; b=PR5JaZoE+wKPQ/uAdFHU2vduHBIextkLagJi5C8OZcpAw71Z6fAqEH+zy3oTOQT67QdagDXig/8vtKoRH8/vNaRqVYkwjOkTjBpeFdIJgoH+tKX8Hgzov587hij8jEt2Z1KL/9ddX4NYHYIt7wpIyCn2ErPmkCmG3cghSNzjNDg= 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 1679081358509422.0625369022856; Fri, 17 Mar 2023 12:29:18 -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-96-OMA4U5WXMdmF2NGpLr0dHQ-1; Fri, 17 Mar 2023 15:28:04 -0400 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0F88E886465; Fri, 17 Mar 2023 19:27:56 +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 F05FA40D1C7; Fri, 17 Mar 2023 19:27:55 +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 D6D1E1946A49; Fri, 17 Mar 2023 19:27:55 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 8DC5F19466DF for ; Fri, 17 Mar 2023 19:27:54 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 83FBE40C6F87; Fri, 17 Mar 2023 19:27:54 +0000 (UTC) Received: from harajuku.usersys.redhat.com.homenet.telecomitalia.it (unknown [10.45.226.11]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 17D8340C6E68 for ; Fri, 17 Mar 2023 19:27:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1679081357; 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=iVsIZm33BvvtteL7ZJqIh5hZWPlBjSTbNPW9A2AcYF8=; b=HoluGMauq8wL19CsjKuJumJG1jvIqww5u/C2ucYqjztIFlhq9jOZ3ChHlzpIEd8Nf3XZUG mVkm/yjcSd5WiJhn2ggYYjuo1HYrQN35kZXN7uQzbtdjMCLV2B89c/SXnepWzPHF99DZQw SEO9GyiLsugUprMipgMd2x89yPmo7zE= X-MC-Unique: OMA4U5WXMdmF2NGpLr0dHQ-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Andrea Bolognani To: libvir-list@redhat.com Subject: [libvirt PATCH 07/15] qemu: Discard requires-smm firmware when loader.secure=no Date: Fri, 17 Mar 2023 20:27:39 +0100 Message-Id: <20230317192747.1311223-8-abologna@redhat.com> In-Reply-To: <20230317192747.1311223-1-abologna@redhat.com> References: <20230317192747.1311223-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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 3.1 on 10.11.54.10 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: 1679081358991100003 Content-Type: text/plain; charset="utf-8"; x-default="true" The requires-smm feature being present in a firmware descriptor causes loader.secure=3Dyes to be automatically chosen for the domain, so we have to avoid this situation or the user's choice will be silently subverted. Note that we can't actually encounter loader.secure=3Dno in this function at the moment because of earlier checks, but that's going to change soon. Signed-off-by: Andrea Bolognani --- src/qemu/qemu_firmware.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/qemu/qemu_firmware.c b/src/qemu/qemu_firmware.c index 172be05d06..f7d7f78578 100644 --- a/src/qemu/qemu_firmware.c +++ b/src/qemu/qemu_firmware.c @@ -1196,6 +1196,11 @@ qemuFirmwareMatchDomain(const virDomainDef *def, "but firmware '%s' requires it to be enabled", path); return false; } + if (loader && loader->secure =3D=3D VIR_TRISTATE_BOOL_NO) { + VIR_DEBUG("Domain doesn't restrict pflash programming to SMM, " + "but firmware '%s' requires use of SMM", path); + return false; + } } else { if (loader && loader->secure =3D=3D VIR_TRISTATE_BOOL_YES) { VIR_DEBUG("Domain restricts pflash programming to SMM, " --=20 2.39.2