Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MemoryInitPei: Remove Non-RT Types from Mem Type Info HOB (#168)
## Description MemoryInitPei: Remove Non-RT Types from Mem Type Info HOB Removes the following types from the memory type information HOBs produced in the MemoryInitPei modules in ArmPlatformPkg and ArmVirtPkg. - `EfiBootServicesCode` - `EfiBootServicesData` - `EfiLoaderCode` - `EfiLoaderData` When the memory type information UEFI variable is updated in BDS, it goes through the common variable check code attached to the UEFI variable driver which explicitly checks the size of the variable data to determine if the variable update is valid. MemoryTypeInfoVarCheckHandler () in MdeModulePkg/Library/MemoryTypeInfoSecVarCheckLib/MemoryTypeInfoSecVarCheckLib.c. The size here is `0x50` instead of the expected size of `0x30`. It is not common to place non-runtime memory types in the memory type information HOB so the types are removed from the HOB published here to align with typical code expectations. UEFI variable update error: ``` ERROR: MemoryTypeInfoVarCheckHandler() - DataSize = 0x50 Expected = 0x30 Variable Check handler fail Security Violation - 4C19049F-4137-4DD3-9C10-8B97A83FFDFA:MemoryTypeInformation Memory Type Information settings cannot be saved. OS S4 may fail! ``` Some Arm platforms may use a different UEFI variable driver that does not perform this check. If the types are truly needed, the variable check code should be updated to compensate for them. - [x] Impacts functionality? - **Functionality** - Does the change ultimately impact how firmware functions? - Examples: Add a new library, publish a new PPI, update an algorithm, ... - [ ] Impacts security? - **Security** - Does the change have a direct security impact on an application, flow, or firmware? - Examples: Crypto algorithm change, buffer overflow fix, parameter validation improvement, ... - [ ] Breaking change? - **Breaking change** - Will anyone consuming this change experience a break in build or boot behavior? - Examples: Add a new library class, move a module to a different repo, call a function in a new library class in a pre-existing module, ... - [ ] Includes tests? - **Tests** - Does the change include any explicit test code? - Examples: Unit tests, integration tests, robot tests, ... - [ ] Includes documentation? - **Documentation** - Does the change contain explicit documentation additions outside direct code modifications (and comments)? - Examples: Update readme file, add feature readme file, link to documentation on an a separate Web page, ... ## How This Was Tested - ArmPlatformPkg build and CI - ArmVirtPkg build and CI - QemuSbsaPkg build and boot to EFI shell with test apps ## Integration Instructions Review code to determine if either of these PEIMs (`MemoryInitPeim`). If so, whether code was dependent on the memory types in the memory type information HOB that were removed to determine if further changes are needed. --------- Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
- Loading branch information