From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.158.5]) by mx.groups.io with SMTP id smtpd.web11.8794.1676883002054843275 for ; Mon, 20 Feb 2023 00:50:02 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@ibm.com header.s=pp1 header.b=XxF3Oeef; spf=pass (domain: linux.ibm.com, ip: 148.163.158.5, mailfrom: dovmurik@linux.ibm.com) Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 31K6DKwm011910; Mon, 20 Feb 2023 08:49:59 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=z3UteUUHP8ehdSgTyrAnfmxEDZ6S/CSHGMpWy7rxN00=; b=XxF3OeeffjLCXsbcaZNxRORpYGoceaXH2FppdqqKRco0eEaHcMFfBRSUa8SeiU67MmEn FkI1gwVpXH44tWrIWOsDVvQadyOAV3lghHrA9Qo3MLcljEpsdqlfT1A6P65YJrmsHABz cfBvOQ9yWceXFbpoCB4BvwcbIc0VJeg86SSG/i4eO8bmLP0UhbvLu6m1EyiimN7R8Er7 bsxpK3pmoLv6PwSTGJ9Vfwykyp08VK41sJcY0NSbOL/gBCjncM8qV/vLAQc037x+GhhM OHsDP+ep53rrQIFE6eWe4tCEaNZJQoTfU9S/VnvxHtttLbwnf/N1JrLIkdwrIBCeubKb sQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3nv1ukdgdv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 20 Feb 2023 08:49:59 +0000 Received: from m0098419.ppops.net (m0098419.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 31K89Lw8019097; Mon, 20 Feb 2023 08:49:58 GMT Received: from ppma01wdc.us.ibm.com (fd.55.37a9.ip4.static.sl-reverse.com [169.55.85.253]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3nv1ukdgdf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 20 Feb 2023 08:49:58 +0000 Received: from pps.filterd (ppma01wdc.us.ibm.com [127.0.0.1]) by ppma01wdc.us.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 31K60bcT024430; Mon, 20 Feb 2023 08:49:58 GMT Received: from smtprelay06.dal12v.mail.ibm.com ([9.208.130.100]) by ppma01wdc.us.ibm.com (PPS) with ESMTPS id 3ntpa6m6ts-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 20 Feb 2023 08:49:58 +0000 Received: from smtpav04.dal12v.mail.ibm.com (smtpav04.dal12v.mail.ibm.com [10.241.53.103]) by smtprelay06.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 31K8nuGD9634460 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 20 Feb 2023 08:49:57 GMT Received: from smtpav04.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D9B7358066; Mon, 20 Feb 2023 08:49:56 +0000 (GMT) Received: from smtpav04.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 16E5C5805A; Mon, 20 Feb 2023 08:49:56 +0000 (GMT) Received: from amdmilan1.watson.ibm.com (unknown [9.2.130.16]) by smtpav04.dal12v.mail.ibm.com (Postfix) with ESMTP; Mon, 20 Feb 2023 08:49:56 +0000 (GMT) From: "Dov Murik" To: devel@edk2.groups.io Cc: Dov Murik , Ard Biesheuvel , Jiewen Yao , Jordan Justen , Gerd Hoffmann , Erdem Aktas , James Bottomley , Min Xu , Tom Lendacky , Michael Roth , Ashish Kalra , Mario Smarduch , Tobin Feldman-Fitzthum Subject: [RESEND] [PATCH v2 2/2] OvmfPkg/ResetVector: Exclude SEV launch secrets page from pre-validation Date: Mon, 20 Feb 2023 08:49:42 +0000 Message-Id: <20230220084942.1292756-3-dovmurik@linux.ibm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230220084942.1292756-1-dovmurik@linux.ibm.com> References: <20230220084942.1292756-1-dovmurik@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: RtVNWv0zl8VbuOFO492A_-I39RuF2k6Z X-Proofpoint-ORIG-GUID: JoMEkwoO36UqIPR-SM59amyktEgvNnIX X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.170.22 definitions=2023-02-20_05,2023-02-17_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 mlxlogscore=838 spamscore=0 priorityscore=1501 mlxscore=0 impostorscore=0 suspectscore=0 bulkscore=0 adultscore=0 phishscore=0 lowpriorityscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2302200076 Content-Transfer-Encoding: quoted-printable In order to allow the VMM (such as QEMU) to add a page with hashes of kernel/initrd/cmdline for measured direct boot on SNP, this page must not be part of the SNP metadata list reported to the VMM. Check if that page is defined; if it is, skip it in the metadata list. In such case, VMM should fill the page with the hashes content, or explicitly update it as a zero page (if kernel hashes are not used). Note that for SNP, the launch secret part of the page (lower 3KB) are not relevant and will stay zero. The last 1KB is used for the hashes. This should have no effect on OvmfPkgX64 targets (which don't define PcdSevLaunchSecretBase). Signed-off-by: Dov Murik --- OvmfPkg/ResetVector/ResetVector.nasmb | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/OvmfPkg/ResetVector/ResetVector.nasmb b/OvmfPkg/ResetVector/Re= setVector.nasmb index 94fbb0a87b37..16f3daf49d82 100644 --- a/OvmfPkg/ResetVector/ResetVector.nasmb +++ b/OvmfPkg/ResetVector/ResetVector.nasmb @@ -75,7 +75,19 @@ ;=0D %define SNP_SEC_MEM_BASE_DESC_2 (GHCB_BASE + 0x1000)=0D %define SNP_SEC_MEM_SIZE_DESC_2 (SEV_SNP_SECRETS_BASE - SNP_SEC_MEM_= BASE_DESC_2)=0D -%define SNP_SEC_MEM_BASE_DESC_3 (CPUID_BASE + CPUID_SIZE)=0D +%if (FixedPcdGet32 (PcdSevLaunchSecretBase) > 0)=0D + ; There's a reserved page for SEV secrets and hashes; the VMM will fill = and=0D + ; validate the page, or mark it as a zero page.=0D + %define EXPECTED_END_OF_LAUNCH_SECRET_PAGE (FixedPcdGet32 (PcdSevLaunchS= ecretBase) + \=0D + FixedPcdGet32 (PcdSevLaunchS= ecretSize) + \=0D + FixedPcdGet32 (PcdQemuHashTa= bleSize))=0D + %if (FixedPcdGet32 (PcdOvmfSecPeiTempRamBase) !=3D EXPECTED_END_OF_LAUNC= H_SECRET_PAGE)=0D + %error "PcdOvmfSecPeiTempRamBase must start directly after the SEV Lau= nch Secret page"=0D + %endif=0D + %define SNP_SEC_MEM_BASE_DESC_3 (FixedPcdGet32 (PcdOvmfSecPeiTempRam= Base))=0D +%else=0D + %define SNP_SEC_MEM_BASE_DESC_3 (CPUID_BASE + CPUID_SIZE)=0D +%endif=0D %define SNP_SEC_MEM_SIZE_DESC_3 (FixedPcdGet32 (PcdOvmfPeiMemFvBase)= - SNP_SEC_MEM_BASE_DESC_3)=0D =0D %ifdef ARCH_X64=0D --=20 2.25.1