On Thu, 09 Jul, at 05:58:36PM, Ard Biesheuvel wrote:
> 
> Sure. In the meantime, I have cooked up a slightly more elaborate
> series that also fixes the
> EFI_IMAGE_REL_BASED_LOW/EFI_IMAGE_REL_BASED_HIGH issues (even though
> they don't seem to be used widely) and does some cleanups. This is
> unlikely to be adopted as-is, since there is still an unresolved issue
> with inter-region relative relocations.
> 
> Tree is here
> https://git.linaro.org/people/ard.biesheuvel/uefi-next.git/shortlog/refs/heads/pecoff-runtime-relocation
 
Thanks Ard! This is really, super helpful.

> When running this, you should notice regions in the memory map with
> either the RO (0x20000) or XP (0x4000) bit set in the kernel log.
> For instance,
> 
> """
> [    0.000000] efi: mem38: type=6, attr=0x800000000000400f, 
> range=[0x0000000007e9a000-0x0000000007e9f000) (0MB)
> [    0.000000] efi: mem39: type=5, attr=0x800000000002000f, 
> range=[0x0000000007e9f000-0x0000000007ea4000) (0MB)
> [    0.000000] efi: mem40: type=6, attr=0x800000000000400f, 
> range=[0x0000000007ea4000-0x0000000007eaa000) (0MB)
> [    0.000000] efi: mem41: type=5, attr=0x800000000002000f, 
> range=[0x0000000007eaa000-0x0000000007eae000) (0MB)
> """

Yep, I see this and it looks good.

> And no crash .... (hopefully)
 
With a standard kernel, I don't see a crash. However, with the minimal
top 2 patches in,

  https://git.kernel.org/cgit/linux/kernel/git/mfleming/efi.git/log/?h=memmap

I see a page fault while executing SetVirtualAddressMap(). It appears to
be caused by the firmware performing relocation fixups on an address
that's mapped as EfiRuntimeServicesCode, which is in the EFI memory map
as EFI_MEMORY_RO.

I suspect you don't see this issue on aarch64 because you call
SetVirtualAddressMap() so early in boot.

I'll try and find some time to dig into this issue this coming week, but
if anyone wants to beat me to it, feel free ;-)

The first question is: Why is the image's reloc section in a
EfiRuntimeServiceCode region?

-- 
Matt Fleming, Intel Open Source Technology Center

------------------------------------------------------------------------------
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