UefiCpuPkg/PiSmmCpuDxeSmm: Update IfReadOnlyPageTableNeeded

After the 9f29fbd3, full mapping SMM page table is always created
regardless the value of the PcdCpuSmmRestrictedMemoryAccess. If so,
SMM PageTable Attributes can be set to ready-only since there is no
need to update it. So, this patch is to remove restricted memory
access check when setting the SMM PageTable attributes.

Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
This commit is contained in:
Jiaxin Wu 2024-09-02 13:37:51 +08:00 committed by mergify[bot]
parent 4f6614fc18
commit 633a755d99
1 changed files with 1 additions and 18 deletions

View File

@ -1486,31 +1486,14 @@ IfReadOnlyPageTableNeeded (
{
//
// Don't mark page table memory as read-only if
// - no restriction on access to non-SMRAM memory; or
// - SMM heap guard feature enabled; or
// BIT2: SMM page guard enabled
// BIT3: SMM pool guard enabled
// - SMM profile feature enabled
//
if (!IsRestrictedMemoryAccess () ||
((PcdGet8 (PcdHeapGuardPropertyMask) & (BIT3 | BIT2)) != 0) ||
if (((PcdGet8 (PcdHeapGuardPropertyMask) & (BIT3 | BIT2)) != 0) ||
mSmmProfileEnabled)
{
if (sizeof (UINTN) == sizeof (UINT64)) {
//
// Restriction on access to non-SMRAM memory and heap guard could not be enabled at the same time.
//
ASSERT (
!(IsRestrictedMemoryAccess () &&
(PcdGet8 (PcdHeapGuardPropertyMask) & (BIT3 | BIT2)) != 0)
);
//
// Restriction on access to non-SMRAM memory and SMM profile could not be enabled at the same time.
//
ASSERT (!(IsRestrictedMemoryAccess () && mSmmProfileEnabled));
}
return FALSE;
}