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