grub: update to 2.04.

Close #9023
Close #4436
This commit is contained in:
Juan RP 2019-07-21 09:31:13 +02:00
parent eeab768239
commit 6b04cf5353
No known key found for this signature in database
GPG Key ID: AF19F6CB482F9368
6 changed files with 4 additions and 208 deletions

View File

@ -1,72 +0,0 @@
From 563b1da6e6ae7af46cc8354cadb5dab416989f0a Mon Sep 17 00:00:00 2001
From: Michael Chang <mchang@suse.com>
Date: Mon, 26 Mar 2018 16:52:34 +0800
Subject: Fix packed-not-aligned error on GCC 8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
When building with GCC 8, there are several errors regarding packed-not-aligned.
./include/grub/gpt_partition.h:79:1: error: alignment 1 of struct grub_gpt_partentry is less than 8 [-Werror=packed-not-aligned]
This patch fixes the build error by cleaning up the ambiguity of placing
aligned structure in a packed one. In "struct grub_btrfs_time" and "struct
grub_gpt_part_type", the aligned attribute seems to be superfluous, and also
has to be packed, to ensure the structure is bit-to-bit mapped to the format
laid on disk. I think we could blame to copy and paste error here for the
mistake. In "struct efi_variable", we have to use grub_efi_packed_guid_t, as
the name suggests. :)
Signed-off-by: Michael Chang <mchang@suse.com>
Tested-by: Michael Chang <mchang@suse.com>
Tested-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
---
grub-core/fs/btrfs.c | 2 +-
include/grub/efiemu/runtime.h | 2 +-
include/grub/gpt_partition.h | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c
index 4849c1ceb..be195448d 100644
--- grub-core/fs/btrfs.c
+++ grub-core/fs/btrfs.c
@@ -175,7 +175,7 @@ struct grub_btrfs_time
{
grub_int64_t sec;
grub_uint32_t nanosec;
-} __attribute__ ((aligned (4)));
+} GRUB_PACKED;
struct grub_btrfs_inode
{
diff --git a/include/grub/efiemu/runtime.h b/include/grub/efiemu/runtime.h
index 9b6b729f4..36d2dedf4 100644
--- include/grub/efiemu/runtime.h
+++ include/grub/efiemu/runtime.h
@@ -29,7 +29,7 @@ struct grub_efiemu_ptv_rel
struct efi_variable
{
- grub_efi_guid_t guid;
+ grub_efi_packed_guid_t guid;
grub_uint32_t namelen;
grub_uint32_t size;
grub_efi_uint32_t attributes;
diff --git a/include/grub/gpt_partition.h b/include/grub/gpt_partition.h
index 1b32f6725..9668a68c3 100644
--- include/grub/gpt_partition.h
+++ include/grub/gpt_partition.h
@@ -28,7 +28,7 @@ struct grub_gpt_part_type
grub_uint16_t data2;
grub_uint16_t data3;
grub_uint8_t data4[8];
-} __attribute__ ((aligned(8)));
+} GRUB_PACKED;
typedef struct grub_gpt_part_type grub_gpt_part_type_t;
#define GRUB_GPT_PARTITION_TYPE_EMPTY \
--
cgit v1.1-33-g03f6

View File

@ -1,47 +0,0 @@
From e16eeda1200deabd0d3a4af968d526d62845a85f Mon Sep 17 00:00:00 2001
From: Hector Marco-Gisbert <hecmargi@upv.es>
Date: Fri, 13 Nov 2015 16:21:09 +0100
Subject: [PATCH] Fix security issue when reading username and password
This patch fixes two integer underflows at:
* grub-core/lib/crypto.c
* grub-core/normal/auth.c
Resolves: CVE-2015-8370
Signed-off-by: Hector Marco-Gisbert <hecmargi@upv.es>
Signed-off-by: Ismael Ripoll-Ripoll <iripoll@disca.upv.es>
---
grub-core/lib/crypto.c | 2 +-
grub-core/normal/auth.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/grub-core/lib/crypto.c b/grub-core/lib/crypto.c
index 010e550..524a3d8 100644
--- grub-core/lib/crypto.c
+++ grub-core/lib/crypto.c
@@ -468,7 +468,7 @@ grub_password_get (char buf[], unsigned buf_size)
break;
}
- if (key == '\b')
+ if (key == '\b' && cur_len)
{
cur_len--;
continue;
diff --git a/grub-core/normal/auth.c b/grub-core/normal/auth.c
index c6bd96e..5782ec5 100644
--- grub-core/normal/auth.c
+++ grub-core/normal/auth.c
@@ -172,7 +172,7 @@ grub_username_get (char buf[], unsigned buf_size)
break;
}
- if (key == '\b')
+ if (key == '\b' && cur_len)
{
cur_len--;
grub_printf ("\b");
--
2.6.4

View File

@ -1,33 +0,0 @@
x86-64: Treat R_X86_64_PLT32 as R_X86_64_PC32
Starting from binutils commit bd7ab16b4537788ad53521c45469a1bdae84ad4a:
https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=bd7ab16b4537788ad53521c45469a1bdae84ad4a
x86-64 assembler generates R_X86_64_PLT32, instead of R_X86_64_PC32, for
32-bit PC-relative branches. Grub2 should treat R_X86_64_PLT32 as
R_X86_64_PC32.
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
--- util/grub-mkimagexx.c
+++ util/grub-mkimagexx.c
@@ -841,6 +841,7 @@ SUFFIX (relocate_addresses) (Elf_Ehdr *e, Elf_Shdr *sections,
break;
case R_X86_64_PC32:
+ case R_X86_64_PLT32:
{
grub_uint32_t *t32 = (grub_uint32_t *) target;
*t32 = grub_host_to_target64 (grub_target_to_host32 (*t32)
diff --git a/util/grub-module-verifier.c b/util/grub-module-verifier.c
index 9179285..a79271f 100644
--- util/grub-module-verifier.c
+++ util/grub-module-verifier.c
@@ -19,6 +19,7 @@ struct grub_module_verifier_arch archs[] = {
-1
}, (int[]){
R_X86_64_PC32,
+ R_X86_64_PLT32,
-1
}
},

View File

@ -1,12 +0,0 @@
--- ./util/grub.d/10_linux.in 2015-01-19 13:30:29.490090317 +0200
+++ ./util/grub.d/10_linux.in 2015-01-19 13:29:41.234754594 +0200
@@ -67,6 +67,9 @@
xzfs)
rpool=`${grub_probe} --device ${GRUB_DEVICE} --target=fs_label 2>/dev/null || true`
bootfs="`make_system_path_relative_to_its_root / | sed -e "s,@$,,"`"
+ if [ -z "${rpool}" ]; then
+ rpool=$(zfs list -Ho name -t filesystem | grep -m1 "${bootfs}$" | sed 's/\/.*//')
+ fi
LINUX_ROOT_DEVICE="ZFS=${rpool}${bootfs}"
;;
esac

View File

@ -1,40 +0,0 @@
From 7c52efa9093592ade59a986c5606450741fb8e59 Mon Sep 17 00:00:00 2001
From: Julian Andres Klode <julian.klode@canonical.com>
Date: Thu, 23 Aug 2018 13:25:30 +0200
Subject: ofnet: Initialize structs in bootpath parser
Code later on checks if variables inside the struct are
0 to see if they have been set, like if there were addresses
in the bootpath.
The variables were not initialized however, so the check
might suceed with uninitialized data, and a new interface
with random addresses has been added. This caused a weird
bug in Ubuntu, because when booting from network, we now
had two interfaces with the same name, and net_default_mac
pointed to the random one.
Bug-Ubuntu: https://bugs.launchpad.net/bugs/1785859
Signed-off-by: Julian Andres Klode <julian.klode@canonical.com>
Patch-Name: ofnet-init-structs-in-bootpath-parser.patch
Forwarded: https://lists.gnu.org/archive/html/grub-devel/2018-08/msg00074.html
Last-Update: 2018-08-23
---
grub-core/net/drivers/ieee1275/ofnet.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/grub-core/net/drivers/ieee1275/ofnet.c b/grub-core/net/drivers/ieee1275/ofnet.c
index a78d164db..3a753658b 100644
--- grub-core/net/drivers/ieee1275/ofnet.c
+++ grub-core/net/drivers/ieee1275/ofnet.c
@@ -154,8 +154,8 @@ grub_ieee1275_parse_bootpath (const char *devpath, char *bootpath,
char *equal_char = 0;
grub_size_t field_counter = 0;
- grub_net_network_level_address_t client_addr, gateway_addr, subnet_mask;
- grub_net_link_level_address_t hw_addr;
+ grub_net_network_level_address_t client_addr = {}, gateway_addr = {}, subnet_mask = {};
+ grub_net_link_level_address_t hw_addr = {};
grub_net_interface_flags_t flags = 0;
struct grub_net_network_level_interface *inter = NULL;

View File

@ -1,8 +1,8 @@
# Template file for 'grub'
pkgname=grub
version=2.02
revision=6
hostmakedepends="flex freetype-devel font-unifont-bdf"
version=2.04
revision=1
hostmakedepends="python3 pkg-config flex freetype-devel font-unifont-bdf"
makedepends="libusb-compat-devel ncurses-devel freetype-devel
liblzma-devel device-mapper-devel fuse-devel"
depends="os-prober"
@ -12,7 +12,7 @@ maintainer="Juan RP <xtraeme@voidlinux.org>"
license="GPL-3"
homepage="https://www.gnu.org/software/grub/"
distfiles="${GNU_SITE}/grub/grub-${version}.tar.xz"
checksum=810b3798d316394f94096ec2797909dbf23c858e48f7b3830826b8daa06b7b0f
checksum=e5292496995ad42dabe843a0192cf2a2c502e7ffcc7479398232b10a472df77d
archs="i686* x86_64* aarch64* ppc ppc-musl ppc64*"
nopie=yes