SecurityPkg: Introduce Dynamic TCG Log Scaling V2#1805
Conversation
❌ QEMU Validation FailedSource Dependencies
Results
Workflow run: https://github.com/microsoft/mu_basecore/actions/runs/27445505537 This comment was automatically generated by the Mu QEMU PR Validation workflow. |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## release/202511 #1805 +/- ##
=================================================
Coverage ? 2.24%
=================================================
Files ? 1640
Lines ? 421324
Branches ? 5035
=================================================
Hits ? 9469
Misses ? 411773
Partials ? 82
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR adds dynamic scaling of the TCG2 “normal” event log in Tcg2Dxe (doubling the allocation when the log would otherwise truncate), adjusts TPM2 ACPI table construction to treat LAML/LASA as optional by omitting them when unset, and introduces a multi-boot test (DXE + Shell UnitTest app) plus documentation for the new behavior.
Changes:
- Implement dynamic event log scaling in
SecurityPkg/Tcg/Tcg2Dxeand allocate the normal log fromEfiBootServicesData. - Update TPM2 ACPI table producers (
Tcg2Acpi,Tcg2AcpiFfa) to conditionally remove LAML/LASA from table length when unset; update shared TPM2 ACPI header types. - Add
TcgLogTest(DXE driver + UnitTest shell app) and README documentation to validate scaling pre- and post-ReadyToBoot.
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| SecurityPkg/Tcg/TcgLogTest/TcgLogTestDxe.inf | New DXE test driver module definition. |
| SecurityPkg/Tcg/TcgLogTest/TcgLogTestDxe.c | Implements pre-ReadyToBoot scaling test + protocol for log retrieval/enable. |
| SecurityPkg/Tcg/TcgLogTest/TcgLogTestCommon.h | Shared test helpers declarations. |
| SecurityPkg/Tcg/TcgLogTest/TcgLogTestCommon.c | Shared event-log walking, “log until scaled”, and dump logic. |
| SecurityPkg/Tcg/TcgLogTest/TcgLogTestApp.inf | New UnitTest shell application module definition. |
| SecurityPkg/Tcg/TcgLogTest/TcgLogTestApp.c | Post-ReadyToBoot scaling UnitTest + multi-boot coordination. |
| SecurityPkg/Tcg/TcgLogTest/TcgLogTest.h | Defines the TcgLogTest protocol and enable NV variable name. |
| SecurityPkg/Tcg/TcgLogTest/README.md | Documents the three-boot test flow and integration steps. |
| SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.inf | Updates protocol/PCD declarations related to ACPI log fields. |
| SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c | Adds dynamic scaling logic + ReadyToBoot tracking + allocation change. |
| SecurityPkg/Tcg/Tcg2Dxe/README.md | New documentation for scaling behavior and log types. |
| SecurityPkg/Tcg/Tcg2AcpiFfa/Tcg2AcpiFfa.inf | Adds new PCD consumption for skipping ACPI measurements. |
| SecurityPkg/Tcg/Tcg2AcpiFfa/Tcg2AcpiFfa.c | Refactors TPM2 ACPI table template handling and optional LAML/LASA logic. |
| SecurityPkg/Tcg/Tcg2Acpi/Tcg2Acpi.c | Refactors TPM2 ACPI table template handling and optional LAML/LASA logic. |
| SecurityPkg/SecurityPkg.dsc | Adds the new TcgLogTest modules to the package DSC. |
| SecurityPkg/SecurityPkg.dec | Publishes the new gTcgLogTestProtocolGuid. |
| MdePkg/Include/IndustryStandard/Tpm2Acpi.h | Introduces common-field macro and revisioned TPM2 table struct types. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
e95cd15 to
632c81d
Compare
…microsoft#257)" This reverts commit 348b4bd.
b365e48 to
a48c475
Compare
Implemented dynamic TCG log scaling in Tcg2Dxe. When the log would become truncated it instead now dynamically scales doubling the size each time. An ERROR log is reported that an increase to your base log size should occur such that scaling is not necessary. This is a precaution against platforms that log a lot and the addition of new hashing algorithms for PQC. The log is allocated in BootServices memory. Tests were added via TcgLogTest which includes a DXE driver and a UEFI shell UnitTest app. The DXE driver handles pre-ReadyToBoot tests while the TestApp handles post-ReadyToBoot tests as well as gathering the test results from the DXE driver. Markdown documents were created to detail the changes. The dynamic scaling functionality removes setting the LAML/LASA in the ACPI table. Updated the ACPI code to fix an issue where the template was outdated and the revision was reporting V5 but the template was still using the V4 version of the Start Method specific parameters. Added the Truncation event marker to the end of the FinalEventLog when it becomes truncated. Added a event signal for when scaling occurs on the normal event log. Consumers can trigger callbacks on this event; the test app uses this to know when scaling occurs. Signed-off-by: Raymond Diaz <raymonddiaz@microsoft.com>
a48c475 to
ec34e3d
Compare
Description
Implemented dynamic TCG log scaling in Tcg2Dxe. When the log would become truncated it instead now dynamically scales doubling the size each time. An ERROR log is reported that an increase to your base log size should occur such that scaling is not necessary. This is a precaution against platforms that log a lot and the addition of new hashing algorithms for PQC. The log is allocated in BootServices memory. Tests were added via TcgLogTest which includes a DXE driver and a UEFI shell UnitTest app. The DXE driver handles pre-ReadyToBoot tests while the TestApp handles post-ReadyToBoot tests as well as gathering the test results from the DXE driver. Markdown documents were created to detail the changes.
This version of dynamic scaling never sets the ACPI table LAML/LASA which means the table is never published with the log information. As such the only way to access the event log is through the Tcg2Protocol published by Tcg2Dxe. The LAML/LASA fields are OPTIONAL and when not set are removed from the table.
For details on how to complete these options and their meaning refer to CONTRIBUTING.md.
How This Was Tested
Tested via TcgLogTest included in the reference QEMU ARM VIRT platform with TPM enabled. Confirmed the UnitTest results. All tests report PASS.
Integration Instructions
Include the TcgLogTest .inf's to your platform .dsc and .fdf files. You will need to include both the TcgLogTestDxe and TcgLogTestApp for full functionality.