Acidanthera UEFI Development Kit based on EDK II edk2-stable202311
Go to file
Laszlo Ersek ead7cb12d5 OvmfPkg: prevent code execution from DXE stack
SVN rev 18166 ("MdeModulePkg DxeIpl: Add stack NX support") enables
platforms to request non-executable stack for the DXE phase, by setting
PcdSetNxForStack to TRUE.

The PCD defaults to FALSE, because:

(a) A non-executable DXE stack is a new feature and causes changes in
    behavior. Some platform could rely on executing code from the stack.

(b) The code enabling NX in the DXE IPL PEIM enforces the

      PcdSetNxForStack ==> PcdDxeIplBuildPageTables

    implication for "64-bit PEI + 64-bit DXE" platforms, with a new
    ASSERT(). Some platform might not comply with this requirement
    immediately.

Regarding (a), in none of the OVMF builds do we try to execute code from
the stack.

Regarding (b):

- In the OvmfPkgX64.dsc build (which is where (b) applies) we simply
  inherit the PcdDxeIplBuildPageTables|TRUE default from
  "MdeModulePkg/MdeModulePkg.dec". Therefore we can set PcdSetNxForStack
  to TRUE.

- In OvmfPkgIa32X64.dsc, page tables are built by default for DXE. Hence
  we can set PcdSetNxForStack to TRUE.

- In OvmfPkgIa32.dsc, page tables used not to be necessary until now.
  After we set PcdSetNxForStack to TRUE in this patch, the DXE IPL will
  construct page tables even when it is built as part of OvmfPkgIa32.dsc,
  provided the (virtual) hardware supports both PAE mode and the XD bit.

Should this setting cause problems in a GPU (or other device) passthru
scenario, with a UEFI_DRIVER in the PCI option rom attempting to execute
code from the stack, the feature can be dynamically disabled on the QEMU
command line, with "-cpu <MODEL>,-nx".

Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: "Zeng, Star" <star.zeng@intel.com>
Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18360 6f19259b-4bc3-4df7-8a09-765794883524
2015-08-28 08:12:51 +00:00
AppPkg */Contributions.txt: Update example email address 2015-02-03 17:29:14 +00:00
ArmPkg ArmPkg: remove ARMv6 support code 2015-08-19 10:51:59 +00:00
ArmPlatformPkg ArmPlatformPkg/FVP: unify support for Foundation and Base models 2015-08-25 13:11:25 +00:00
ArmVirtPkg ArmVirtPkg: revert unintended change to ArmVirt.dsc.inc 2015-08-26 12:09:39 +00:00
BaseTools BaseTools: Fixed bug for single FV generating. 2015-08-28 02:04:37 +00:00
BeagleBoardPkg BeagleBoardPkg: remove outdated build scripts and instructions 2015-08-12 05:25:41 +00:00
Conf EDK II: Add .gitignore 2014-10-14 16:08:15 +00:00
CorebootModulePkg CorebootModulePkg:Removing EFI_RESOURCE_ATTRIBUTE_TESTED 2015-08-18 16:08:22 +00:00
CorebootPayloadPkg CorebootPayloadPkgIa32: Don't specify X64 architecture 2015-07-27 06:43:29 +00:00
CryptoPkg CryptoPkg: Add a missed include file to fix the possible build issue. 2015-08-20 08:49:31 +00:00
DuetPkg DuetPkg: Use the new PCDs defined in MdePkg. 2015-05-06 03:26:49 +00:00
EdkCompatibilityPkg EdkCompatibilityPkg: Remove gZeroGuid def in FrameworkHiiOnUefiHiiThunk 2015-07-07 03:05:18 +00:00
EdkShellBinPkg */Contributions.txt: Update example email address 2015-02-03 17:29:14 +00:00
EdkShellPkg */Contributions.txt: Update example email address 2015-02-03 17:29:14 +00:00
EmbeddedPkg EmbeddedPkg: remove mention of ARMGCC 2015-08-12 05:25:19 +00:00
EmulatorPkg EmulatorPkg: Link separated VarCheckUefiLib NULL class library instance 2015-08-25 03:03:05 +00:00
FatBinPkg FatBinPkg: Update EBC/IA32/X64/IPF binaries 2015-08-28 03:14:25 +00:00
IntelFrameworkModulePkg IntelFrameworkModulePkg: Ad the missing module UNI files. 2015-08-28 02:47:31 +00:00
IntelFrameworkPkg IntelFrameworkPkg: Update DEC and DSC version from 0.94 to 0.96 2015-08-20 08:45:45 +00:00
IntelFspPkg IntelFspPkg: Remove the const condition if statement to refine the code. 2015-08-03 02:59:55 +00:00
IntelFspWrapperPkg FspNotifyDxe need handle >4G memory. 2015-07-28 07:26:57 +00:00
MdeModulePkg MdeModulePkg: Remove unused variables from both UefiBootManagerLib and BdsDxe to fix GCC build. 2015-08-28 05:41:06 +00:00
MdePkg MdePkg UefiDevicePathLib: Fix possible memory read/write cross boundary 2015-08-28 07:41:38 +00:00
NetworkPkg NetworkPkg: Fix IpSec run into infinite loop issue in some case 2015-08-28 07:00:32 +00:00
Nt32Pkg Nt32Pkg: Keep boot behavior using new BDS almost same as that using old BDS 2015-08-25 09:51:07 +00:00
Omap35xxPkg */Contributions.txt: Update example email address 2015-02-03 17:29:14 +00:00
OptionRomPkg OptionRomPkg: Remove redundant included header file defintion in Ax88772.h and Ax88772b.h files 2015-07-08 02:56:54 +00:00
OvmfPkg OvmfPkg: prevent code execution from DXE stack 2015-08-28 08:12:51 +00:00
PcAtChipsetPkg PcAtChipsetPkg/PciHostBridgeDxe/PciRootBridgeIo.c: rewrap code, strip trailing ws 2015-07-14 12:01:30 +00:00
PerformancePkg PerformancePkg Dp_App: Fix ASSERT in GetNameFromHandle 2015-07-13 01:24:44 +00:00
SecurityPkg SecurityPkg: Use safe string function. 2015-08-28 02:51:50 +00:00
ShellBinPkg ShellBinPkg: Ia32/X64 Shell binary update. 2015-08-28 04:51:21 +00:00
ShellPkg ShellPkg: Replace use case of deprecated function GetVariable with GetVariable2. 2015-08-27 04:45:23 +00:00
SourceLevelDebugPkg SourceLevelDebugPkg/DebugTimer: Timer count value 0 not calculated 2015-08-27 02:08:56 +00:00
StdLib StdLib: remove mention of ARMGCC 2015-08-12 05:25:12 +00:00
StdLibPrivateInternalFiles */Contributions.txt: Update example email address 2015-02-03 17:29:14 +00:00
UefiCpuPkg UefiCpuPkg CpuDxe: Sync up the settings of Execute Disable to APs 2015-08-08 00:00:36 +00:00
UnixPkg UnixPkg: Remove UnixPkg files (It is replaced by EmulatorPkg) 2013-07-29 21:09:55 +00:00
Vlv2DeviceRefCodePkg Vlv2TbltDevicePkg: Sync the branch changes to trunk. 2015-08-05 07:26:45 +00:00
Vlv2TbltDevicePkg Vlv2TbltDevicePkg: Link separated VarCheckUefiLib NULL class library instance 2015-08-25 03:04:18 +00:00
.gitignore EDK II: Add .gitignore 2014-10-14 16:08:15 +00:00
BuildNotes2.txt Update to new SVN URL in readme.txt 2013-06-08 05:26:39 +00:00
Edk2Setup.bat Edk2: Update Edk2Setup.bat 2015-06-16 07:23:45 +00:00
Maintainers.txt Maintainers.txt: Add Daryl's new email address 2015-07-26 08:06:05 +00:00
edksetup.bat Update edksetup.bat to support Microsoft Visual Studio 2013 when building the Nt32Pkg emulation platform (enabled using the --nt32 flag). 2014-10-30 17:09:25 +00:00
edksetup.sh edksetup.sh: Ensure that WORKSPACE points to the top of an edk2 checkout 2014-07-28 17:37:40 +00:00