ArmVirtPkg: ArmVirtQemu: Add Custom Stack Cookies

In order to provide an example and test out dynamic stack
cookies in edk2, dynamic stack cookies are added to ArmVirtPkg
platforms using ArmVirt.dsc.inc, per maintainer request.

This does require moving the ArmVirt.dsc.inc to be included
before MdeLibs.dsc.inc as the BaseTools does not expand all
the Defines sections before processing.

Signed-off-by: Oliver Smith-Denny <osde@linux.microsoft.com>
This commit is contained in:
Oliver Smith-Denny 2024-10-28 10:56:51 -07:00 committed by mergify[bot]
parent 861b91d975
commit 1f1182c396
6 changed files with 24 additions and 10 deletions

View File

@ -17,7 +17,8 @@
DEFINE DEBUG_PRINT_ERROR_LEVEL = 0x8000004F
!if $(TARGET) != NOOPT
# Dynamic stack cookies pushes the FD size up slightly over 2MB
!if $(TARGET) != NOOPT && $(ARCH) == ARM
DEFINE FD_SIZE_IN_MB = 2
!else
DEFINE FD_SIZE_IN_MB = 3
@ -32,6 +33,13 @@
DEFINE FD_NUM_BLOCKS = 0x300
!endif
# Dynamic stack cookies are not supported on ARM
!if $(ARCH) == ARM
DEFINE CUSTOM_STACK_CHECK_LIB = STATIC
!else
DEFINE CUSTOM_STACK_CHECK_LIB = DYNAMIC
!endif
[BuildOptions.common.EDKII.DXE_CORE,BuildOptions.common.EDKII.DXE_DRIVER,BuildOptions.common.EDKII.UEFI_DRIVER,BuildOptions.common.EDKII.UEFI_APPLICATION]
GCC:*_*_*_DLINK_FLAGS = -z common-page-size=0x1000
@ -67,8 +75,6 @@
UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf
DxeServicesTableLib|MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.inf
DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf
HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf
UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServicesLib.inf
SortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf
@ -233,7 +239,6 @@
[LibraryClasses.common.DXE_CORE]
HobLib|MdePkg/Library/DxeCoreHobLib/DxeCoreHobLib.inf
MemoryAllocationLib|MdeModulePkg/Library/DxeCoreMemoryAllocationLib/DxeCoreMemoryAllocationLib.inf
DxeCoreEntryPoint|MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf
ExtractGuidedSectionLib|MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.inf
PerformanceLib|MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf
@ -274,6 +279,9 @@
BaseCryptLib|CryptoPkg/Library/BaseCryptLibMbedTls/BaseCryptLib.inf
MbedTlsLib|CryptoPkg/Library/MbedTlsLib/MbedTlsLib.inf
RngLib|MdePkg/Library/BaseRngLibTimerLib/BaseRngLibTimerLib.inf
UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf
DxeCoreEntryPoint|MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf
[BuildOptions]
GCC:RELEASE_*_*_CC_FLAGS = -DMDEPKG_NDEBUG

View File

@ -28,6 +28,7 @@
DEFINE TTY_TERMINAL = FALSE
DEFINE SECURE_BOOT_ENABLE = FALSE
# This comes before MdeLibs to ensure stack cookie configuration is chosen
!include ArmVirtPkg/ArmVirt.dsc.inc
[LibraryClasses.common]

View File

@ -30,6 +30,8 @@
[Defines.AARCH64]
DEFINE ACPIVIEW_ENABLE = TRUE
# This comes before MdeLibs to ensure stack cookie configuration is chosen
!include ArmVirtPkg/ArmVirt.dsc.inc
!if $(ARCH) == AARCH64

View File

@ -50,10 +50,11 @@
!include NetworkPkg/NetworkDefines.dsc.inc
!include MdePkg/MdeLibs.dsc.inc
# This comes before MdeLibs to ensure stack cookie configuration is chosen
!include ArmVirtPkg/ArmVirt.dsc.inc
!include MdePkg/MdeLibs.dsc.inc
[LibraryClasses.common]
ArmLib|ArmPkg/Library/ArmLib/ArmBaseLib.inf
ArmMmuLib|ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib.inf

View File

@ -47,10 +47,11 @@
!include NetworkPkg/NetworkDefines.dsc.inc
!include MdePkg/MdeLibs.dsc.inc
# This comes before MdeLibs to ensure stack cookie configuration is chosen
!include ArmVirtPkg/ArmVirt.dsc.inc
!include MdePkg/MdeLibs.dsc.inc
[LibraryClasses.common]
ArmLib|ArmPkg/Library/ArmLib/ArmBaseLib.inf
ArmMmuLib|ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib.inf

View File

@ -23,10 +23,11 @@
SKUID_IDENTIFIER = DEFAULT
FLASH_DEFINITION = ArmVirtPkg/ArmVirtXen.fdf
!include MdePkg/MdeLibs.dsc.inc
# This comes before MdeLibs to ensure stack cookie configuration is chosen
!include ArmVirtPkg/ArmVirt.dsc.inc
!include MdePkg/MdeLibs.dsc.inc
[LibraryClasses]
SerialPortLib|OvmfPkg/Library/XenConsoleSerialPortLib/XenConsoleSerialPortLib.inf
!if $(TARGET) != RELEASE