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.web08.19153.1663590176742795300 for ; Mon, 19 Sep 2022 05:22:56 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@ibm.com header.s=pp1 header.b=E0ixpS1W; spf=pass (domain: linux.ibm.com, ip: 148.163.156.1, mailfrom: stefanb@linux.ibm.com) Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 28JCC5wZ028138 for ; Mon, 19 Sep 2022 12:22:56 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : date : subject : to : references : from : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pp1; bh=9hzFKdNdT/le3ZCMZl5DByWLIJUg9gn8846wy8hxNyM=; b=E0ixpS1WbavLW1uuMc5x2ftfTt7mLh7SlH8O3NFi0hLZ8SbrpV7vvjYqUqQHAEbUokJW cuLngwhxb5p0xS3RzT7r47ZITqMPgS4ebJFKnpmsEniCAu3+4V0gXZwktrLJYMmoz5Oa 8gCQvj8SmeACRDMd7wjvqge/e9FlUrnaeE1VgeOQaZ/5fdVZ9LdE7U18xmbniQV7MxoL abgMoLSg2XdZFyyokl9fx9x0/t0eaJJiww9hli23SKVbwTOy+npm/2Ur8p+8AGYseknC cIPqFQJaKuYRQXg2D0yHrutRQ22VapvXJPjdVu99MYNu3RocWR/P6NiK2QU1FMriuj/E MQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3jpr7f89x4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 19 Sep 2022 12:22:56 +0000 Received: from m0098404.ppops.net (m0098404.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 28JCEtPn012591 for ; Mon, 19 Sep 2022 12:22:55 GMT Received: from ppma03dal.us.ibm.com (b.bd.3ea9.ip4.static.sl-reverse.com [169.62.189.11]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3jpr7f89wn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 19 Sep 2022 12:22:55 +0000 Received: from pps.filterd (ppma03dal.us.ibm.com [127.0.0.1]) by ppma03dal.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 28JCL5Ym009404; Mon, 19 Sep 2022 12:22:54 GMT Received: from b03cxnp08025.gho.boulder.ibm.com (b03cxnp08025.gho.boulder.ibm.com [9.17.130.17]) by ppma03dal.us.ibm.com with ESMTP id 3jn5v98r3e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 19 Sep 2022 12:22:54 +0000 Received: from b03ledav005.gho.boulder.ibm.com (b03ledav005.gho.boulder.ibm.com [9.17.130.236]) by b03cxnp08025.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 28JCMqhX3867212 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 19 Sep 2022 12:22:53 GMT Received: from b03ledav005.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B826EBE051; Mon, 19 Sep 2022 12:41:30 +0000 (GMT) Received: from b03ledav005.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5D794BE053; Mon, 19 Sep 2022 12:41:30 +0000 (GMT) Received: from [9.47.158.152] (unknown [9.47.158.152]) by b03ledav005.gho.boulder.ibm.com (Postfix) with ESMTP; Mon, 19 Sep 2022 12:41:30 +0000 (GMT) Message-ID: Date: Mon, 19 Sep 2022 08:22:52 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.12.0 Subject: Re: [edk2-devel] TPM2 EventLog EFI vs. ACPI To: devel@edk2.groups.io, imammedo@redhat.com, Jason Andryuk References: <20220919111753.0d17e87a@redhat.com> From: "Stefan Berger" In-Reply-To: <20220919111753.0d17e87a@redhat.com> X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: Bh3V2ciYH1v8Ef2t1i8fOGS479fLid-9 X-Proofpoint-GUID: QqbR5M98CGFwLCcxVZPTZjo_AnroixGg X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.528,FMLib:17.11.122.1 definitions=2022-09-19_05,2022-09-16_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 spamscore=0 mlxscore=0 impostorscore=0 suspectscore=0 priorityscore=1501 lowpriorityscore=0 clxscore=1011 phishscore=0 malwarescore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2209190081 Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 9/19/22 05:17, Igor Mammedov wrote: > On Fri, 16 Sep 2022 15:45:38 -0400 > "Jason Andryuk" wrote: > > CCing Stefan as he is probably the best person to talk about qemu > impl. of TPM > >> Hi, >> >> I've noticed an issue with the TPM2 EventLog. OVMF exposes the TPM >> Event Log via EFI and ACPI, but they have different addresses. The >> EFI one retrievable by GetEventLog() is populated. The ACPI is empty. The ACPI one is for SeaBIOS. >> Oh, there are actually two EFI Event Logs for the two formats: >> EFI_TCG2_EVENT_LOG_FORMAT_TCG_1_2 >> EFI_TCG2_EVENT_LOG_FORMAT_TCG_2 >> >> The debug log from the Fedora 36 OVMF shows: >> Tcg2GetEventLog (EventLogLocation - 7EEB2000) >> which matches the address retrieved with GetEventLog(). >> And hexdump-ing the TPM2 ACPI table shows 0x7fbe6000. >> >> On a different build, I added output for both EFI logs, and the addresses are: >> 0x7ec3d000 - EFI_TCG2_EVENT_LOG_FORMAT_TCG_1_2 >> 0x7ec1b000 - EFI_TCG2_EVENT_LOG_FORMAT_TCG_2 I am also not familiar with the origin of the EDK2 code as to why it was done this way. Maybe typical builds for EDK2 don't include TPM 1.2 and TPM 2 and OVMF is an outlier here... >> 0x7fbe6000 - ACPI >> >> The ACPI one is a little more user friendly as its address is >> available through the table during runtime. The EFI addresses can >> only be grabbed before exiting boot services. >> >> I think the issue is that the ACPI tables are created from Qemu fw_cfg >> data, which allocates memory for the log and places the address in >> ACPI tables. Meanwhile, That's because of SeaBIOS iirc. >> SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c:SetupEventLog() allocates its own >> event log memory. SetupEventLog() saves the size and address in >> PcdTpm2AcpiTableLaml & PcdTpm2AcpiTableLasa, but nothing puts those >> values in the actual ACPI tables. >> >> It seems like SetupEventLog would be better structured to check >> existing ACPI tables and look for a log in a TPM2 section. If found, >> use that, otherwise create a new log area. >> >> The other wrinkle is that the Tcg2 code is keeping two event logs in >> the two formats. It seems to me that for TPM2, it would be easier to Does it log everything twice? >> just keep only the newer EFI_TCG2_EVENT_LOG_FORMAT_TCG_2. If support >> for both is needed, then the EFI_TCG2_EVENT_LOG_FORMAT_TCG_2 one >> should share the same region as the ACPI tab Regards, Stefan >> >> Regards, >> Jason >> >> >> >> >> > > > > > >