BZ#: https://bugzilla.tianocore.org/show_bug.cgi?id=1116

Since the stack memory is allocated as EfiBootServicesData, its NX protection
can be covered by BIT4 of PcdDxeNxMemoryProtectionPolicy. To avoid confusing
in setting related PCDs, PcdSetNxForStack will be expired. Set BIT4 of
PcdDxeNxMemoryProtectionPolicy if NX protection is needed for stack.

Cc: Star Zeng <star.z...@intel.com>
Cc: Laszlo Ersek <ler...@redhat.com>
Cc: Ard Biesheuvel <ard.biesheu...@linaro.org>
Cc: Ruiyu Ni <ruiyu...@intel.com>
Cc: Jiewen Yao <jiewen....@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jian J Wang <jian.j.w...@intel.com>
---
 MdeModulePkg/MdeModulePkg.dec | 10 +---------
 MdeModulePkg/MdeModulePkg.uni | 10 +---------
 2 files changed, 2 insertions(+), 18 deletions(-)

diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec
index 74a699cbb7..b1f208909c 100644
--- a/MdeModulePkg/MdeModulePkg.dec
+++ b/MdeModulePkg/MdeModulePkg.dec
@@ -1320,6 +1320,7 @@
   #
   # NOTE: User must NOT set NX protection for EfiLoaderCode / 
EfiBootServicesCode / EfiRuntimeServicesCode. <BR>
   #       User MUST set the same NX protection for EfiBootServicesData and 
EfiConventionalMemory. <BR>
+  #       Stack is allocated as type of EfiBootServicesData. Enable NX 
protection for it will also enable NX protection for stack. <BR>
   #
   # e.g. 0x7FD5 can be used for all memory except Code. <BR>
   # e.g. 0x7BD4 can be used for all memory except Code and ACPINVS/Reserved. 
<BR>
@@ -1886,15 +1887,6 @@
   # @Prompt Default Creator Revision for ACPI table creation.
   
gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorRevision|0x01000013|UINT32|0x30001038
 
-  ## Indicates if to set NX for stack.<BR><BR>
-  #  For the DxeIpl and the DxeCore are both X64, set NX for stack feature 
also require PcdDxeIplBuildPageTables be TRUE.<BR>
-  #  For the DxeIpl and the DxeCore are both IA32 (PcdDxeIplSwitchToLongMode 
is FALSE), set NX for stack feature also require
-  #  IA32 PAE is supported and Execute Disable Bit is available.<BR>
-  #   TRUE  - to set NX for stack.<BR>
-  #   FALSE - Not to set NX for stack.<BR>
-  # @Prompt Set NX for stack.
-  gEfiMdeModulePkgTokenSpaceGuid.PcdSetNxForStack|FALSE|BOOLEAN|0x0001006f
-
   ## This PCD specifies the PCI-based SD/MMC host controller mmio base address.
   # Define the mmio base address of the pci-based SD/MMC host controller. If 
there are multiple SD/MMC
   # host controllers, their mmio base addresses are calculated one by one from 
this base address.
diff --git a/MdeModulePkg/MdeModulePkg.uni b/MdeModulePkg/MdeModulePkg.uni
index 080b8a62c0..6b26b21f00 100644
--- a/MdeModulePkg/MdeModulePkg.uni
+++ b/MdeModulePkg/MdeModulePkg.uni
@@ -339,15 +339,6 @@
 
 #string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdSerialRegisterStride_HELP  
#language en-US "The number of bytes between registers in serial device.  The 
default is 1 byte."
 
-#string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdSetNxForStack_PROMPT  #language 
en-US "Set NX for stack"
-
-#string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdSetNxForStack_HELP  #language 
en-US "Indicates if to set NX for stack.<BR><BR>"
-                                                                               
   "For the DxeIpl and the DxeCore are both X64, set NX for stack feature also 
require PcdDxeIplBuildPageTables be TRUE.<BR>"
-                                                                               
   "For the DxeIpl and the DxeCore are both IA32 (PcdDxeIplSwitchToLongMode is 
FALSE), set NX for stack feature also require"
-                                                                               
   "IA32 PAE is supported and Execute Disable Bit is available.<BR>"
-                                                                               
   "TRUE  - to set NX for stack.<BR>"
-                                                                               
   "FALSE - Not to set NX for stack.<BR>"
-
 #string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdAcpiS3Enable_PROMPT  #language 
en-US "ACPI S3 Enable"
 
 #string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdAcpiS3Enable_HELP  #language 
en-US "Indicates if ACPI S3 will be enabled.<BR><BR>"
@@ -1129,6 +1120,7 @@
                                                                                
                 "\n"
                                                                                
                 "NOTE: User must NOT set NX protection for EfiLoaderCode / 
EfiBootServicesCode / EfiRuntimeServicesCode. <BR>\n"
                                                                                
                 "User MUST set the same NX protection for EfiBootServicesData 
and EfiConventionalMemory. <BR>\n"
+                                                                               
                 "Stack is allocated as type of EfiBootServicesData. Enable NX 
protection for it will also enable NX protection for stack. <BR>\n"
                                                                                
                 "\n"
                                                                                
                 "e.g. 0x7FD5 can be used for all memory except Code. <BR>\n"
                                                                                
                 "e.g. 0x7BD4 can be used for all memory except Code and 
ACPINVS/Reserved. <BR>\n"
-- 
2.16.2.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to