[edk2-devel] [PATCH 5/5] MdeModulePkg/PiSmmCore: Disallow stripped Image relocations
Marvin Häuser
mhaeuser at posteo.de
Sat Aug 21 19:55:53 UTC 2021
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.wang at intel.com>
Cc: Hao A Wu <hao.a.wu at intel.com>
Cc: Eric Dong <eric.dong at intel.com>
Cc: Ray Ni <ray.ni at intel.com>
Cc: Vitaly Cheptsov <vit9696 at protonmail.com>
Signed-off-by: Marvin Häuser <mhaeuser at 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/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-
More information about the edk2-devel-archive
mailing list