summaryrefslogtreecommitdiffstats
path: root/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c
diff options
context:
space:
mode:
authorNi, Ray <ray.ni@intel.com>2019-07-18 14:58:07 +0800
committerRay Ni <ray.ni@intel.com>2019-07-26 14:55:47 +0800
commit30f6148546c7092650ab4886fc6d95d5065c3188 (patch)
tree63e02fc8c84876b165f22c05fe66a29b80528f2e /UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c
parent520a1e60de4341f55c59cf4680d6d0242a7f929f (diff)
downloadedk2-30f6148546c7092650ab4886fc6d95d5065c3188.tar.gz
edk2-30f6148546c7092650ab4886fc6d95d5065c3188.tar.bz2
edk2-30f6148546c7092650ab4886fc6d95d5065c3188.zip
UefiCpuPkg/PiSmmCpu: Allow SMM access-out when static paging is OFF
Commit c60d36b4d1ee1f69b7cca897d3621dfa951895c2 * UefiCpuPkg/SmmCpu: Block access-out only when static paging is used updated page fault handler to treat SMM access-out as allowed address when static paging is not used. But that commit is not complete because the page table is still updated in SetUefiMemMapAttributes() for non-SMRAM memory. When SMM code accesses non-SMRAM memory, page fault is still generated. This patch skips to update page table for non-SMRAM memory and page table itself. Signed-off-by: Ray Ni <ray.ni@intel.com> Cc: Eric Dong <eric.dong@intel.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Jian J Wang <jian.j.wang@intel.com> Acked-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Eric Dong <eric.dong@intel.com>
Diffstat (limited to 'UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c')
-rw-r--r--UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c
index 69a04dfb23..50614f32c3 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c
@@ -1121,6 +1121,9 @@ FindSmramInfo (
*SmrrBase = (UINT32)CurrentSmramRange->CpuStart;
*SmrrSize = (UINT32)CurrentSmramRange->PhysicalSize;
+ //
+ // Extend *SmrrBase/*SmrrSize to include adjacent SMRAM ranges
+ //
do {
Found = FALSE;
for (Index = 0; Index < mSmmCpuSmramRangeCount; Index++) {
@@ -1432,14 +1435,20 @@ PerformRemainingTasks (
SetMemMapAttributes ();
//
- // For outside SMRAM, we only map SMM communication buffer or MMIO.
+ // Do not protect memory outside SMRAM when SMM static page table is not enabled.
//
- SetUefiMemMapAttributes ();
+ if (mCpuSmmStaticPageTable) {
- //
- // Set page table itself to be read-only
- //
- SetPageTableAttributes ();
+ //
+ // For outside SMRAM, we only map SMM communication buffer or MMIO.
+ //
+ SetUefiMemMapAttributes ();
+
+ //
+ // Set page table itself to be read-only
+ //
+ SetPageTableAttributes ();
+ }
//
// Configure SMM Code Access Check feature if available.