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 ArmSvcLib
ArmTransferListLib ArmTransferListLib
ArmFfaLib ArmFfaLib
StackCheckLib
[Guids] [Guids]
gMpInformationHobGuid gMpInformationHobGuid

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -44,6 +44,9 @@
DebugLib DebugLib
CpuExceptionHandlerLib CpuExceptionHandlerLib
DebugAgentLib 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] [Depex]
FALSE FALSE

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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