summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiaxin Wu <jiaxin.wu@intel.com>2024-09-02 12:22:41 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2024-09-06 08:41:49 +0000
commit4f6614fc180c3f24a72ac3234daba8575f13cbad (patch)
tree594a9026f5a03b899f564dadc370fdbd9a6650dc
parentf6eb069e1719a6203814846bd953d85518bc4f21 (diff)
downloadedk2-4f6614fc180c3f24a72ac3234daba8575f13cbad.tar.gz
edk2-4f6614fc180c3f24a72ac3234daba8575f13cbad.tar.bz2
edk2-4f6614fc180c3f24a72ac3234daba8575f13cbad.zip
UefiCpuPkg/PiSmmCpuDxeSmm: Correct SetPageTableAttributes func usage
SetPageTableAttributes() will use the IfReadOnlyPageTableNeeded() to determine whether it is necessary to set the page table itself to read-only. And IfReadOnlyPageTableNeeded() has already token into account the status of IsRestrictedMemoryAccess(). Therefore, there is no need for an additional call to IsRestrictedMemoryAccess() before calling the SetPageTableAttributes(). Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
-rw-r--r--UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c10
-rw-r--r--UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuStandaloneMm.c10
2 files changed, 8 insertions, 12 deletions
diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c
index 50aeefb948..0ecdd2d891 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c
@@ -95,12 +95,10 @@ PerformRemainingTasks (
SetMemMapAttributes (MemoryAttributesTable);
}
- if (IsRestrictedMemoryAccess ()) {
- //
- // 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.
diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuStandaloneMm.c b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuStandaloneMm.c
index f81389463f..6f59b49305 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuStandaloneMm.c
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuStandaloneMm.c
@@ -70,12 +70,10 @@ PerformRemainingTasks (
SetMemMapAttributes (MemoryAttributesTable);
}
- if (IsRestrictedMemoryAccess ()) {
- //
- // Set page table itself to be read-only
- //
- SetPageTableAttributes ();
- }
+ //
+ // Set page table itself to be read-only
+ //
+ SetPageTableAttributes ();
//
// Measure performance of SmmCpuFeaturesCompleteSmmReadyToLock() from caller side