Skip to content

SecurityPkg: Introduce Dynamic TCG Log Scaling#1788

Open
Raymond-MS wants to merge 8 commits into
microsoft:release/202511from
Raymond-MS:personal/rdiaz/DynamicTcgLog
Open

SecurityPkg: Introduce Dynamic TCG Log Scaling#1788
Raymond-MS wants to merge 8 commits into
microsoft:release/202511from
Raymond-MS:personal/rdiaz/DynamicTcgLog

Conversation

@Raymond-MS
Copy link
Copy Markdown
Contributor

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. The ACPI log is created on ReadyToBoot with logs being added to both until they would need to scale. In this instance a truncation event is added to the ACPI log to indicate that the log is no longer valid and/or may not contain the entirety of the log. This ACPI log is allocated in NVS memory. If the ACPI table was already allocated at the time of the ACPI log creation, it is uninstalled and reinstalled with the updated LAML and LASA PCDs. 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.

For details on how to complete these options and their meaning refer to CONTRIBUTING.md.

  • Impacts functionality?
  • Impacts security?
  • Breaking change?
  • Includes tests?
  • Includes documentation?

How This Was Tested

Tested via TcgLogTest included in the reference QEMU SBSA platform with TPM enabled. Confirmed the UnitTest results. Both 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.

@mu-automation
Copy link
Copy Markdown
Contributor

mu-automation Bot commented May 8, 2026

✅ QEMU Validation Passed

Source Dependencies

Repository Commit
mu_basecore 4d886b7
mu_tiano_platforms 78fad16

Results

Platform Target Build Boot Overall Boot Time Build Logs Boot Logs
Q35 DEBUG ✅ success ✅ success 0m 18s Build Logs Boot Logs
SBSA DEBUG ✅ success ✅ success 0m 33s Build Logs Boot Logs

Workflow run: https://github.com/microsoft/mu_basecore/actions/runs/25770214018

This comment was automatically generated by the Mu QEMU PR Validation workflow.

@Raymond-MS Raymond-MS force-pushed the personal/rdiaz/DynamicTcgLog branch 2 times, most recently from 83f4da1 to 7711c4f Compare May 8, 2026 19:52
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 8, 2026

Codecov Report

❌ Patch coverage is 0% with 839 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (release/202511@6f6a7c6). Learn more about missing BASE report.

Files with missing lines Patch % Lines
SecurityPkg/Tcg/TcgLogTest/TcgLogTestCommon.c 0.00% 281 Missing ⚠️
SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c 0.00% 224 Missing ⚠️
SecurityPkg/Tcg/TcgLogTest/TcgLogTestApp.c 0.00% 175 Missing ⚠️
SecurityPkg/Tcg/TcgLogTest/TcgLogTestDxe.c 0.00% 139 Missing ⚠️
SecurityPkg/Tcg/Tcg2Acpi/Tcg2Acpi.c 0.00% 10 Missing ⚠️
SecurityPkg/Tcg/Tcg2AcpiFfa/Tcg2AcpiFfa.c 0.00% 10 Missing ⚠️
Additional details and impacted files
@@                Coverage Diff                @@
##             release/202511    #1788   +/-   ##
=================================================
  Coverage                  ?    2.21%           
=================================================
  Files                     ?     1636           
  Lines                     ?   420850           
  Branches                  ?     4949           
=================================================
  Hits                      ?     9308           
  Misses                    ?   411467           
  Partials                  ?       75           
Flag Coverage Δ
FmpDevicePkg 9.53% <ø> (?)
MdeModulePkg 1.58% <ø> (?)
MdePkg 5.44% <ø> (?)
NetworkPkg 0.55% <ø> (?)
PolicyServicePkg 30.42% <ø> (?)
SecurityPkg 1.56% <0.00%> (?)
UefiCpuPkg 4.78% <ø> (?)
UnitTestFrameworkPkg 11.70% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Member

@makubacki makubacki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Raymond-MS, I found the accompanying documentation helpful. I left some comments in a quick first pass, I might follow up when I have time to look in more detail.

Comment thread SecurityPkg/Tcg/Tcg2Dxe/README.md Outdated
Comment thread SecurityPkg/SecurityPkg.dec Outdated
Comment thread SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c Outdated
Comment thread SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c Outdated
Comment thread SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c Outdated
Comment thread SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c Outdated
Comment thread SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c Outdated
Comment thread SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c Outdated
Comment thread SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c
Comment thread SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c
@Raymond-MS Raymond-MS force-pushed the personal/rdiaz/DynamicTcgLog branch from 7711c4f to 2ee0b3c Compare May 11, 2026 21:16
@Raymond-MS Raymond-MS requested a review from makubacki May 11, 2026 22:23
…come 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. The ACPI log is created on ReadyToBoot with logs being added to both until they would need to scale. In this instance a truncation event is added to the ACPI log to indicate that the log is no longer valid and/or may not contain the entirety of the log. This ACPI table is allocated in NVS memory. If the ACPI table was already allocated at the time of the ACPI log creation, it is uninstalled and reinstalled with the updated LAML and LASA PCDs. Tests were added via TcgLogTest which includes a DXE driver and a UEFI shelld 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.
…used dynamic scaling to occur. Scaling the log now makes sure the LastEvent pointer is always valid.
@Raymond-MS Raymond-MS force-pushed the personal/rdiaz/DynamicTcgLog branch from ee53d3f to 4d886b7 Compare May 13, 2026 00:09
@Raymond-MS Raymond-MS requested a review from Flickdm May 13, 2026 00:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants