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