What's Changed
-
[Rebase \& FF] STM Support @kenlautner (#1251)
Change Details
## Description
Adds SMM Transfer Monitor (STM) infrastructure changes.
Cherry-picks the following commits:
c851695 - BaseTools: Add the GenStm C tool9b6df1c - MdeModulePkg/TpmMeasurementLibNull: Add MM_CORE_STANDALONE
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?
- Backport to release branch?
How This Was Tested
Tool tested and is confirmed to function correctly.
Integration Instructions
N/A
</blockquote> <hr> </details>
-
Added MockHiiLib, MockShellLib, MockHiiDatabase protocol @v-bhavanisu (#1248)
Change Details
## Description
Added MockHiiLib, MockShellLib, MockHiiDatabase protocol to be used by GoogleTests
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?
- Backport to release branch?
How This Was Tested
Consumed these mocks in Googletests of other repos and build successful
Integration Instructions
N/A
</blockquote> <hr> </details>
🐛 Bug Fixes
-
[CHERRY-PICK] StandaloneMmPkg: Call PeCoffLoaderUnloadImage When Unloading Image @os-d (#1252)
Change Details
## Description
Today, StandaloneMmCore calls PeCoffLoaderRelocateImage() when loading images, which calls PeCoffLoaderRelocateImageExtraAction(). On AARCH64, this sets the image memory protections accordingly, RO + E on code sections, RW + NX on data sections.
However, if an image fails to start (i.e. its entry point returns a failure) StandaloneMmCore does not call the corresponding PeCoffLoaderUnloadImage, which calls PeCoffLoaderUnloadImageExtraAction, which on AARCH64 undoes the memory protections on the image, setting the whole memory region back to RW + NX. The core then frees this memory and the next allocation attempts to use it, which results in a data abort if a read only memory region is attempted to be written to. Theoretically, other instances of the PeCoffExtraActionLib could take other actions and so regardless of architecture, the contract with the PeCoffLoader should be maintained.
This patch calls PeCoffLoaderUnloadImage when an image's entry point returns a failure, before freeing the image memory. This meets the contract and follows the DXE core behavior.
Cherry-picked (with a little massaging due to uncherry-picked changes in edk2) from: tianocore/edk2@21cbba1
- Impacts functionality?
- Impacts security?
- Breaking change?
- Includes tests?
- Includes documentation?
- Backport to release branch?
How This Was Tested
Tested on an AARCH64 platform where a Standalone MM driver was returning an error, causing the system to crash. With this patch, the system can boot.
Integration Instructions
N/A.
</blockquote> <hr> </details>