Commit 465c8e37 authored by Rocky Automation's avatar Rocky Automation 📺
Browse files

import grub2-2.02-87.el8_2

parent 512acd7c
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Tue, 10 Jul 2018 16:54:02 -0400
Subject: [PATCH] Force everything to use python3
But this still means you need to do PYTHON=python=3 ./autogen.sh if you
run the world's worst tooling before you patch.
Signed-off-by: Peter Jones <pjones@redhat.com>
---
conf/Makefile.common | 4 ++--
gentpl.py | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/conf/Makefile.common b/conf/Makefile.common
index c75848f5c06..1ecb921db65 100644
--- a/conf/Makefile.common
+++ b/conf/Makefile.common
@@ -128,11 +128,11 @@ BUILT_SOURCES =
.PRECIOUS: $(top_srcdir)/Makefile.util.am
$(top_srcdir)/Makefile.util.am: $(top_srcdir)/gentpl.py $(top_srcdir)/Makefile.util.def $(top_srcdir)/Makefile.utilgcry.def
- python $^ > $@.new || (rm -f $@.new; exit 1)
+ python3 $^ > $@.new || (rm -f $@.new; exit 1)
mv $@.new $@
.PRECIOUS: $(top_srcdir)/grub-core/Makefile.core.am
$(top_srcdir)/grub-core/Makefile.core.am: $(top_srcdir)/gentpl.py $(top_srcdir)/grub-core/Makefile.core.def $(top_srcdir)/grub-core/Makefile.gcry.def
if [ "x$$GRUB_CONTRIB" != x ]; then echo "You need to run ./autogen.sh manually." >&2; exit 1; fi
- python $^ > $@.new || (rm -f $@.new; exit 1)
+ python3 $^ > $@.new || (rm -f $@.new; exit 1)
mv $@.new $@
diff --git a/gentpl.py b/gentpl.py
index baac6a2af69..6409736e81c 100644
--- a/gentpl.py
+++ b/gentpl.py
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#! /usr/bin/env python3
# GRUB -- GRand Unified Bootloader
# Copyright (C) 2010,2011,2012,2013 Free Software Foundation, Inc.
#
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Thu, 26 Jul 2018 14:54:44 -0400
Subject: [PATCH] Fix an 8 year old typo.
Signed-off-by: Peter Jones <pjones@redhat.com>
---
configure.ac | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index 5f47a9265f3..9ab683fefac 100644
--- a/configure.ac
+++ b/configure.ac
@@ -307,7 +307,7 @@ fi
AC_SUBST(bootdirname)
AC_DEFINE_UNQUOTED(GRUB_BOOT_DIR_NAME, "$bootdirname",
- [Default boot directory name]")
+ [Default boot directory name])
AC_ARG_WITH([grubdir],
AS_HELP_STRING([--with-grubdir=DIR],
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Thu, 26 Jul 2018 15:47:48 -0400
Subject: [PATCH] autogen: don't run autoreconf in the topdir
Signed-off-by: Peter Jones <pjones@redhat.com>
---
autogen.sh | 2 --
1 file changed, 2 deletions(-)
diff --git a/autogen.sh b/autogen.sh
index 7537561ad0d..f608b9467a0 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -82,6 +82,4 @@ done
echo "Saving timestamps..."
echo timestamp > stamp-h.in
-echo "Running autoreconf..."
-autoreconf -vi
exit 0
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Tue, 26 Jun 2018 17:16:06 -0400
Subject: [PATCH] Make it so we can tell configure which cflags utils are built
with
This lets us have kernel.img be built with TARGET_CFLAGS but grub-mkimage and
friends built with HOST_CFLAGS. That in turn lets us build with an ARM compiler
that only has hard-float ABI versions of crt*.o and libgcc*, but still use soft
float for grub.efi.
Signed-off-by: Peter Jones <pjones@redhat.com>
---
configure.ac | 49 ++++++++++++++++++++++++++++++++++++++++++++++++-
conf/Makefile.common | 23 ++++++++++++-----------
gentpl.py | 8 ++++----
3 files changed, 64 insertions(+), 16 deletions(-)
diff --git a/configure.ac b/configure.ac
index 9ab683fefac..819212095ff 100644
--- a/configure.ac
+++ b/configure.ac
@@ -850,11 +850,23 @@ if ( test "x$target_cpu" = xi386 || test "x$target_cpu" = xx86_64 ) && test "x$p
TARGET_CFLAGS="$TARGET_CFLAGS -mno-mmx -mno-sse -mno-sse2 -mno-sse3 -mno-3dnow"
fi
+# Should grub utils get the host CFLAGS, or the target CFLAGS?
+AC_ARG_WITH([utils],
+ AS_HELP_STRING([--with-utils=host|target|build],
+ [choose which flags to build utilities with. (default=target)]),
+ [have_with_utils=y],
+ [have_with_utils=n])
+if test x"$have_with_utils" = xy ; then
+ with_utils="$withval"
+else
+ with_utils=target
+fi
+
# GRUB doesn't use float or doubles at all. Yet some toolchains may decide
# that floats are a good fit to run instead of what's written in the code.
# Given that floating point unit is disabled (if present to begin with)
# when GRUB is running which may result in various hard crashes.
-if test x"$platform" != xemu ; then
+if test x"$platform" != xemu -a x"$with_utils" == xtarget ; then
AC_CACHE_CHECK([for options to get soft-float], grub_cv_target_cc_soft_float, [
grub_cv_target_cc_soft_float=no
if test "x$target_cpu" = xarm64; then
@@ -1939,6 +1951,41 @@ HOST_CPPFLAGS="$HOST_CPPFLAGS -I\$(top_builddir)/include"
TARGET_CPPFLAGS="$TARGET_CPPFLAGS -I\$(top_srcdir)/include"
TARGET_CPPFLAGS="$TARGET_CPPFLAGS -I\$(top_builddir)/include"
+case "$with_utils" in
+ host)
+ UTILS_CFLAGS=$HOST_CFLAGS
+ UTILS_CPPFLAGS=$HOST_CPPFLAGS
+ UTILS_CCASFLAGS=$HOST_CCASFLAGS
+ UTILS_LDFLAGS=$HOST_LDFLAGS
+ ;;
+ target)
+ UTILS_CFLAGS=$TARGET_CFLAGS
+ UTILS_CPPFLAGS=$TARGET_CPPFLAGS
+ UTILS_CCASFLAGS=$TARGET_CCASFLAGS
+ UTILS_LDFLAGS=$TARGET_LDFLAGS
+ ;;
+ build)
+ UTILS_CFLAGS=$BUILD_CFLAGS
+ UTILS_CPPFLAGS=$BUILD_CPPFLAGS
+ UTILS_CCASFLAGS=$BUILD_CCASFLAGS
+ UTILS_LDFLAGS=$BUILD_LDFLAGS
+ ;;
+ *)
+ AC_MSG_ERROR([--with-utils must be either host, target, or build])
+ ;;
+esac
+AC_MSG_NOTICE([Using $with_utils flags for utilities.])
+
+unset CFLAGS
+unset CPPFLAGS
+unset CCASFLAGS
+unset LDFLAGS
+
+AC_SUBST(UTILS_CFLAGS)
+AC_SUBST(UTILS_CPPFLAGS)
+AC_SUBST(UTILS_CCASFLAGS)
+AC_SUBST(UTILS_LDFLAGS)
+
GRUB_TARGET_CPU="${target_cpu}"
GRUB_PLATFORM="${platform}"
diff --git a/conf/Makefile.common b/conf/Makefile.common
index 1ecb921db65..b93879804c0 100644
--- a/conf/Makefile.common
+++ b/conf/Makefile.common
@@ -40,24 +40,25 @@ CPPFLAGS_KERNEL = $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM) -DGRUB_KERNEL=1
CCASFLAGS_KERNEL = $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM)
STRIPFLAGS_KERNEL = -R .eh_frame -R .rel.dyn -R .reginfo -R .note -R .comment -R .drectve -R .note.gnu.gold-version -R .MIPS.abiflags -R .ARM.exidx -R .note.gnu.property -R .gnu.build.attributes
-CFLAGS_MODULE = $(CFLAGS_PLATFORM) -ffreestanding
-LDFLAGS_MODULE = $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) -Wl,-r,-d
-CPPFLAGS_MODULE = $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM)
-CCASFLAGS_MODULE = $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM)
+CFLAGS_MODULE = $(TARGET_CFLAGS) $(CFLAGS_PLATFORM) -ffreestanding
+LDFLAGS_MODULE = $(TARGET_LDFLAGS) $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) -Wl,-r,-d
+CPPFLAGS_MODULE = $(TARGET_CPPFLAGS) $(CPPFLAGS_DEFAULT) $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM)
+CCASFLAGS_MODULE = $(TARGET_CCASFLAGS) $(CCASFLAGS_DEFAULT) $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM)
CFLAGS_IMAGE = $(CFLAGS_PLATFORM) -fno-builtin
LDFLAGS_IMAGE = $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) -Wl,-S
CPPFLAGS_IMAGE = $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM)
CCASFLAGS_IMAGE = $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM)
-CFLAGS_PROGRAM =
-LDFLAGS_PROGRAM =
-CPPFLAGS_PROGRAM =
-CCASFLAGS_PROGRAM =
+CFLAGS_PROGRAM = $(UTILS_CFLAGS)
+LDFLAGS_PROGRAM = $(UTILS_LDFLAGS)
+CPPFLAGS_PROGRAM = $(UTILS_CPPFLAGS)
+CCASFLAGS_PROGRAM = $(UTILS_CCASFLAGS)
-CFLAGS_LIBRARY =
-CPPFLAGS_LIBRARY =
-CCASFLAGS_LIBRARY =
+CFLAGS_LIBRARY = $(UTILS_CFLAGS)
+LDFLAGS_LIBRARY = $(UTILS_LDFLAGS)
+CPPFLAGS_LIBRARY = $(UTILS_CPPFLAGS)
+CCASFLAGS_LIBRARY = $(UTILS_CCASFLAGS)
# Other variables
diff --git a/gentpl.py b/gentpl.py
index 6409736e81c..1e4635f4426 100644
--- a/gentpl.py
+++ b/gentpl.py
@@ -694,10 +694,10 @@ def module(defn, platform):
var_set(cname(defn) + "_SOURCES", platform_sources(defn, platform) + " ## platform sources")
var_set("nodist_" + cname(defn) + "_SOURCES", platform_nodist_sources(defn, platform) + " ## platform nodist sources")
var_set(cname(defn) + "_LDADD", platform_ldadd(defn, platform))
- var_set(cname(defn) + "_CFLAGS", "$(AM_CFLAGS) $(CFLAGS_MODULE) " + platform_cflags(defn, platform))
- var_set(cname(defn) + "_LDFLAGS", "$(AM_LDFLAGS) $(LDFLAGS_MODULE) " + platform_ldflags(defn, platform))
- var_set(cname(defn) + "_CPPFLAGS", "$(AM_CPPFLAGS) $(CPPFLAGS_MODULE) " + platform_cppflags(defn, platform))
- var_set(cname(defn) + "_CCASFLAGS", "$(AM_CCASFLAGS) $(CCASFLAGS_MODULE) " + platform_ccasflags(defn, platform))
+ var_set(cname(defn) + "_CFLAGS", "$(CFLAGS_MODULE) " + platform_cflags(defn, platform))
+ var_set(cname(defn) + "_LDFLAGS", "$(LDFLAGS_MODULE) " + platform_ldflags(defn, platform))
+ var_set(cname(defn) + "_CPPFLAGS", "$(CPPFLAGS_MODULE) " + platform_cppflags(defn, platform))
+ var_set(cname(defn) + "_CCASFLAGS", "$(CCASFLAGS_MODULE) " + platform_ccasflags(defn, platform))
var_set(cname(defn) + "_DEPENDENCIES", "$(TARGET_OBJ2ELF) " + platform_dependencies(defn, platform))
gvar_add("dist_noinst_DATA", extra_dist(defn))
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Wed, 1 Aug 2018 10:24:52 -0400
Subject: [PATCH] module-verifier: make it possible to run checkers on
grub-module-verifierxx.c
This makes it so you can treat grub-module-verifierxx.c as a file you can
build directly, so syntax checkers like vim's "syntastic" plugin, which uses
"gcc -x c -fsyntax-only" to build it, will work.
One still has to do whatever setup is required to make it pick the right
include dirs, which -W options we use, etc., but this makes it so you can do
the checking on the file you're editing, rather than on a different file.
v2: fix the typo in the #else clause in util/grub-module-verifierXX.c
Signed-off-by: Peter Jones <pjones@redhat.com>
---
util/grub-module-verifier32.c | 2 ++
util/grub-module-verifier64.c | 2 ++
util/grub-module-verifierXX.c | 9 +++++++++
3 files changed, 13 insertions(+)
diff --git a/util/grub-module-verifier32.c b/util/grub-module-verifier32.c
index 257229f8f08..ba7d41aafea 100644
--- a/util/grub-module-verifier32.c
+++ b/util/grub-module-verifier32.c
@@ -1,2 +1,4 @@
#define MODULEVERIFIER_ELF32 1
+#ifndef GRUB_MODULE_VERIFIERXX
#include "grub-module-verifierXX.c"
+#endif
diff --git a/util/grub-module-verifier64.c b/util/grub-module-verifier64.c
index 4db6b4bedd1..fc23ef800b3 100644
--- a/util/grub-module-verifier64.c
+++ b/util/grub-module-verifier64.c
@@ -1,2 +1,4 @@
#define MODULEVERIFIER_ELF64 1
+#ifndef GRUB_MODULE_VERIFIERXX
#include "grub-module-verifierXX.c"
+#endif
diff --git a/util/grub-module-verifierXX.c b/util/grub-module-verifierXX.c
index 1feaafc9b9e..597ded14362 100644
--- a/util/grub-module-verifierXX.c
+++ b/util/grub-module-verifierXX.c
@@ -1,3 +1,12 @@
+#define GRUB_MODULE_VERIFIERXX
+#if !defined(MODULEVERIFIER_ELF32) && !defined(MODULEVERIFIER_ELF64)
+#if __SIZEOF_POINTER__ == 8
+#include "grub-module-verifier64.c"
+#else
+#include "grub-module-verifier32.c"
+#endif
+#endif
+
#include <string.h>
#include <grub/elf.h>
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Wed, 1 Aug 2018 10:12:47 -0400
Subject: [PATCH] grub-module-verifier: report the filename or modname in
errors.
Make it so that when grub-module-verifier complains of an issue, it tells you
which module the issue was with.
Signed-off-by: Peter Jones <pjones@redhat.com>
---
util/grub-module-verifier.c | 6 ++---
util/grub-module-verifierXX.c | 58 ++++++++++++++++++++++--------------------
include/grub/module_verifier.h | 4 +--
3 files changed, 36 insertions(+), 32 deletions(-)
diff --git a/util/grub-module-verifier.c b/util/grub-module-verifier.c
index a79271f6631..03ba1ab437a 100644
--- a/util/grub-module-verifier.c
+++ b/util/grub-module-verifier.c
@@ -157,7 +157,7 @@ main (int argc, char **argv)
if (strcmp(archs[arch].name, argv[2]) == 0)
break;
if (arch == ARRAY_SIZE(archs))
- grub_util_error("unknown arch: %s", argv[2]);
+ grub_util_error("%s: unknown arch: %s", argv[1], argv[2]);
for (whitelist = 0; whitelist < ARRAY_SIZE(whitelists); whitelist++)
if (strcmp(whitelists[whitelist].arch, argv[2]) == 0
@@ -169,8 +169,8 @@ main (int argc, char **argv)
module_size = grub_util_get_image_size (argv[1]);
module_img = grub_util_read_image (argv[1]);
if (archs[arch].voidp_sizeof == 8)
- grub_module_verify64(module_img, module_size, &archs[arch], whitelist_empty);
+ grub_module_verify64(argv[1], module_img, module_size, &archs[arch], whitelist_empty);
else
- grub_module_verify32(module_img, module_size, &archs[arch], whitelist_empty);
+ grub_module_verify32(argv[1], module_img, module_size, &archs[arch], whitelist_empty);
return 0;
}
diff --git a/util/grub-module-verifierXX.c b/util/grub-module-verifierXX.c
index 597ded14362..a98e2f9b1ac 100644
--- a/util/grub-module-verifierXX.c
+++ b/util/grub-module-verifierXX.c
@@ -160,14 +160,15 @@ find_section (const struct grub_module_verifier_arch *arch, Elf_Ehdr *e, const c
}
static void
-check_license (const struct grub_module_verifier_arch *arch, Elf_Ehdr *e)
+check_license (const char * const filename,
+ const struct grub_module_verifier_arch *arch, Elf_Ehdr *e)
{
Elf_Shdr *s = find_section (arch, e, ".module_license");
if (s && (strcmp ((char *) e + grub_target_to_host(s->sh_offset), "LICENSE=GPLv3") == 0
|| strcmp ((char *) e + grub_target_to_host(s->sh_offset), "LICENSE=GPLv3+") == 0
|| strcmp ((char *) e + grub_target_to_host(s->sh_offset), "LICENSE=GPLv2+") == 0))
return;
- grub_util_error ("incompatible license");
+ grub_util_error ("%s: incompatible license", filename);
}
static Elf_Sym *
@@ -233,10 +234,10 @@ check_symbols (const struct grub_module_verifier_arch *arch,
s = find_section (arch, e, ".moddeps");
if (!s)
- grub_util_error ("no symbol table and no .moddeps section");
+ grub_util_error ("%s: no symbol table and no .moddeps section", modname);
if (!s->sh_size)
- grub_util_error ("no symbol table and empty .moddeps section");
+ grub_util_error ("%s: no symbol table and empty .moddeps section", modname);
return;
}
@@ -257,7 +258,7 @@ check_symbols (const struct grub_module_verifier_arch *arch,
break;
default:
- return grub_util_error ("unknown symbol type `%d'", (int) type);
+ return grub_util_error ("%s: unknown symbol type `%d'", modname, (int) type);
}
}
}
@@ -283,7 +284,8 @@ is_symbol_local(Elf_Sym *sym)
}
static void
-section_check_relocations (const struct grub_module_verifier_arch *arch, void *ehdr,
+section_check_relocations (const char * const modname,
+ const struct grub_module_verifier_arch *arch, void *ehdr,
Elf_Shdr *s, size_t target_seg_size)
{
Elf_Rel *rel, *max;
@@ -292,7 +294,7 @@ section_check_relocations (const struct grub_module_verifier_arch *arch, void *e
symtab = get_symtab (arch, ehdr, &symtabsize, &symtabentsize);
if (!symtab)
- grub_util_error ("relocation without symbol table");
+ grub_util_error ("%s: relocation without symbol table", modname);
for (rel = (Elf_Rel *) ((char *) ehdr + grub_target_to_host (s->sh_offset)),
max = (Elf_Rel *) ((char *) rel + grub_target_to_host (s->sh_size));
@@ -303,7 +305,7 @@ section_check_relocations (const struct grub_module_verifier_arch *arch, void *e
unsigned i;
if (target_seg_size < grub_target_to_host (rel->r_offset))
- grub_util_error ("reloc offset is out of the segment");
+ grub_util_error ("%s: reloc offset is out of the segment", modname);
grub_uint32_t type = ELF_R_TYPE (grub_target_to_host (rel->r_info));
@@ -316,17 +318,17 @@ section_check_relocations (const struct grub_module_verifier_arch *arch, void *e
if (arch->supported_relocations[i] != -1)
continue;
if (!arch->short_relocations)
- grub_util_error ("unsupported relocation 0x%x", type);
+ grub_util_error ("%s: unsupported relocation 0x%x", modname, type);
for (i = 0; arch->short_relocations[i] != -1; i++)
if (type == arch->short_relocations[i])
break;
if (arch->short_relocations[i] == -1)
- grub_util_error ("unsupported relocation 0x%x", type);
+ grub_util_error ("%s: unsupported relocation 0x%x", modname, type);
sym = (Elf_Sym *) ((char *) symtab + symtabentsize * ELF_R_SYM (grub_target_to_host (rel->r_info)));
if (is_symbol_local (sym))
continue;
- grub_util_error ("relocation 0x%x is not module-local", type);
+ grub_util_error ("%s: relocation 0x%x is not module-local", modname, type);
}
#if defined(MODULEVERIFIER_ELF64)
if (arch->machine == EM_AARCH64)
@@ -351,11 +353,11 @@ section_check_relocations (const struct grub_module_verifier_arch *arch, void *e
&& ELF_R_TYPE (rel2->r_info) == R_AARCH64_LD64_GOT_LO12_NC)
break;
if (rel2 >= (Elf_Rela *) max)
- grub_util_error ("ADR_GOT_PAGE without matching LD64_GOT_LO12_NC");
+ grub_util_error ("%s: ADR_GOT_PAGE without matching LD64_GOT_LO12_NC", modname);
break;
case R_AARCH64_LD64_GOT_LO12_NC:
if (unmatched_adr_got_page == 0)
- grub_util_error ("LD64_GOT_LO12_NC without matching ADR_GOT_PAGE");
+ grub_util_error ("%s: LD64_GOT_LO12_NC without matching ADR_GOT_PAGE", modname);
unmatched_adr_got_page--;
break;
}
@@ -365,7 +367,8 @@ section_check_relocations (const struct grub_module_verifier_arch *arch, void *e
}
static void
-check_relocations (const struct grub_module_verifier_arch *arch, Elf_Ehdr *e)
+check_relocations (const char * const modname,
+ const struct grub_module_verifier_arch *arch, Elf_Ehdr *e)
{
Elf_Shdr *s;
unsigned i;
@@ -378,21 +381,22 @@ check_relocations (const struct grub_module_verifier_arch *arch, Elf_Ehdr *e)
Elf_Shdr *ts;
if (grub_target_to_host32 (s->sh_type) == SHT_REL && !(arch->flags & GRUB_MODULE_VERIFY_SUPPORTS_REL))
- grub_util_error ("unsupported SHT_REL");
+ grub_util_error ("%s: unsupported SHT_REL", modname);
if (grub_target_to_host32 (s->sh_type) == SHT_RELA && !(arch->flags & GRUB_MODULE_VERIFY_SUPPORTS_RELA))
- grub_util_error ("unsupported SHT_RELA");
+ grub_util_error ("%s: unsupported SHT_RELA", modname);
/* Find the target segment. */
if (grub_target_to_host32 (s->sh_info) >= grub_target_to_host16 (e->e_shnum))
- grub_util_error ("orphaned reloc section");
+ grub_util_error ("%s: orphaned reloc section", modname);
ts = (Elf_Shdr *) ((char *) e + grub_target_to_host (e->e_shoff) + grub_target_to_host32 (s->sh_info) * grub_target_to_host16 (e->e_shentsize));
- section_check_relocations (arch, e, s, grub_target_to_host (ts->sh_size));
+ section_check_relocations (modname, arch, e, s, grub_target_to_host (ts->sh_size));
}
}
void
-SUFFIX(grub_module_verify) (void *module_img, size_t size,
+SUFFIX(grub_module_verify) (const char * const filename,
+ void *module_img, size_t size,
const struct grub_module_verifier_arch *arch,
const char **whitelist_empty)
{
@@ -400,7 +404,7 @@ SUFFIX(grub_module_verify) (void *module_img, size_t size,
/* Check the header size. */
if (size < sizeof (Elf_Ehdr))
- grub_util_error ("ELF header smaller than expected");
+ grub_util_error ("%s: ELF header smaller than expected", filename);
/* Check the magic numbers. */
if (e->e_ident[EI_MAG0] != ELFMAG0
@@ -409,36 +413,36 @@ SUFFIX(grub_module_verify) (void *module_img, size_t size,
|| e->e_ident[EI_MAG3] != ELFMAG3
|| e->e_ident[EI_VERSION] != EV_CURRENT
|| grub_target_to_host32 (e->e_version) != EV_CURRENT)
- grub_util_error ("invalid arch-independent ELF magic");
+ grub_util_error ("%s: invalid arch-independent ELF magic", filename);
if (e->e_ident[EI_CLASS] != ELFCLASSXX
|| e->e_ident[EI_DATA] != (arch->bigendian ? ELFDATA2MSB : ELFDATA2LSB)
|| grub_target_to_host16 (e->e_machine) != arch->machine)
- grub_util_error ("invalid arch-dependent ELF magic");
+ grub_util_error ("%s: invalid arch-dependent ELF magic", filename);
if (grub_target_to_host16 (e->e_type) != ET_REL)
{
- grub_util_error ("this ELF file is not of the right type");
+ grub_util_error ("%s: this ELF file is not of the right type", filename);
}
/* Make sure that every section is within the core. */
if (size < grub_target_to_host (e->e_shoff)
+ (grub_uint32_t) grub_target_to_host16 (e->e_shentsize) * grub_target_to_host16(e->e_shnum))
{
- grub_util_error ("ELF sections outside core");
+ grub_util_error ("%s: ELF sections outside core", filename);
}
- check_license (arch, e);
+ check_license (filename, arch, e);
Elf_Shdr *s;
const char *modname;
s = find_section (arch, e, ".modname");
if (!s)
- grub_util_error ("no module name found");
+ grub_util_error ("%s: no module name found", filename);
modname = (const char *) e + grub_target_to_host (s->sh_offset);
check_symbols(arch, e, modname, whitelist_empty);
- check_relocations(arch, e);
+ check_relocations(modname, arch, e);
}
diff --git a/include/grub/module_verifier.h b/include/grub/module_verifier.h
index f4870cb9c2d..ba21c75e2eb 100644
--- a/include/grub/module_verifier.h
+++ b/include/grub/module_verifier.h
@@ -16,5 +16,5 @@ struct grub_module_verifier_arch {
const int *short_relocations;
};
-void grub_module_verify64(void *module_img, size_t module_size, const struct grub_module_verifier_arch *arch, const char **whitelist_empty);
-void grub_module_verify32(void *module_img, size_t module_size, const struct grub_module_verifier_arch *arch, const char **whitelist_empty);
+void grub_module_verify64(const char * const filename, void *module_img, size_t module_size, const struct grub_module_verifier_arch *arch, const char **whitelist_empty);
+void grub_module_verify32(const char * const filename, void *module_img, size_t module_size, const struct grub_module_verifier_arch *arch, const char **whitelist_empty);
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Wed, 11 Jul 2018 13:50:00 -0400
Subject: [PATCH] Make efi_netfs not duplicate symbols from efinet
Signed-off-by: Peter Jones <pjones@redhat.com>
---
grub-core/Makefile.core.def | 6 ------
1 file changed, 6 deletions(-)
diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
index aa44d66aca4..e35217b8668 100644
--- a/grub-core/Makefile.core.def
+++ b/grub-core/Makefile.core.def
@@ -2186,12 +2186,6 @@ module = {
module = {
name = efi_netfs;
common = net/efi/efi_netfs.c;
- common = net/efi/net.c;
- common = net/efi/http.c;
- common = net/efi/pxe.c;
- common = net/efi/ip4_config.c;
- common = net/efi/ip6_config.c;
- common = net/efi/dhcp.c;
enable = efi;
};
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Thu, 12 Jul 2018 11:00:45 -0400
Subject: [PATCH] Rework how the fdt command builds.
Trying to avoid all variants of:
cat syminfo.lst | sort | gawk -f ../../grub-core/genmoddep.awk > moddep.lst || (rm -f moddep.lst; exit 1)
grub_fdt_install in linux is not defined
grub_fdt_load in linux is not defined
grub_fdt_unload in linux is not defined
grub_fdt_install in xen_boot is not defined
grub_fdt_load in xen_boot is not defined
grub_fdt_unload in xen_boot is not defined
Signed-off-by: Peter Jones <pjones@redhat.com>
---
grub-core/Makefile.core.def | 5 ++---
grub-core/lib/fdt.c | 2 --
grub-core/loader/efi/fdt.c | 2 ++
include/grub/fdt.h | 4 ++++
grub-core/Makefile.am | 1 +
5 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
index e35217b8668..cf3d549d212 100644
--- a/grub-core/Makefile.core.def