[arch-commits] Commit in grub/trunk (2 files)

Christian Hesse eworm at archlinux.org
Mon Jan 9 11:35:58 UTC 2017


    Date: Monday, January 9, 2017 @ 11:35:57
  Author: eworm
Revision: 285562

upgpkg: grub 1:2.02.beta3-5

efi: properly terminate filepath with NULL in chainloader (FS#52412)

Added:
  grub/trunk/0006-efi-properly-terminate-filepath-with-NULL-in-chainloader.patch
Modified:
  grub/trunk/PKGBUILD

---------------------------------------------------------------------+
 0006-efi-properly-terminate-filepath-with-NULL-in-chainloader.patch |   44 ++++++++++
 PKGBUILD                                                            |    8 +
 2 files changed, 51 insertions(+), 1 deletion(-)

Added: 0006-efi-properly-terminate-filepath-with-NULL-in-chainloader.patch
===================================================================
--- 0006-efi-properly-terminate-filepath-with-NULL-in-chainloader.patch	                        (rev 0)
+++ 0006-efi-properly-terminate-filepath-with-NULL-in-chainloader.patch	2017-01-09 11:35:57 UTC (rev 285562)
@@ -0,0 +1,44 @@
+From ce95549cc54b5d6f494608a7c390dba3aab4fba7 Mon Sep 17 00:00:00 2001
+From: Andrei Borzenkov <arvidjaar at 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 at 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
+

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2017-01-09 09:56:20 UTC (rev 285561)
+++ PKGBUILD	2017-01-09 11:35:57 UTC (rev 285562)
@@ -23,7 +23,7 @@
 pkgname="grub"
 pkgdesc="GNU GRand Unified Bootloader (2)"
 pkgver=2.02.beta3
-pkgrel=4
+pkgrel=5
 epoch=1
 url="https://www.gnu.org/software/grub/"
 arch=('x86_64' 'i686')
@@ -64,6 +64,7 @@
         '0003-10_linux-detect-archlinux-initramfs.patch'
         '0004-add-GRUB_COLOR_variables.patch'
         '0005-10_linux-fix-grouping-of-tests.patch'
+        '0006-efi-properly-terminate-filepath-with-NULL-in-chainloader.patch'
         'grub.default'
         'grub.cfg')
 
@@ -76,6 +77,7 @@
             'b41e4438319136b5e74e0abdfcb64ae115393e4e15207490272c425f54026dd3'
             'a5198267ceb04dceb6d2ea7800281a42b3f91fd02da55d2cc9ea20d47273ca29'
             'bf712de689a944ac23a0303bbcc223eedf8d4fcb5c94bdc071c71c2444158a7f'
+            'd99f47642d325398873346e25ecb646c387e358e25b05128fa333cc7721a7388'
             'df764fbd876947dea973017f95371e53833bf878458140b09f0b70d900235676'
             'c5e4f3836130c6885e9273c21f057263eba53f4b7c0e2f111f6e5f2e487a47ad')
 
@@ -109,6 +111,10 @@
 	patch -Np1 -i "${srcdir}/0005-10_linux-fix-grouping-of-tests.patch"
 	echo
 
+	msg "Patch to properly terminate filepath with NULL in chainloader"
+	patch -Np1 -i "${srcdir}/0006-efi-properly-terminate-filepath-with-NULL-in-chainloader.patch"
+	echo
+
 	msg "Fix DejaVuSans.ttf location so that grub-mkfont can create *.pf2 files for starfield theme"
 	sed 's|/usr/share/fonts/dejavu|/usr/share/fonts/dejavu /usr/share/fonts/TTF|g' -i "${srcdir}/grub-${_pkgver}/configure.ac"
 



More information about the arch-commits mailing list