From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by mx.groups.io with SMTP id smtpd.web10.263.1606847888700757751 for ; Tue, 01 Dec 2020 10:38:08 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@ibm.com header.s=pp1 header.b=FP38RHqv; spf=pass (domain: linux.ibm.com, ip: 148.163.156.1, mailfrom: jejb@linux.ibm.com) Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 0B1ISV2q044755; Tue, 1 Dec 2020 13:38:05 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : subject : from : reply-to : to : cc : date : in-reply-to : references : content-type : mime-version : content-transfer-encoding; s=pp1; bh=GOtL3OmVaLVu6U+OwRfd9otDbhSVIPhkk+9AvMWFVhE=; b=FP38RHqvxXAb5c5E06cPW9C+0W8ulYEWhI+ixHocG/Zj96kyhdyPOETYE0+fseJ1b2k5 V1SqE1C5y8zWkG+wgZjJb3ShDjNK84N4Uoc5rc5WxYMu61KeFJDrvq3AviJZb/L3R53Z ziJQJgn2njKB6dgkgF1w15qijGn5zJTSt+h43eQH6nPs8TwoW+P0mlk30p0xU+0yeU4b BaDA6DVIkHmeVeAStNq0P59UGMRNwL1yi8MbBu+nX+Pq/V48D4J/cwc7VZx04fNHFKjm cFpgX11PZgSohedVMeazy11gl3T05fSBQKYPPEEN5Ki4aReImBryFuFnvwomhKj3ujuZ Vw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 355a7a6m46-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 01 Dec 2020 13:38:04 -0500 Received: from m0098396.ppops.net (m0098396.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 0B1ISuoa046247; Tue, 1 Dec 2020 13:38:04 -0500 Received: from ppma01wdc.us.ibm.com (fd.55.37a9.ip4.static.sl-reverse.com [169.55.85.253]) by mx0a-001b2d01.pphosted.com with ESMTP id 355a7a6m3m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 01 Dec 2020 13:38:04 -0500 Received: from pps.filterd (ppma01wdc.us.ibm.com [127.0.0.1]) by ppma01wdc.us.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 0B1ISaBi022973; Tue, 1 Dec 2020 18:38:03 GMT Received: from b03cxnp08027.gho.boulder.ibm.com (b03cxnp08027.gho.boulder.ibm.com [9.17.130.19]) by ppma01wdc.us.ibm.com with ESMTP id 353e694adv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 01 Dec 2020 18:38:03 +0000 Received: from b03ledav004.gho.boulder.ibm.com (b03ledav004.gho.boulder.ibm.com [9.17.130.235]) by b03cxnp08027.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 0B1IadJu29360546 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 1 Dec 2020 18:36:39 GMT Received: from b03ledav004.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B420E7805F; Tue, 1 Dec 2020 18:36:45 +0000 (GMT) Received: from b03ledav004.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4A61B7805C; Tue, 1 Dec 2020 18:36:43 +0000 (GMT) Received: from jarvis.int.hansenpartnership.com (unknown [9.80.201.242]) by b03ledav004.gho.boulder.ibm.com (Postfix) with ESMTP; Tue, 1 Dec 2020 18:36:43 +0000 (GMT) Message-ID: Subject: Re: [edk2-devel] [PATCH v3 5/6] OvmfPkg/AmdSev: assign and protect the Sev Secret area From: "James Bottomley" Reply-To: jejb@linux.ibm.com To: devel@edk2.groups.io, ard.biesheuvel@arm.com Cc: dovmurik@linux.vnet.ibm.com, Dov.Murik1@il.ibm.com, ashish.kalra@amd.com, brijesh.singh@amd.com, tobin@ibm.com, david.kaplan@amd.com, jon.grimm@amd.com, thomas.lendacky@amd.com, frankeh@us.ibm.com, "Dr . David Alan Gilbert" , Laszlo Ersek , Jordan Justen Date: Tue, 01 Dec 2020 10:36:41 -0800 In-Reply-To: <48062d01-55bf-68ec-5603-436d8426ad74@arm.com> References: <20201130202819.3910-1-jejb@linux.ibm.com> <20201130202819.3910-6-jejb@linux.ibm.com> <48062d01-55bf-68ec-5603-436d8426ad74@arm.com> User-Agent: Evolution 3.34.4 MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.312,18.0.737 definitions=2020-12-01_07:2020-11-30,2020-12-01 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 phishscore=0 adultscore=0 clxscore=1015 priorityscore=1501 spamscore=0 suspectscore=0 impostorscore=0 mlxscore=0 mlxlogscore=954 malwarescore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2012010110 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit On Tue, 2020-12-01 at 08:54 +0100, Ard Biesheuvel wrote: > Hi James, > > On 11/30/20 9:28 PM, James Bottomley wrote: > > Create a one page secret area in the MEMFD and protect the area > > with a > > boot time HOB. > > > > I take it 'protect' here only means prevent the memory from being > used for somethine else? Yes, make sure it's not allocated as free memory until exit boot services. > In the context of security, encryption, secrets, > etc, it might be useful to call that out. OK, how about reserve instead of protect? James > > Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3077 > > Signed-off-by: James Bottomley > > Reviewed-by: Laszlo Ersek > > --- > > OvmfPkg/AmdSev/AmdSevX64.dsc | 1 + > > OvmfPkg/AmdSev/AmdSevX64.fdf | 4 +++ > > OvmfPkg/AmdSev/SecretPei/SecretPei.inf | 35 > > ++++++++++++++++++++++++++ > > OvmfPkg/AmdSev/SecretPei/SecretPei.c | 25 ++++++++++++++++++ > > 4 files changed, 65 insertions(+) > > create mode 100644 OvmfPkg/AmdSev/SecretPei/SecretPei.inf > > create mode 100644 OvmfPkg/AmdSev/SecretPei/SecretPei.c > > > > diff --git a/OvmfPkg/AmdSev/AmdSevX64.dsc > > b/OvmfPkg/AmdSev/AmdSevX64.dsc > > index 18707725b3e4..e9c522bedad9 100644 > > --- a/OvmfPkg/AmdSev/AmdSevX64.dsc > > +++ b/OvmfPkg/AmdSev/AmdSevX64.dsc > > @@ -613,6 +613,7 @@ [Components] > > OvmfPkg/PlatformPei/PlatformPei.inf > > UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume2Pei.inf > > UefiCpuPkg/CpuMpPei/CpuMpPei.inf > > + OvmfPkg/AmdSev/SecretPei/SecretPei.inf > > > > !if $(TPM_ENABLE) == TRUE > > OvmfPkg/Tcg/Tcg2Config/Tcg2ConfigPei.inf > > diff --git a/OvmfPkg/AmdSev/AmdSevX64.fdf > > b/OvmfPkg/AmdSev/AmdSevX64.fdf > > index 1aa95826384a..b2656a1cf6fc 100644 > > --- a/OvmfPkg/AmdSev/AmdSevX64.fdf > > +++ b/OvmfPkg/AmdSev/AmdSevX64.fdf > > @@ -59,6 +59,9 @@ [FD.MEMFD] > > 0x00B000|0x001000 > > > > gUefiCpuPkgTokenSpaceGuid.PcdSevEsWorkAreaBase|gUefiCpuPkgTokenSpac > > eGuid.PcdSevEsWorkAreaSize > > > > +0x00C000|0x001000 > > +gUefiOvmfPkgTokenSpaceGuid.PcdSevLaunchSecretBase|gUefiOvmfPkgToke > > nSpaceGuid.PcdSevLaunchSecretSize > > + > > 0x010000|0x010000 > > > > gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPeiTempRamBase|gUefiOvmfPkgTok > > enSpaceGuid.PcdOvmfSecPeiTempRamSize > > > > @@ -138,6 +141,7 @@ [FV.PEIFV] > > INF MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf > > INF UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume2Pei.inf > > INF UefiCpuPkg/CpuMpPei/CpuMpPei.inf > > +INF OvmfPkg/AmdSev/SecretPei/SecretPei.inf > > > > !if $(TPM_ENABLE) == TRUE > > INF OvmfPkg/Tcg/Tcg2Config/Tcg2ConfigPei.inf > > diff --git a/OvmfPkg/AmdSev/SecretPei/SecretPei.inf > > b/OvmfPkg/AmdSev/SecretPei/SecretPei.inf > > new file mode 100644 > > index 000000000000..08be156c4bc0 > > --- /dev/null > > +++ b/OvmfPkg/AmdSev/SecretPei/SecretPei.inf > > @@ -0,0 +1,35 @@ > > +## @file > > +# PEI support for SEV Secrets > > +# > > +# Copyright (C) 2020 James Bottomley, IBM Corporation. > > +# > > +# SPDX-License-Identifier: BSD-2-Clause-Patent > > +# > > +## > > + > > +[Defines] > > + INF_VERSION = 0x00010005 > > + BASE_NAME = SecretPei > > + FILE_GUID = 45260dde-0c3c-4b41-a226- > > ef3803fac7d4 > > + MODULE_TYPE = PEIM > > + VERSION_STRING = 1.0 > > + ENTRY_POINT = InitializeSecretPei > > + > > +[Sources] > > + SecretPei.c > > + > > +[Packages] > > + OvmfPkg/OvmfPkg.dec > > + MdePkg/MdePkg.dec > > + > > +[LibraryClasses] > > + HobLib > > + PeimEntryPoint > > + PcdLib > > + > > +[FixedPcd] > > + gUefiOvmfPkgTokenSpaceGuid.PcdSevLaunchSecretBase > > + gUefiOvmfPkgTokenSpaceGuid.PcdSevLaunchSecretSize > > + > > +[Depex] > > + TRUE > > diff --git a/OvmfPkg/AmdSev/SecretPei/SecretPei.c > > b/OvmfPkg/AmdSev/SecretPei/SecretPei.c > > new file mode 100644 > > index 000000000000..ad491515dd5d > > --- /dev/null > > +++ b/OvmfPkg/AmdSev/SecretPei/SecretPei.c > > @@ -0,0 +1,25 @@ > > +/** @file > > + SEV Secret boot time HOB placement > > + > > + Copyright (C) 2020 James Bottomley, IBM Corporation. > > + SPDX-License-Identifier: BSD-2-Clause-Patent > > +**/ > > +#include > > +#include > > +#include > > + > > +EFI_STATUS > > +EFIAPI > > +InitializeSecretPei ( > > + IN EFI_PEI_FILE_HANDLE FileHandle, > > + IN CONST EFI_PEI_SERVICES **PeiServices > > + ) > > +{ > > + BuildMemoryAllocationHob ( > > + PcdGet32 (PcdSevLaunchSecretBase), > > + PcdGet32 (PcdSevLaunchSecretSize), > > + EfiBootServicesData > > + ); > > + > > + return EFI_SUCCESS; > > +} > > > > > > >