Commit 73b07367 authored by Alexander Graf's avatar Alexander Graf Committed by Colin Watson

mkimage: arm64-efi: Align first section to page

In order to enforce NX semantics on non-code pages, UEFI firmware
may require that all code is EFI_PAGE_SIZE (4k) aligned. A similar
change has recently been applied to edk2 to accomodate for the same
fact:

  https://lists.01.org/pipermail/edk2-devel/2018-December/033708.html

This patch adapts grub to also implement the same alignment guarantees
and thus ensures we can boot even when strict permission checks are in
place.
Signed-off-by: 's avatarAlexander Graf <agraf@suse.de>
Reviewed-by: 's avatarLeif Lindholm <leif.lindholm@linaro.org>
Tested-by: 's avatarLeif Lindholm <leif.lindholm@linaro.org>

Origin: other, https://lists.gnu.org/archive/html/grub-devel/2018-12/msg00055.html
Bug-Debian: https://bugs.debian.org/919012
Last-Update: 2019-01-12

Patch-Name: mkimage-arm64-efi-align-first-section-to-page.patch
parent f2b469a2
......@@ -39,6 +39,7 @@
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <grub/efi/memory.h>
#include <grub/efi/pe32.h>
#include <grub/uboot/image.h>
#include <grub/arm/reloc.h>
......@@ -584,7 +585,7 @@ static const struct grub_install_image_target_desc image_targets[] =
.decompressor_uncompressed_size = TARGET_NO_FIELD,
.decompressor_uncompressed_addr = TARGET_NO_FIELD,
.section_align = GRUB_PE32_SECTION_ALIGNMENT,
.vaddr_offset = EFI64_HEADER_SIZE,
.vaddr_offset = GRUB_EFI_PAGE_SIZE,
.pe_target = GRUB_PE32_MACHINE_ARM64,
.elf_target = EM_AARCH64,
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment