This is a followup to the patch I sen yesterday:
http://article.gmane.org/gmane.comp.bios.tianocore.devel/16647

I should know better than to propose changes to MdePkg, but in this
case, I think the issues around the MemoryProtectionAttribute are
severe enough to warrant drastic measures.

Patches #1 and #2 are cleanup patches, they remove dead code that handles
relocations that are already handled by the callers of the respective
functions.

Patch #3 fixes a bug in BasePeCoffLib where it fails to take into account
that applying a EFI_IMAGE_REL_BASED_LOW relocation may result in a carry
that needs to be taken into account when handling the corresponding
EFI_IMAGE_REL_BASED_HIGH relocation.

Patch #4 works around a bug in BasePeCoffLib where the runtime re-relocation
may reapply EFI_IMAGE_REL_BASED_LOW or EFI_IMAGE_REL_BASED_HIGH relocations
even if the target location has been updated programmatically after the
image was loaded.

Patch #5 replaces the 'Adjust' argument of PeCoffLoaderRelocateImageForRuntime
with a ConvertPointer() callback function pointer so that the runtime relocation
can handle disjoint PE/COFF images in virtual memory.

Patch #6 updates RuntimeDxe to use the new PeCoffLoaderRelocateImageForRuntime
prototype.

Unfortunately, this series is not bisectable between #5 and #6. Working around
that is non-trivial and probably not worth the hassle.

Ard Biesheuvel (6):
  MdePkg/BasePeCoffLib: remove redundant PeCoffLoaderEx.c for AARCH64
  MdePkg/BasePeCoffLib: remove redundant handling of
    EFI_IMAGE_REL_BASED_DIR64
  MdePkg/BasePeCoffLib: account for carry in high/low relocation pairs
  MdePkg/BasePeCoffLib: fix handling of high/low relocation pairs
  MdePkg/BasePeCoffLib: relocate for runtime using ConvertPointer
    callback
  MdeModulePkg/RuntimeDxe: update to new RelocateImageForRuntime()
    prototype

 MdeModulePkg/Core/RuntimeDxe/Runtime.c                |  12 +-
 MdePkg/Include/Library/PeCoffLib.h                    |  28 ++++-
 MdePkg/Library/BasePeCoffLib/AArch64/PeCoffLoaderEx.c | 127 
--------------------
 MdePkg/Library/BasePeCoffLib/Arm/PeCoffLoaderEx.c     |  19 +--
 MdePkg/Library/BasePeCoffLib/BasePeCoff.c             |  86 +++++++++----
 MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf        |   5 +-
 MdePkg/Library/BasePeCoffLib/BasePeCoffLibInternals.h |  16 +--
 MdePkg/Library/BasePeCoffLib/Ipf/PeCoffLoaderEx.c     |  42 +++----
 MdePkg/Library/BasePeCoffLib/PeCoffLoaderEx.c         |  20 +--
 9 files changed, 138 insertions(+), 217 deletions(-)
 delete mode 100644 MdePkg/Library/BasePeCoffLib/AArch64/PeCoffLoaderEx.c

-- 
1.9.1


------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to