mirror of
https://github.com/acidanthera/audk.git
synced 2025-04-07 19:45:07 +02:00
UefiCpuPkg/PiSmmCpu: Restrict access per PcdCpuSmmRestrictedMemoryAccess
Today's behavior is to always restrict access to non-SMRAM regardless the value of PcdCpuSmmRestrictedMemoryAccess. Because RAS components require to access all non-SMRAM memory, the patch changes the code logic to honor PcdCpuSmmRestrictedMemoryAccess so that only when the PCD is true, the restriction takes affect and page table memory is also protected. Because IA32 build doesn't reference this PCD, such restriction always takes affect in IA32 build. Signed-off-by: Ray Ni <ray.ni@intel.com> Reviewed-by: Eric Dong <eric.dong@intel.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
This commit is contained in:
parent
09f7c82b4c
commit
79186ddcdd
@ -336,3 +336,17 @@ RestoreCr2 (
|
||||
{
|
||||
return ;
|
||||
}
|
||||
|
||||
/**
|
||||
Return whether access to non-SMRAM is restricted.
|
||||
|
||||
@retval TRUE Access to non-SMRAM is restricted.
|
||||
@retval FALSE Access to non-SMRAM is not restricted.
|
||||
*/
|
||||
BOOLEAN
|
||||
IsRestrictedMemoryAccess (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -1431,15 +1431,17 @@ PerformRemainingTasks (
|
||||
//
|
||||
SetMemMapAttributes ();
|
||||
|
||||
//
|
||||
// For outside SMRAM, we only map SMM communication buffer or MMIO.
|
||||
//
|
||||
SetUefiMemMapAttributes ();
|
||||
if (IsRestrictedMemoryAccess ()) {
|
||||
//
|
||||
// For outside SMRAM, we only map SMM communication buffer or MMIO.
|
||||
//
|
||||
SetUefiMemMapAttributes ();
|
||||
|
||||
//
|
||||
// Set page table itself to be read-only
|
||||
//
|
||||
SetPageTableAttributes ();
|
||||
//
|
||||
// Set page table itself to be read-only
|
||||
//
|
||||
SetPageTableAttributes ();
|
||||
}
|
||||
|
||||
//
|
||||
// Configure SMM Code Access Check feature if available.
|
||||
|
@ -1450,4 +1450,15 @@ InitializeDataForMmMp (
|
||||
VOID
|
||||
);
|
||||
|
||||
/**
|
||||
Return whether access to non-SMRAM is restricted.
|
||||
|
||||
@retval TRUE Access to non-SMRAM is restricted.
|
||||
@retval FALSE Access to non-SMRAM is not restricted.
|
||||
*/
|
||||
BOOLEAN
|
||||
IsRestrictedMemoryAccess (
|
||||
VOID
|
||||
);
|
||||
|
||||
#endif
|
||||
|
@ -1252,3 +1252,17 @@ RestoreCr2 (
|
||||
AsmWriteCr2 (Cr2);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Return whether access to non-SMRAM is restricted.
|
||||
|
||||
@retval TRUE Access to non-SMRAM is restricted.
|
||||
@retval FALSE Access to non-SMRAM is not restricted.
|
||||
*/
|
||||
BOOLEAN
|
||||
IsRestrictedMemoryAccess (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
return mCpuSmmRestrictedMemoryAccess;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user