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