UefiCpuPkg/PiSmmCpuDxeSmm: Fix IsSmmCommBufferForbiddenAddress check

SmiPFHandler depends on the IsSmmCommBufferForbiddenAddress() to do
the forbidden address check:
For SMM, verifying whether an address is forbidden is necessary only
when RestrictedMemoryAccess is enabled.
For MM, all accessible address is recorded in the ResourceDescriptor
HOB, so no need check the RestrictedMemoryAccess is enabled or not.

This patch is to move RestrictedMemoryAccess check into SMM
IsSmmCommBufferForbiddenAddress to align with above behavior. With
the change, SmiPFHandler doesn't need to check the
RestrictedMemoryAccess enable or not.

Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
This commit is contained in:
Jiaxin Wu 2024-09-02 14:40:05 +08:00 committed by mergify[bot]
parent c047353a12
commit 897284d47d
2 changed files with 5 additions and 1 deletions

View File

@ -546,6 +546,10 @@ IsSmmCommBufferForbiddenAddress (
UINTN Index;
EFI_MEMORY_DESCRIPTOR *Entry;
if (!IsRestrictedMemoryAccess ()) {
return FALSE;
}
if (mUefiMemoryMap != NULL) {
MemoryMap = mUefiMemoryMap;
MemoryMapEntryCount = mUefiMemoryMapSize/mUefiDescriptorSize;

View File

@ -815,7 +815,7 @@ SmiPFHandler (
goto Exit;
}
if (mCpuSmmRestrictedMemoryAccess && IsSmmCommBufferForbiddenAddress (PFAddress)) {
if (IsSmmCommBufferForbiddenAddress (PFAddress)) {
DEBUG ((DEBUG_ERROR, "Access SMM communication forbidden address (0x%lx)!\n", PFAddress));
}
}