Blame SOURCES/0086-print-more-debug-info-in-our-module-loader.patch

d9d99f
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
d9d99f
From: Peter Jones <pjones@redhat.com>
d9d99f
Date: Mon, 1 May 2017 11:19:40 -0400
d9d99f
Subject: [PATCH] print more debug info in our module loader.
d9d99f
d9d99f
Signed-off-by: Peter Jones <pjones@redhat.com>
d9d99f
---
d9d99f
 grub-core/kern/efi/efi.c | 16 +++++++++++++---
d9d99f
 1 file changed, 13 insertions(+), 3 deletions(-)
d9d99f
d9d99f
diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c
d9d99f
index e339f264b3a..562d6887e0e 100644
d9d99f
--- a/grub-core/kern/efi/efi.c
d9d99f
+++ b/grub-core/kern/efi/efi.c
d9d99f
@@ -313,13 +313,23 @@ grub_efi_modules_addr (void)
d9d99f
     }
d9d99f
 
d9d99f
   if (i == coff_header->num_sections)
d9d99f
-    return 0;
d9d99f
+    {
d9d99f
+      grub_dprintf("sections", "section %d is last section; invalid.\n", i);
d9d99f
+      return 0;
d9d99f
+    }
d9d99f
 
d9d99f
   info = (struct grub_module_info *) ((char *) image->image_base
d9d99f
 				      + section->virtual_address);
d9d99f
-  if (info->magic != GRUB_MODULE_MAGIC)
d9d99f
-    return 0;
d9d99f
+  if (section->name[0] != '.' && info->magic != GRUB_MODULE_MAGIC)
d9d99f
+    {
d9d99f
+      grub_dprintf("sections",
d9d99f
+		   "section %d has bad magic %08x, should be %08x\n",
d9d99f
+		   i, info->magic, GRUB_MODULE_MAGIC);
d9d99f
+      return 0;
d9d99f
+    }
d9d99f
 
d9d99f
+  grub_dprintf("sections", "returning section info for section %d: \"%s\"\n",
d9d99f
+	       i, section->name);
d9d99f
   return (grub_addr_t) info;
d9d99f
 }
d9d99f