Files
system76-edk2/MdeModulePkg/Core/PiSmmCore/PiSmmCore.inf
Jian J Wang 2930ef9809 MdeModulePkg/PiSmmCore: Implement heap guard feature for SMM mode
This feature makes use of paging mechanism to add a hidden (not present)
page just before and after the allocated memory block. If the code tries
to access memory outside of the allocated part, page fault exception will
be triggered.

This feature is controlled by three PCDs:

    gEfiMdeModulePkgTokenSpaceGuid.PcdHeapGuardPropertyMask
    gEfiMdeModulePkgTokenSpaceGuid.PcdHeapGuardPoolType
    gEfiMdeModulePkgTokenSpaceGuid.PcdHeapGuardPageType

BIT2 and BIT3 of PcdHeapGuardPropertyMask can be used to enable or disable
memory guard for SMM page and pool respectively. PcdHeapGuardPoolType and/or
PcdHeapGuardPageType are used to enable or disable guard for specific type
of memory. For example, we can turn on guard only for EfiRuntimeServicesCode
and EfiRuntimeServicesData by setting the PCD with value 0x60.

Pool memory is not ususally integer multiple of one page, and is more likely
less than a page. There's no way to monitor the overflow at both top and
bottom of pool memory. BIT7 of PcdHeapGuardPropertyMask is used to control
how to position the head of pool memory so that it's easier to catch memory
overflow in memory growing direction or in decreasing direction.

Cc: Eric Dong <eric.dong@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Suggested-by: Ayellet Wolman <ayellet.wolman@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jian J Wang <jian.j.wang@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Regression-tested-by: Laszlo Ersek <lersek@redhat.com>
2017-11-17 11:03:19 +08:00

128 lines
5.2 KiB
INI

## @file
# This module provide an SMM CIS compliant implementation of SMM Core.
#
# Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
#
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
# http://opensource.org/licenses/bsd-license.php
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#
##
[Defines]
INF_VERSION = 0x00010005
BASE_NAME = PiSmmCore
MODULE_UNI_FILE = PiSmmCore.uni
FILE_GUID = E94F54CD-81EB-47ed-AEC3-856F5DC157A9
MODULE_TYPE = SMM_CORE
VERSION_STRING = 1.0
PI_SPECIFICATION_VERSION = 0x0001000A
ENTRY_POINT = SmmMain
# VALID_ARCHITECTURES = IA32 X64
[Sources]
PiSmmCore.c
PiSmmCore.h
PiSmmCorePrivateData.h
Page.c
Pool.c
Handle.c
Locate.c
Notify.c
Dependency.c
Dispatcher.c
Smi.c
InstallConfigurationTable.c
SmramProfileRecord.c
MemoryAttributesTable.c
SmiHandlerProfile.c
HeapGuard.c
[Packages]
MdePkg/MdePkg.dec
MdeModulePkg/MdeModulePkg.dec
[LibraryClasses]
UefiDriverEntryPoint
BaseLib
BaseMemoryLib
PeCoffLib
PeCoffGetEntryPointLib
CacheMaintenanceLib
DebugLib
ReportStatusCodeLib
DevicePathLib
UefiLib
UefiBootServicesTableLib
MemoryAllocationLib
PcdLib
SmmCorePlatformHookLib
PerformanceLib
TimerLib
HobLib
SmmMemLib
DxeServicesLib
[Protocols]
gEfiDxeSmmReadyToLockProtocolGuid ## UNDEFINED # SmiHandlerRegister
gEfiSmmReadyToLockProtocolGuid ## PRODUCES
gEfiSmmCpuIo2ProtocolGuid ## CONSUMES
gEfiFirmwareVolume2ProtocolGuid ## CONSUMES
gEfiSmmEndOfDxeProtocolGuid ## PRODUCES
gEfiSecurityArchProtocolGuid ## SOMETIMES_CONSUMES
gEfiSecurity2ArchProtocolGuid ## SOMETIMES_CONSUMES
gEfiLoadedImageProtocolGuid ## PRODUCES
gEfiDevicePathProtocolGuid ## CONSUMES
gEdkiiSmmExitBootServicesProtocolGuid ## SOMETIMES_PRODUCES
gEdkiiSmmLegacyBootProtocolGuid ## SOMETIMES_PRODUCES
gEdkiiSmmReadyToBootProtocolGuid ## PRODUCES
gEdkiiSmmEndOfS3ResumeProtocolGuid ## SOMETIMES_PRODUCES
gEfiSmmSwDispatch2ProtocolGuid ## SOMETIMES_CONSUMES
gEfiSmmSxDispatch2ProtocolGuid ## SOMETIMES_CONSUMES
gEfiSmmPowerButtonDispatch2ProtocolGuid ## SOMETIMES_CONSUMES
gEfiSmmStandbyButtonDispatch2ProtocolGuid ## SOMETIMES_CONSUMES
gEfiSmmPeriodicTimerDispatch2ProtocolGuid ## SOMETIMES_CONSUMES
gEfiSmmGpiDispatch2ProtocolGuid ## SOMETIMES_CONSUMES
gEfiSmmIoTrapDispatch2ProtocolGuid ## SOMETIMES_CONSUMES
gEfiSmmUsbDispatch2ProtocolGuid ## SOMETIMES_CONSUMES
gEfiSmmCpuProtocolGuid ## SOMETIMES_CONSUMES
gEdkiiSmmMemoryAttributeProtocolGuid ## CONSUMES
[Pcd]
gEfiMdeModulePkgTokenSpaceGuid.PcdLoadFixAddressSmmCodePageNumber ## SOMETIMES_CONSUMES
gEfiMdeModulePkgTokenSpaceGuid.PcdLoadModuleAtFixAddressEnable ## CONSUMES
gEfiMdeModulePkgTokenSpaceGuid.PcdMemoryProfileMemoryType ## CONSUMES
gEfiMdeModulePkgTokenSpaceGuid.PcdMemoryProfilePropertyMask ## CONSUMES
gEfiMdeModulePkgTokenSpaceGuid.PcdMemoryProfileDriverPath ## CONSUMES
gEfiMdeModulePkgTokenSpaceGuid.PcdSmiHandlerProfilePropertyMask ## CONSUMES
gEfiMdeModulePkgTokenSpaceGuid.PcdHeapGuardPageType ## CONSUMES
gEfiMdeModulePkgTokenSpaceGuid.PcdHeapGuardPoolType ## CONSUMES
gEfiMdeModulePkgTokenSpaceGuid.PcdHeapGuardPropertyMask ## CONSUMES
[Guids]
gAprioriGuid ## SOMETIMES_CONSUMES ## File
gEfiEventDxeDispatchGuid ## PRODUCES ## GUID # SmiHandlerRegister
gEfiEventLegacyBootGuid ## PRODUCES ## GUID # SmiHandlerRegister
gEfiEventExitBootServicesGuid ## PRODUCES ## GUID # SmiHandlerRegister
gEfiEventReadyToBootGuid ## PRODUCES ## GUID # SmiHandlerRegister
gEfiEndOfDxeEventGroupGuid ## PRODUCES ## GUID # SmiHandlerRegister
## SOMETIMES_CONSUMES ## GUID # Locate protocol
## SOMETIMES_PRODUCES ## GUID # SmiHandlerRegister
gEdkiiMemoryProfileGuid
## SOMETIMES_PRODUCES ## GUID # Install protocol
gEdkiiSmmMemoryProfileGuid
gEdkiiPiSmmMemoryAttributesTableGuid ## PRODUCES ## SystemTable
## SOMETIMES_CONSUMES ## SystemTable
gLoadFixedAddressConfigurationTableGuid
## SOMETIMES_PRODUCES ## GUID # Install protocol
## SOMETIMES_PRODUCES ## GUID # SmiHandlerRegister
gSmiHandlerProfileGuid
[UserExtensions.TianoCore."ExtraFiles"]
PiSmmCoreExtra.uni