All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Graf <agraf@suse.de>
To: grub-devel@gnu.org
Cc: Leif Lindholm <leif.lindholm@linaro.org>,
	Peter Jones <pjones@redhat.com>, Jon Masters <jcm@redhat.com>,
	Ard Biesheuvel <ard.biesheuvel@linaro.org>
Subject: [PATCH v2 2/2] mkimage: arm64-efi: Align first section to page
Date: Sun, 23 Dec 2018 03:52:07 +0100	[thread overview]
Message-ID: <20181223025207.40755-3-agraf@suse.de> (raw)
In-Reply-To: <20181223025207.40755-1-agraf@suse.de>

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: Alexander Graf <agraf@suse.de>

---

v1 -> v2:

  - Mention only NX requirement in patch description
  - Use GRUB_EFI_PAGE_SIZE
---
 util/mkimage.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/util/mkimage.c b/util/mkimage.c
index 88b991764..de93c5a13 100644
--- a/util/mkimage.c
+++ b/util/mkimage.c
@@ -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>
@@ -623,7 +624,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,
     },
-- 
2.12.3



  parent reply	other threads:[~2018-12-23  2:52 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-23  2:52 [PATCH v2 0/2] arm64: Support HP Envy X2 Alexander Graf
2018-12-23  2:52 ` [PATCH v2 1/2] mkimage: Simplify header size logic Alexander Graf
2019-01-14 13:29   ` Daniel Kiper
2018-12-23  2:52 ` Alexander Graf [this message]
2019-01-14 13:37   ` [PATCH v2 2/2] mkimage: arm64-efi: Align first section to page Daniel Kiper
2019-01-14 13:41     ` Alexander Graf
2019-01-14 14:21       ` Leif Lindholm
2019-01-07  9:58 ` [PATCH v2 0/2] arm64: Support HP Envy X2 Leif Lindholm

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181223025207.40755-3-agraf@suse.de \
    --to=agraf@suse.de \
    --cc=ard.biesheuvel@linaro.org \
    --cc=grub-devel@gnu.org \
    --cc=jcm@redhat.com \
    --cc=leif.lindholm@linaro.org \
    --cc=pjones@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.