summaryrefslogtreecommitdiffstats
path: root/StandaloneMmPkg/Core/StandaloneMmCore.h
diff options
context:
space:
mode:
authorWei6 Xu <wei6.xu@intel.com>2023-10-30 10:20:48 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2023-12-19 09:29:07 +0000
commitc0122840489194215a9209bb37f406f44c416953 (patch)
treeca6c3f69506d0e214804d1a2cdd04ac676617019 /StandaloneMmPkg/Core/StandaloneMmCore.h
parent74daeded0cabe87d26546f07f9a3911cb60ec0e1 (diff)
downloadedk2-c0122840489194215a9209bb37f406f44c416953.tar.gz
edk2-c0122840489194215a9209bb37f406f44c416953.tar.bz2
edk2-c0122840489194215a9209bb37f406f44c416953.zip
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>
Diffstat (limited to 'StandaloneMmPkg/Core/StandaloneMmCore.h')
-rw-r--r--StandaloneMmPkg/Core/StandaloneMmCore.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/StandaloneMmPkg/Core/StandaloneMmCore.h b/StandaloneMmPkg/Core/StandaloneMmCore.h
index 822d95358c..da23b8dc3c 100644
--- a/StandaloneMmPkg/Core/StandaloneMmCore.h
+++ b/StandaloneMmPkg/Core/StandaloneMmCore.h
@@ -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;