summarylogtreecommitdiffstats
path: root/0006-efi-properly-terminate-filepath-with-NULL-in-chainloader.patch
diff options
context:
space:
mode:
authoreworm2017-01-09 11:35:57 +0000
committersvntogit2017-01-09 11:35:57 +0000
commit863e992481b2eb8fcef5c2815cbe398c60e8f6c2 (patch)
tree2e72ee2f0d287689220ddae2210628ae3d6a0069 /0006-efi-properly-terminate-filepath-with-NULL-in-chainloader.patch
parenta9407fe2a621cc11d22b692407f0ede76b466081 (diff)
downloadaur-863e992481b2eb8fcef5c2815cbe398c60e8f6c2.tar.gz
upgpkg: grub 1:2.02.beta3-5
efi: properly terminate filepath with NULL in chainloader (FS#52412) git-svn-id: file:///srv/repos/svn-packages/svn@285562 eb2447ed-0c53-47e4-bac8-5bc4a241df78
Diffstat (limited to '0006-efi-properly-terminate-filepath-with-NULL-in-chainloader.patch')
-rw-r--r--0006-efi-properly-terminate-filepath-with-NULL-in-chainloader.patch44
1 files changed, 44 insertions, 0 deletions
diff --git a/0006-efi-properly-terminate-filepath-with-NULL-in-chainloader.patch b/0006-efi-properly-terminate-filepath-with-NULL-in-chainloader.patch
new file mode 100644
index 000000000000..b7961072436c
--- /dev/null
+++ b/0006-efi-properly-terminate-filepath-with-NULL-in-chainloader.patch
@@ -0,0 +1,44 @@
+From ce95549cc54b5d6f494608a7c390dba3aab4fba7 Mon Sep 17 00:00:00 2001
+From: Andrei Borzenkov <arvidjaar@gmail.com>
+Date: Thu, 15 Dec 2016 16:07:00 +0300
+Subject: efi: properly terminate filepath with NULL in chainloader
+
+EFI File Path Media Device Path is defined as NULL terminated string;
+but chainloader built file paths without final NULL. This caused error
+with Secure Boot and Linux Foundation PreLoader on Acer with InsydeH20 BIOS.
+Apparently firmware failed verification with EFI_INVALID_PARAMETER which is
+considered fatal error by PreLoader.
+
+Reported and tested by Giovanni Santini <itachi.sama.amaterasu@gmail.com>
+---
+ grub-core/loader/efi/chainloader.c | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c
+index 522a716..adc8563 100644
+--- a/grub-core/loader/efi/chainloader.c
++++ b/grub-core/loader/efi/chainloader.c
+@@ -122,6 +122,8 @@ copy_file_path (grub_efi_file_path_device_path_t *fp,
+ if (*p == '/')
+ *p = '\\';
+
++ /* File Path is NULL terminated */
++ fp->path_name[size++] = '\0';
+ fp->header.length = size * sizeof (grub_efi_char16_t) + sizeof (*fp);
+ }
+
+@@ -156,8 +158,10 @@ make_file_path (grub_efi_device_path_t *dp, const char *filename)
+ d = GRUB_EFI_NEXT_DEVICE_PATH (d);
+ }
+
++ /* File Path is NULL terminated. Allocate space for 2 extra characters */
++ /* FIXME why we split path in two components? */
+ file_path = grub_malloc (size
+- + ((grub_strlen (dir_start) + 1)
++ + ((grub_strlen (dir_start) + 2)
+ * GRUB_MAX_UTF16_PER_UTF8
+ * sizeof (grub_efi_char16_t))
+ + sizeof (grub_efi_file_path_device_path_t) * 2);
+--
+cgit v1.0
+