• Ard Biesheuvel's avatar
    efi/libstub/arm64: Use 1:1 mapping of RT services if property table exists · b92165d2
    Ard Biesheuvel authored
    The UEFI spec defines (and deprecates) a misguided and shortlived
    memory protection feature that is based on splitting memory regions
    covering PE/COFF executables into separate code and data regions,
    without annotating them as belonging to the same executable image.
    When the OS assigns the virtual addresses of these regions, it may
    move them around arbitrarily, without taking into account that the
    PE/COFF code sections may contain relative references into the data
    sections, which means the relative placement of these segments has
    to be preserved or the executable image will be corrupted.
    
    The original workaround on arm64 was to ensure that adjacent regions
    of the same type were mapped adjacently in the virtual mapping, but
    this requires sorting of the memory map, which we would prefer to
    avoid.
    
    Considering that the native physical mapping of the PE/COFF images
    does not suffer from this issue, let's preserve it at runtime, and
    install it as the virtual mapping as well.
    Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
    b92165d2
arm-stub.c 10.6 KB