From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by mx.groups.io with SMTP id smtpd.web09.9963.1631626412702768394 for ; Tue, 14 Sep 2021 06:33:33 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@ibm.com header.s=pp1 header.b=dlrgJkIb; spf=pass (domain: linux.ibm.com, ip: 148.163.158.5, mailfrom: stefanb@linux.ibm.com) Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.0.43) with SMTP id 18EC7Rd6029577; Tue, 14 Sep 2021 09:33:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=subject : to : cc : references : from : message-id : date : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pp1; bh=sQAz7+oLdbcqcJCttInTs8mqbA9qK2fDN3v4rXGVZzo=; b=dlrgJkIbhljZeHI8qW3y9f5PZ/QhsugQhRpkIj+AFXFA5tr64qmnP8Y2Ak5zQ4rMJYZ7 yeY6nIy+pLz/vPr+JL35r+jQxmEgQWlNHuoD1HH7Agfz++Ottc2ePomS4wwYZGTt1ZZ9 S8lieIppOuqIwDftokkNyk7r3g/xxUh5Q8H/BlbpgjsIWaqHoRSFyjptFg/G6GLpvr0x 7jVgdSaASuLgCs7ZXrvATNx3EBhgVa+U+9KtnnWXUvP5CKv70G4ZAeGuJh9LCtjxGljr KLh3w7DySzUqDqE30zlbFXBDiG1/hlWlEDFf69eV+XuyGivfDM3qDzyS4yyqyjDsaR8p 2w== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3b2s7x5q07-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 14 Sep 2021 09:33:29 -0400 Received: from m0098421.ppops.net (m0098421.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 18EClJPR016394; Tue, 14 Sep 2021 09:33:28 -0400 Received: from ppma02dal.us.ibm.com (a.bd.3ea9.ip4.static.sl-reverse.com [169.62.189.10]) by mx0a-001b2d01.pphosted.com with ESMTP id 3b2s7x5pyw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 14 Sep 2021 09:33:28 -0400 Received: from pps.filterd (ppma02dal.us.ibm.com [127.0.0.1]) by ppma02dal.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 18EDXMvd009219; Tue, 14 Sep 2021 13:33:28 GMT Received: from b01cxnp22035.gho.pok.ibm.com (b01cxnp22035.gho.pok.ibm.com [9.57.198.25]) by ppma02dal.us.ibm.com with ESMTP id 3b0m3axcmp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 14 Sep 2021 13:33:28 +0000 Received: from b01ledav005.gho.pok.ibm.com (b01ledav005.gho.pok.ibm.com [9.57.199.110]) by b01cxnp22035.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 18EDXJQC38928746 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 14 Sep 2021 13:33:19 GMT Received: from b01ledav005.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 977ADAE068; Tue, 14 Sep 2021 13:33:19 +0000 (GMT) Received: from b01ledav005.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 866C7AE060; Tue, 14 Sep 2021 13:33:19 +0000 (GMT) Received: from [9.47.158.152] (unknown [9.47.158.152]) by b01ledav005.gho.pok.ibm.com (Postfix) with ESMTP; Tue, 14 Sep 2021 13:33:19 +0000 (GMT) Subject: Re: [RFC PATCH v1 0/4] OvmfPkg: Disable the TPM 2 platform hierarchy To: "Yao, Jiewen" , "devel@edk2.groups.io" , sami.mujawar@arm.com, ardb+tianocore@kernel.org, leif@nuviainc.com Cc: "marcandre.lureau@redhat.com" , "kraxel@redhat.com" References: <20210913205722.2553473-1-stefanb@linux.vnet.ibm.com> From: "Stefan Berger" Message-ID: <3c65ef80-9fcb-81a7-2f45-ced178e1a46a@linux.ibm.com> Date: Tue, 14 Sep 2021 09:33:19 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 In-Reply-To: X-TM-AS-GCONF: 00 X-Proofpoint-GUID: 7h1JUGL5yz8DfHIENvzFolAsvSKjlA_z X-Proofpoint-ORIG-GUID: rewJGuKO-VAv-J0sG4ZbkgzSagKj6Owl X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.687,Hydra:6.0.235,FMLib:17.0.607.475 definitions=2020-10-13_15,2020-10-13_02,2020-04-07_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 spamscore=0 suspectscore=0 malwarescore=0 priorityscore=1501 clxscore=1011 mlxscore=0 impostorscore=0 phishscore=0 lowpriorityscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2109030001 definitions=main-2109140056 X-MIME-Autoconverted: from 8bit to quoted-printable by mx0a-001b2d01.pphosted.com id 18EC7Rd6029577 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 9/13/21 10:18 PM, Yao, Jiewen wrote: > Hi Stefan > I recommend we add some comment in the code on the "trusted console" de= finition. > > [Patch 1] > + // Console for user interaction > // We need connect all trusted console for TCG PP. Here we treat all co= nsole in OVMF to be trusted console. > + EfiBootManagerConnectAllDefaultConsoles (); > > > [Patch 2] > // We need connect all trusted console for TCG PP. Here we treat all co= nsole in OVMF to be trusted console. > + PlatformInitializeConsole ( > + XenDetected() ? gXenPlatformConsole : gPlatformConsole); > > With that change, Reviewed-by: Jiewen Yao Thanks. I'll post v2 once the tests have run through. I am also cc'ing ArmVirtPkg maintainers now since we'll need to think=20 about how to do this on ARM for the TPM 2 platform hierarchy=20 disablement. The relevant code we just added is here: https://github.com/tianocore/edk2/tree/master/SecurityPkg/Tcg/Tcg2Platfor= mDxe https://github.com/tianocore/edk2/tree/master/SecurityPkg/Library/PeiDxeT= pmPlatformHierarchyLib The function we need to have invoked [ConfigureTpmPlatformHierarchy ()]=20 one way or another is here: https://github.com/tianocore/edk2/blob/master/SecurityPkg/Library/PeiDxeT= pmPlatformHierarchyLib/PeiDxeTpmPlatformHierarchyLib.c#L241 On x86 this function is called via gEfiDxeSmmReadyToLockProtocolGuid=20 which was registered/subscribed to in the entrypoint function of=20 Tcg2PlaformDxe here: https://github.com/tianocore/edk2/blob/master/SecurityPkg/Tcg/Tcg2Platfor= mDxe/Tcg2PlatformDxe.c#L66 As far as I know there's no SMM mode on ARM. So what's the best way of=20 doing this? Should we call the function ConfigureTpmPlatformHierarchy ()=20 directly from some point in ArmVirtPkg? [=20 https://github.com/tianocore/edk2/blob/master/SecurityPkg/Tcg/Tcg2Platfor= mDxe/Tcg2PlatformDxe.c#L49=20 ] Or should ARM also have/emulate a 'gEfiDxeSmmReadyToLockProtocolGuid'=20 even though it doesn't have an SMM mode? Regards, =C2=A0Stefan > > > >> -----Original Message----- >> From: Stefan Berger >> Sent: Tuesday, September 14, 2021 4:57 AM >> To: devel@edk2.groups.io >> Cc: mhaeuser@posteo.de; spbrogan@outlook.com; >> marcandre.lureau@redhat.com; kraxel@redhat.com; Yao, Jiewen >> ; Stefan Berger >> Subject: [RFC PATCH v1 0/4] OvmfPkg: Disable the TPM 2 platform hierar= chy >> >> This series of patches adds support for disabling the TPM 2 platform >> hierarchy to Ovmf. To be able to do this we have to handle TPM 2 >> physical presence interface (PPI) opcodes before the TPM 2 platform >> hierarchy is disabled otherwise TPM 2 commands that are sent due to th= e >> PPI opcodes may fail if the platform hierarchy is already disabled. >> Therefore, we need to invoke the handler function >> Tcg2PhysicalPresenceLibProcessRequest from within >> PlatformBootManagerBeforeConsole. Since handling of PPI opcodes may >> require >> interaction with the user, we also move PlatformInitializeConsole >> to before the handling of PPI codes so that the keyboard is available >> when needed. The PPI handling code will activate the default consoles >> only if it requires user interaction. >> >> The question to answer at this point is whether the rearragement of >> functions is correct or what an alternative should look like. There >> are other BdsPlatform files that may need similar changes in a later >> revision of this series. >> >> Regards, >> Stefan >> >> Stefan Berger (4): >> OvmfPkg/TPM PPI: Connect default consoles for user interaction >> OvmfPkg: Handle TPM 2 physical presence codes much earlier >> OvmfPkg: Reference new Tcg2PlatformDxe in the build system for >> compilation >> OvmfPkg: Reference new Tcg2PlatformPei in the build system >> >> OvmfPkg/AmdSev/AmdSevX64.dsc | 8 ++++++++ >> OvmfPkg/AmdSev/AmdSevX64.fdf | 2 ++ >> .../PlatformBootManagerLib/BdsPlatform.c | 17 +++++++++------= -- >> .../DxeTcg2PhysicalPresenceLib.c | 4 ++++ >> OvmfPkg/OvmfPkgIa32.dsc | 8 ++++++++ >> OvmfPkg/OvmfPkgIa32.fdf | 2 ++ >> OvmfPkg/OvmfPkgIa32X64.dsc | 8 ++++++++ >> OvmfPkg/OvmfPkgIa32X64.fdf | 2 ++ >> OvmfPkg/OvmfPkgX64.dsc | 8 ++++++++ >> OvmfPkg/OvmfPkgX64.fdf | 2 ++ >> 10 files changed, 53 insertions(+), 8 deletions(-) >> >> -- >> 2.31.1