The SMM stack does not support loading Images to preferred addresses
in any way. Add checks that Image relocations have not been stripped.

Cc: Jian J Wang <jian.j.w...@intel.com>
Cc: Hao A Wu <hao.a...@intel.com>
Cc: Eric Dong <eric.d...@intel.com>
Cc: Ray Ni <ray...@intel.com>
Cc: Vitaly Cheptsov <vit9...@protonmail.com>
Signed-off-by: Marvin Häuser <mhaeu...@posteo.de>
---
 MdeModulePkg/Core/PiSmmCore/Dispatcher.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/MdeModulePkg/Core/PiSmmCore/Dispatcher.c 
b/MdeModulePkg/Core/PiSmmCore/Dispatcher.c
index 76ee9e0b89cc..69ea61e13434 100644
--- a/MdeModulePkg/Core/PiSmmCore/Dispatcher.c
+++ b/MdeModulePkg/Core/PiSmmCore/Dispatcher.c
@@ -447,6 +447,18 @@ SmmLoadImage (
     }

     return Status;

   }

+

+  //

+  // Stripped Image relocations are not supported for both fixed-address and

+  // dynamic loading.

+  //

+  if (ImageContext.RelocationsStripped) {

+    if (Buffer != NULL) {

+      gBS->FreePool (Buffer);

+    }

+    return EFI_UNSUPPORTED;

+  }

+

   //

   // if Loading module at Fixed Address feature is enabled, then  cut out a 
memory range started from TESG BASE

   // to hold the Smm driver code

-- 
2.31.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#79678): https://edk2.groups.io/g/devel/message/79678
Mute This Topic: https://groups.io/mt/85048616/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to