Thread (13 messages) read the whole thread 13 messages, 4 authors, 2015-09-23
STALE3963d

[PATCH v2] arm64/efi: don't pad between EFI_MEMORY_RUNTIME regions

From: Ard Biesheuvel <hidden>
Date: 2015-09-09 07:28:05

(snip linux-efi + matt)

On 9 September 2015 at 09:06, Ard Biesheuvel [off-list ref] wrote:
The new Properties Table feature introduced in UEFIv2.5 may split
memory regions that cover PE/COFF memory images into separate code
and data regions. Since these regions only differ in the type (runtime
code vs runtime data) and the permission bits, but not in the memory
type attributes (UC/WC/WT/WB), the spec does not require them to be
aligned to 64 KB.

As the relative offset of PE/COFF .text and .data segments cannot be
changed on the fly, this means that we can no longer pad out those
regions to be mappable using 64 KB pages.
Unfortunately, there is no annotation in the UEFI memory map that
identifies data regions that were split off from a code region, so we
must apply this logic to all adjacent runtime regions whose attributes
only differ in the permission bits.

So instead of rounding each memory region to 64 KB alignment at both
ends, only round down regions that are not directly preceded by another
runtime region with the same type attributes. Since the UEFI spec does
not mandate that the memory map be sorted, this means we also need to
sort it first.

Signed-off-by: Ard Biesheuvel <redacted>
---

As discussed off list, this is the arm64 side of what we should backport
to stable to prevent firmware that adheres to the current version of the
UEFI v2.5 spec with the memprotect feature enabled from blowing up the system
upon the first OS call into the runtime services.
The x86 counterpart is under discussion here:
http://thread.gmane.org/gmane.linux.kernel.efi/6219
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help