Skip to content

Commit

Permalink
REBASE: Updated PcdCpuStackGuard references to PcdCpuSmmStackGuard re…
Browse files Browse the repository at this point in the history
…ferences
  • Loading branch information
kenlautner committed Dec 18, 2023
1 parent 337fc6b commit 01a3f55
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
CcExitLib

[Pcd]
gEfiMdeModulePkgTokenSpaceGuid.PcdCpuStackGuard
#gEfiMdeModulePkgTokenSpaceGuid.PcdCpuStackGuard # MU_CHANGE
gUefiCpuPkgTokenSpaceGuid.PcdCpuStackSwitchExceptionList
gUefiCpuPkgTokenSpaceGuid.PcdCpuKnownGoodStackSize

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
CcExitLib

[Pcd]
gEfiMdeModulePkgTokenSpaceGuid.PcdCpuStackGuard
#gEfiMdeModulePkgTokenSpaceGuid.PcdCpuStackGuard # MU_CHANGE
gUefiCpuPkgTokenSpaceGuid.PcdCpuStackSwitchExceptionList
gUefiCpuPkgTokenSpaceGuid.PcdCpuKnownGoodStackSize

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -743,10 +743,13 @@ TestCpuStackGuardInBspAndAp (
VOID *NewIdtr;
UINTN *CpuStackBaseBuffer;

if (!PcdGetBool (PcdCpuStackGuard)) {
// MU_CHANGE Start
if (!PcdGetBool (PcdCpuSmmStackGuard)) {
return UNIT_TEST_PASSED;
}

// MU_CHANGE End

//
// Get MP Service Protocol
//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,12 @@
gEfiHobMemoryAllocStackGuid

[Pcd]
gEfiMdeModulePkgTokenSpaceGuid.PcdCpuStackGuard ## CONSUMES
#gEfiMdeModulePkgTokenSpaceGuid.PcdCpuStackGuard ## CONSUMES # MU_CHANGE
gUefiCpuPkgTokenSpaceGuid.PcdCpuApStackSize ## CONSUMES

[FeaturePcd]
gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmStackGuard ## CONSUMES # MU_CHANGE

[Protocols]
gEfiMpServiceProtocolGuid
gEfiTimerArchProtocolGuid
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,12 @@
PeiServicesTablePointerLib

[Pcd]
gEfiMdeModulePkgTokenSpaceGuid.PcdCpuStackGuard ## CONSUMES
# gEfiMdeModulePkgTokenSpaceGuid.PcdCpuStackGuard ## CONSUMES # MU_CHANGE
gUefiCpuPkgTokenSpaceGuid.PcdCpuApStackSize ## CONSUMES

[FeaturePcd]
gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmStackGuard ## CONSUMES # MU_CHANGE

[Ppis]
gEdkiiPeiMpServices2PpiGuid ## CONSUMES

Expand Down
1 change: 0 additions & 1 deletion UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,6 @@ SmiPFHandler (

Exit:
ReleaseSpinLock (mPFLock);

}

/**
Expand Down
2 changes: 2 additions & 0 deletions UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include <Protocol/SmmCpuService.h>
#include <Protocol/SmmMemoryAttribute.h>
#include <Protocol/MmMp.h>
#include <Protocol/SmmExceptionTestProtocol.h>

#include <Guid/AcpiS3Context.h>
#include <Guid/MemoryAttributesTable.h>
Expand Down Expand Up @@ -307,6 +308,7 @@ EFIAPI
EnableCet (
VOID
);

extern BOOLEAN mSmmRebootOnException; // MS_CHANGE

//
Expand Down
20 changes: 18 additions & 2 deletions UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c
Original file line number Diff line number Diff line change
Expand Up @@ -1825,18 +1825,34 @@ IfReadOnlyPageTableNeeded (
// BIT3: SMM pool guard enabled
// - SMM profile feature enabled
//
if (!IsRestrictedMemoryAccess () ||

// MU_CHANGE START

/*if (!IsRestrictedMemoryAccess () ||
((PcdGet8 (PcdHeapGuardPropertyMask) & (BIT3 | BIT2)) != 0) ||
FeaturePcdGet (PcdCpuSmmProfileEnable))
{*/
// MU_CHANGE END
if (!IsRestrictedMemoryAccess () ||
((gMmMps.HeapGuardPolicy.Fields.MmPageGuard | gMmMps.HeapGuardPolicy.Fields.MmPoolGuard) != 0) ||
FeaturePcdGet (PcdCpuSmmProfileEnable))
{
// MU_CHANGE END
if (sizeof (UINTN) == sizeof (UINT64)) {
//
// Restriction on access to non-SMRAM memory and heap guard could not be enabled at the same time.
//
ASSERT (
// MU_CHANGE START

/*ASSERT (
!(IsRestrictedMemoryAccess () &&
(PcdGet8 (PcdHeapGuardPropertyMask) & (BIT3 | BIT2)) != 0)
); */
ASSERT (
!(IsRestrictedMemoryAccess () &&
(gMmMps.HeapGuardPolicy.Fields.MmPageGuard | gMmMps.HeapGuardPolicy.Fields.MmPoolGuard) != 0)
);
// MU_CHANGE END

//
// Restriction on access to non-SMRAM memory and SMM profile could not be enabled at the same time.
Expand Down

0 comments on commit 01a3f55

Please sign in to comment.