summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg/Library
diff options
context:
space:
mode:
authorArd Biesheuvel <ard.biesheuvel@linaro.org>2019-04-16 13:21:34 -0700
committerArd Biesheuvel <ard.biesheuvel@linaro.org>2019-04-17 18:02:37 -0700
commitd43056888790f987169c54a5c2895758b85dff72 (patch)
tree14dcca7e957fec28035f61dc8c64de8be5e49104 /MdeModulePkg/Library
parentcfb29d2bda57baa344bded40cf12af81b13e8a40 (diff)
downloadedk2-d43056888790f987169c54a5c2895758b85dff72.tar.gz
edk2-d43056888790f987169c54a5c2895758b85dff72.tar.bz2
edk2-d43056888790f987169c54a5c2895758b85dff72.zip
MdeModulePkg/UefiBootManagerLib: fix crash on uninitialized ExitData
As reported by Gary, the recent LoadImage/StartImage changes to accommodate dispatching PE/COFF images built for foreign architectures may result in a crash when loading an IA32 option ROM into a X64 VM running OVMF: Loading driver at 0x0007E537000 EntryPoint=0x0007E53C06D 8086100e.efi InstallProtocolInterface: BC62157E-3E33-4FEC-9920-2D3B36D750DF 7F003B98 ProtectUefiImageCommon - 0x7F002BC0 - 0x000000007E537000 - 0x000000000009F900 Image type IA32 can't be started on X64 UEFI system. ASSERT MdeModulePkg/Core/Dxe/Mem/Pool.c(698): Head->Signature == ((('p') | ('h' << 8)) | ((('d') | ('0' << 8)) << 16)) || Head->Signature == ((('p') | ('h' << 8)) | ((('d') | ('1' << 8)) << 16)) This turns out to be caused by the deferred image loading code in BDS, which ends up trying to free an uninitialized 'ExitData' pointer. Given that ExitData is never actually used, let's just get rid of it entirely. While we're at it, drop the pointless assignment of Status as well. Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Tested-by: Gary Lin <glin@suse.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Hao Wu <hao.a.wu@intel.com>
Diffstat (limited to 'MdeModulePkg/Library')
-rw-r--r--MdeModulePkg/Library/UefiBootManagerLib/BmMisc.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmMisc.c b/MdeModulePkg/Library/UefiBootManagerLib/BmMisc.c
index fc8775dfa4..6b8fb4d924 100644
--- a/MdeModulePkg/Library/UefiBootManagerLib/BmMisc.c
+++ b/MdeModulePkg/Library/UefiBootManagerLib/BmMisc.c
@@ -439,8 +439,6 @@ EfiBootManagerDispatchDeferredImages (
UINTN ImageSize;
BOOLEAN BootOption;
EFI_HANDLE ImageHandle;
- UINTN ExitDataSize;
- CHAR16 *ExitData;
UINTN ImageCount;
UINTN LoadCount;
@@ -502,10 +500,7 @@ EfiBootManagerDispatchDeferredImages (
// a 5 Minute period
//
gBS->SetWatchdogTimer (5 * 60, 0x0000, 0x00, NULL);
- Status = gBS->StartImage (ImageHandle, &ExitDataSize, &ExitData);
- if (ExitData != NULL) {
- FreePool (ExitData);
- }
+ gBS->StartImage (ImageHandle, NULL, NULL);
//
// Clear the Watchdog Timer after the image returns.