Skip to content
This repository has been archived by the owner on Feb 23, 2021. It is now read-only.

Commit

Permalink
grub-efi: take care of unload undershim
Browse files Browse the repository at this point in the history
Under shim, we use a custom buffer to put the relocated image, make
sure we free that memory when unloading.

Signed-off-by: Ricardo Neri <[email protected]>
Signed-off-by: Matt Fleming <[email protected]>
  • Loading branch information
ricardon authored and Matt Fleming committed Mar 27, 2015
1 parent 997c9c6 commit 464e8dd
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
From 70a30826d1cfb7a90c34760896dfd92b9c396f52 Mon Sep 17 00:00:00 2001
From: Ricardo Neri <[email protected]>
Date: Fri, 27 Mar 2015 08:31:27 -0700
Subject: [PATCH 7/7] efi: chainloader: take care of unload undershim

Under shim, we use a custom buffer to put the relocated image, make
sure we free that memory when unloading.

Signed-off-by: Ricardo Neri <[email protected]>
---
grub-core/loader/efi/chainloader.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c
index 1c9795c..d0ceb6e 100644
--- a/grub-core/loader/efi/chainloader.c
+++ b/grub-core/loader/efi/chainloader.c
@@ -586,8 +586,18 @@ grub_chainloader_unload (void)
grub_efi_boot_services_t *b;

b = grub_efi_system_table->boot_services;
- efi_call_1 (b->unload_image, image_handle);
- efi_call_2 (b->free_pages, address, pages);
+ if (!shim_used)
+ {
+ efi_call_1 (b->unload_image, image_handle);
+ efi_call_2 (b->free_pages, address, pages);
+ }
+ else
+ {
+ if (shim_buffer)
+ {
+ efi_call_2 (b->free_pages, shim_buffer, shim_pages);
+ }
+ }

grub_free (file_path);
grub_free (cmdline);
--
1.9.1

1 change: 1 addition & 0 deletions meta/recipes-bsp/grub/grub-efi_2.00.bb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ SRC_URI = "ftp://ftp.gnu.org/gnu/grub/grub-${PV}.tar.gz \
file://0004-efi-chainloader-port-shim-to-grub.patch \
file://0005-efi-chainloader-use-shim-to-load-and-verify-an-image.patch \
file://0006-efi-chainloader-boot-the-image-using-shim.patch \
file://0007-efi-chainloader-take-care-of-unload-undershim.patch \
"
SRC_URI[md5sum] = "e927540b6eda8b024fb0391eeaa4091c"
SRC_URI[sha256sum] = "65b39a0558f8c802209c574f4d02ca263a804e8a564bc6caf1cd0fd3b3cc11e3"
Expand Down

0 comments on commit 464e8dd

Please sign in to comment.