bbc6a89
From f826330683675f0deb55b58fd229afd7d65fb053 Mon Sep 17 00:00:00 2001
bbc6a89
From: Leif Lindholm <leif.lindholm@linaro.org>
bbc6a89
Date: Thu, 3 Aug 2017 11:04:32 +0100
31cddd6
Subject: [PATCH] efi: change heap allocation type to GRUB_EFI_LOADER_CODE
bbc6a89
bbc6a89
With upcoming changes to EDK2, allocations of type EFI_LOADER_DATA may
bbc6a89
not return regions with execute ability. Since modules are loaded onto
bbc6a89
the heap, change the heap allocation type to GRUB_EFI_LOADER_CODE in
bbc6a89
order to permit execution on systems with this feature enabled.
bbc6a89
bbc6a89
Closes: 50420
bbc6a89
bbc6a89
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
bbc6a89
---
bbc6a89
 grub-core/kern/efi/mm.c | 4 +++-
bbc6a89
 1 file changed, 3 insertions(+), 1 deletion(-)
bbc6a89
bbc6a89
diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c
ec4acbb
index b97b05fe825..ac2a4c556b8 100644
bbc6a89
--- a/grub-core/kern/efi/mm.c
bbc6a89
+++ b/grub-core/kern/efi/mm.c
bbc6a89
@@ -403,7 +403,9 @@ add_memory_regions (grub_efi_memory_descriptor_t *memory_map,
bbc6a89
 	  pages = required_pages;
bbc6a89
 	}
bbc6a89
 
bbc6a89
-      addr = grub_efi_allocate_fixed (start, pages);
bbc6a89
+      addr = grub_efi_allocate_pages_real (start, pages,
bbc6a89
+					   GRUB_EFI_ALLOCATE_ADDRESS,
bbc6a89
+					   GRUB_EFI_LOADER_CODE);      
bbc6a89
       if (! addr)
bbc6a89
 	grub_fatal ("cannot allocate conventional memory %p with %u pages",
bbc6a89
 		    (void *) ((grub_addr_t) start),