]> git.proxmox.com Git - mirror_edk2.git/commit
MdeModulePkg/DxeCore: defer PE/COFF emulator registration to StartImage
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Wed, 26 Feb 2020 19:43:42 +0000 (20:43 +0100)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Wed, 4 Mar 2020 09:26:45 +0000 (09:26 +0000)
commitd8dd54f071cfd60a2dcf5426764a89cd91213420
tree2f17bac263d70f07ee01c7c4a586a0fbbf42c133
parentec41733cfd105b8ec811c38b32b1944662fd526a
MdeModulePkg/DxeCore: defer PE/COFF emulator registration to StartImage

EDK2's implementation of the LoadImage() boot service permits non-native
binaries to be loaded (i.e., X64 images on IA32 firmware), but any
attempts to start such an image using StartImage() will return
EFI_UNSUPPORTED.

The integration of the PE/COFF emulator protocol into the DXE core
deviates slightly from this paradigm, given that its IsImageSupported
hook as well as its RegisterImage hook are invoked from LoadImage,
and by the time StartImage is called, no opportunity is given to the
provider of the PE/COFF emulator protocol to prevent an image from
being started if it only supports loading it.

To address this disparity, let's move the invocation of RegisterImage()
to the implementation of the StartImage() boot service, allowing the
emulator to permit LoadImage() but reject StartImage() on images that
turn out not to meet the requirements of the emulator as it is being
started.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2564
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Acked-by: Liming Gao <liming.gao@intel.com>
MdeModulePkg/Core/Dxe/Image/Image.c