Blame SOURCES/0189-Print-module-name-on-license-check-failure.patch

c283d0
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
c283d0
From: Robbie Harwood <rharwood@redhat.com>
c283d0
Date: Tue, 12 Oct 2021 12:34:23 -0400
c283d0
Subject: [PATCH] Print module name on license check failure
c283d0
c283d0
At the very least, this will make it easier to track down the problem
c283d0
module - or, if something else has gone wrong, provide more information
c283d0
for debugging.
c283d0
c283d0
Signed-off-by: Robbie Harwood <rharwood@redhat.com>
c283d0
---
c283d0
 grub-core/kern/dl.c | 10 ++++++----
c283d0
 1 file changed, 6 insertions(+), 4 deletions(-)
c283d0
c283d0
diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c
b35c50
index 9557254035..f304494574 100644
c283d0
--- a/grub-core/kern/dl.c
c283d0
+++ b/grub-core/kern/dl.c
c283d0
@@ -528,14 +528,16 @@ grub_dl_find_section_index (Elf_Ehdr *e, const char *name)
c283d0
    Be sure to understand your license obligations.
c283d0
 */
c283d0
 static grub_err_t
c283d0
-grub_dl_check_license (Elf_Ehdr *e)
c283d0
+grub_dl_check_license (grub_dl_t mod, Elf_Ehdr *e)
c283d0
 {
c283d0
   Elf_Shdr *s = grub_dl_find_section (e, ".module_license");
c283d0
   if (s && (grub_strcmp ((char *) e + s->sh_offset, "LICENSE=GPLv3") == 0
c283d0
 	    || grub_strcmp ((char *) e + s->sh_offset, "LICENSE=GPLv3+") == 0
c283d0
 	    || grub_strcmp ((char *) e + s->sh_offset, "LICENSE=GPLv2+") == 0))
c283d0
     return GRUB_ERR_NONE;
c283d0
-  return grub_error (GRUB_ERR_BAD_MODULE, "incompatible license");
c283d0
+  return grub_error (GRUB_ERR_BAD_MODULE,
c283d0
+		     "incompatible license in module %s: %s", mod->name,
c283d0
+		     (char *) e + s->sh_offset);
c283d0
 }
c283d0
 
c283d0
 static grub_err_t
c283d0
@@ -743,8 +745,8 @@ grub_dl_load_core_noinit (void *addr, grub_size_t size)
c283d0
      constitutes linking) and GRUB core being licensed under GPLv3+.
c283d0
      Be sure to understand your license obligations.
c283d0
   */
c283d0
-  if (grub_dl_check_license (e)
c283d0
-      || grub_dl_resolve_name (mod, e)
c283d0
+  if (grub_dl_resolve_name (mod, e)
c283d0
+      || grub_dl_check_license (mod, e)
c283d0
       || grub_dl_resolve_dependencies (mod, e)
c283d0
       || grub_dl_load_segments (mod, e)
c283d0
       || grub_dl_resolve_symbols (mod, e)