StandaloneMmPkg/Core: Limit FwVol encapsulation section recursion
MmCoreFfsFindMmDriver() is called recursively for encapsulation sections. Currently this recursion is not limited. Introduce a new PCD (fixed-at-build, or patchable-in-module), and make MmCoreFfsFindMmDriver() track the section nesting depth against that PCD. Cc: Laszlo Ersek <lersek@redhat.com> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Sami Mujawar <sami.mujawar@arm.com> Cc: Ray Ni <ray.ni@intel.com> Signed-off-by: Wei6 Xu <wei6.xu@intel.com> Reviewed-by: Ray Ni <ray.ni@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
This commit is contained in:
@@ -846,6 +846,32 @@ DumpMmramInfo (
|
||||
VOID
|
||||
);
|
||||
|
||||
/**
|
||||
Given the pointer to the Firmware Volume Header find the
|
||||
MM driver and return its PE32 image.
|
||||
|
||||
@param [in] FwVolHeader Pointer to memory mapped FV
|
||||
@param [in] Depth Nesting depth of encapsulation sections. Callers
|
||||
different from MmCoreFfsFindMmDriver() are
|
||||
responsible for passing in a zero Depth.
|
||||
|
||||
@retval EFI_SUCCESS Success.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
@retval EFI_NOT_FOUND Could not find section data.
|
||||
@retval EFI_OUT_OF_RESOURCES Out of resources.
|
||||
@retval EFI_VOLUME_CORRUPTED Firmware volume is corrupted.
|
||||
@retval EFI_UNSUPPORTED Operation not supported.
|
||||
@retval EFI_ABORTED Recursion aborted because Depth has been
|
||||
greater than or equal to
|
||||
PcdFwVolMmMaxEncapsulationDepth.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
MmCoreFfsFindMmDriver (
|
||||
IN EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader,
|
||||
IN UINT32 Depth
|
||||
);
|
||||
|
||||
extern UINTN mMmramRangeCount;
|
||||
extern EFI_MMRAM_DESCRIPTOR *mMmramRanges;
|
||||
extern EFI_SYSTEM_TABLE *mEfiSystemTable;
|
||||
|
Reference in New Issue
Block a user