MdePkg: Move StackCheckLibStaticInit to StackCheckLib

This commit oves StackCheckLib from a NULL lib to an instance of
StackCheckLib. This requires every entry point to add a library
dependency on StackCheckLib. It also requires every SEC module
to have a dependency on StackCheckLib because there is no
standard SEC entry point.

It allows for greater flexibility for a platform to apply stack
cookies and simplifies DSC logic.

Continuous-integration-options: PatchCheck.ignore-multi-package

Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
This commit is contained in:
Oliver Smith-Denny 2025-01-29 11:01:04 -08:00 committed by mergify[bot]
parent db03bf1d9d
commit efbf5ed08c
34 changed files with 39 additions and 16 deletions

View File

@ -47,6 +47,7 @@
ArmSvcLib
ArmTransferListLib
ArmFfaLib
StackCheckLib
[Guids]
gMpInformationHobGuid

View File

@ -51,6 +51,7 @@
PrintLib
SerialPortLib
TimerLib
StackCheckLib
[Ppis]
gArmMpCoreInfoPpiGuid

View File

@ -47,6 +47,7 @@
DebugLib
PrintLib
SerialPortLib
StackCheckLib
[Ppis]
gEfiTemporaryRamSupportPpiGuid

View File

@ -54,6 +54,7 @@
PlatformPeiLib
MemoryInitPeiLib
CacheMaintenanceLib
StackCheckLib
[Guids]
gArmMpCoreInfoGuid

View File

@ -323,10 +323,7 @@
# USER_DEFINED components skip normal NULL lib linking, so we have to link this
# specially here for the libs that have stack guard enabled
##
EmulatorPkg/Win/Host/WinHost.inf {
<LibraryClasses>
NULL|MdePkg/Library/StackCheckLibNull/StackCheckLibNull.inf
}
EmulatorPkg/Win/Host/WinHost.inf
!else
##
# Emulator, OS POSIX application
@ -334,10 +331,7 @@
# USER_DEFINED components skip normal NULL lib linking, so we have to link this
# specially here for the libs that have stack guard enabled
##
EmulatorPkg/Unix/Host/Host.inf {
<LibraryClasses>
NULL|MdePkg/Library/StackCheckLibNull/StackCheckLibNull.inf
}
EmulatorPkg/Unix/Host/Host.inf
!endif
!endif

View File

@ -40,6 +40,7 @@
PeiServicesLib
PpiListLib
BaseMemoryLib
StackCheckLib
[Ppis]
gEfiTemporaryRamSupportPpiGuid

View File

@ -61,6 +61,7 @@
PpiListLib
PeiServicesLib
PeCoffGetEntryPointLib
StackCheckLib
[Ppis]
gEfiPeiStatusCodePpiGuid # PPI ALWAYS_PRODUCED

View File

@ -55,6 +55,7 @@
PpiListLib
PeiServicesLib
FrameBufferBltLib
StackCheckLib
[Ppis]
gEmuThunkPpiGuid

View File

@ -52,6 +52,7 @@
FspSwitchStackLib
FspCommonLib
FspSecPlatformLib
StackCheckLib
[Ppis]
gEfiTemporaryRamSupportPpiGuid ## PRODUCES

View File

@ -61,6 +61,7 @@
CpuLib
FspMultiPhaseLib
FspPlatformLib
StackCheckLib
[Pcd]
gIntelFsp2PkgTokenSpaceGuid.PcdTemporaryRamBase ## CONSUMES

View File

@ -53,6 +53,7 @@
FspCommonLib
FspSecPlatformLib
FspMultiPhaseLib
StackCheckLib
[Ppis]
gEfiTemporaryRamSupportPpiGuid ## PRODUCES

View File

@ -50,5 +50,6 @@
FspSwitchStackLib
FspCommonLib
FspSecPlatformLib
StackCheckLib

View File

@ -60,6 +60,7 @@
FspSecPlatformLib
CpuLib
FspPlatformLib
StackCheckLib
[Pcd]
gIntelFsp2PkgTokenSpaceGuid.PcdTemporaryRamBase ## CONSUMES

View File

@ -52,6 +52,7 @@
FspSwitchStackLib
FspCommonLib
FspSecPlatformLib
StackCheckLib
[Ppis]
gEfiTemporaryRamSupportPpiGuid ## PRODUCES

View File

@ -46,6 +46,7 @@
FspSwitchStackLib
FspCommonLib
FspSecPlatformLib
StackCheckLib
[Pcd]
gIntelFsp2PkgTokenSpaceGuid.PcdTemporaryRamBase ## CONSUMES

View File

@ -44,6 +44,9 @@
DebugLib
CpuExceptionHandlerLib
DebugAgentLib
# CapsuleX64 implements its own _ModuleEntryPoint() and does not link against the standard PEIM entrypoint. As a
# result, it must include StackCheckLib to resolve the compiler inserted references to stack cookie functionality
StackCheckLib
[Depex]
FALSE

View File

@ -33,4 +33,5 @@
[LibraryClasses]
BaseLib
DebugLib
StackCheckLib

View File

@ -31,4 +31,4 @@
[LibraryClasses]
BaseLib
DebugLib
StackCheckLib

View File

@ -31,4 +31,4 @@
[LibraryClasses]
DebugLib
StackCheckLib

View File

@ -7,11 +7,11 @@
[Defines]
INF_VERSION = 1.29
BASE_NAME = StackCheckLibStaticInit
FILE_GUID = 2b24dc50-e33d-4c9f-8b62-e826f06e483f
BASE_NAME = StackCheckLib
FILE_GUID = 1C4CA056-8FEA-413C-89D2-59A7E22847B3
MODULE_TYPE = BASE
VERSION_STRING = 1.0
LIBRARY_CLASS = NULL
LIBRARY_CLASS = StackCheckLib
[Sources]
StackCheckLibCommonMsvc.c | MSFT
@ -39,8 +39,6 @@
[LibraryClasses]
StackCheckFailureHookLib
BaseLib
DebugLib
[FixedPcd]
gEfiMdePkgTokenSpaceGuid.PcdStackCookieExceptionVector

View File

@ -30,3 +30,4 @@
[LibraryClasses]
BaseLib
DebugLib
StackCheckLib

View File

@ -36,6 +36,7 @@
BaseLib
DebugLib
MmServicesTableLib
StackCheckLib
[Protocols]
gEfiLoadedImageProtocolGuid ## SOMETIMES_CONSUMES

View File

@ -32,4 +32,5 @@
UefiBootServicesTableLib
DebugLib
BaseLib
StackCheckLib

View File

@ -36,6 +36,7 @@
UefiBootServicesTableLib
DebugLib
BaseLib
StackCheckLib
[Protocols]

View File

@ -142,7 +142,7 @@
MdePkg/Library/StackCheckFailureHookLibNull/StackCheckFailureHookLibNull.inf
MdePkg/Library/StackCheckLibNull/StackCheckLibNull.inf
MdePkg/Library/StackCheckLib/StackCheckLibStaticInit.inf
MdePkg/Library/StackCheckLib/StackCheckLib.inf
[Components.IA32, Components.X64, Components.ARM, Components.AARCH64]
#

View File

@ -50,6 +50,7 @@
PeilessStartupLib
PlatformInitLib
CcProbeLib
StackCheckLib
[Pcd]
gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPageTablesBase

View File

@ -31,6 +31,7 @@
DebugLib
QemuFwCfgSimpleParserLib
UefiBootServicesTableLib
StackCheckLib
[Protocols]
gEfiLoadedImageProtocolGuid ## SOMETIMES_CONSUMES

View File

@ -40,6 +40,7 @@
PeCoffGetEntryPointLib
PeCoffExtraActionLib
PeiServicesLib
StackCheckLib
[Ppis]
gEfiTemporaryRamSupportPpiGuid # PPI ALWAYS_PRODUCED

View File

@ -49,6 +49,7 @@
MemoryAllocationLib
HobLib
SerialPortLib
StackCheckLib
[Ppis]
gEfiTemporaryRamSupportPpiGuid # PPI ALWAYS_PRODUCED

View File

@ -56,6 +56,7 @@
CpuExceptionHandlerLib
CcProbeLib
CpuPageTableLib
StackCheckLib
[Ppis]
gEfiTemporaryRamSupportPpiGuid # PPI ALWAYS_PRODUCED

View File

@ -56,6 +56,7 @@
PeiServicesTablePointerLib
HobLib
CpuPageTableLib
StackCheckLib
[Ppis]
## SOMETIMES_CONSUMES

View File

@ -53,6 +53,7 @@
PeiServicesTablePointerLib
HobLib
CpuPageTableLib
StackCheckLib
[Ppis]
## SOMETIMES_CONSUMES

View File

@ -55,6 +55,7 @@
PeCoffLib
PlatformSupportLib
CpuLib
StackCheckLib
[Guids]
gEfiMemoryTypeInformationGuid

View File

@ -47,6 +47,7 @@
PeCoffLib
CpuLib
HobPrintLib
StackCheckLib
[Guids]
gEfiMemoryTypeInformationGuid