78e1a10
From 6025b0afe64157eb922d562e85f1734b7ce800c9 Mon Sep 17 00:00:00 2001
bc092b9
From: Peter Jones <pjones@redhat.com>
bc092b9
Date: Mon, 1 May 2017 11:19:40 -0400
78e1a10
Subject: [PATCH 172/216] 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
78e1a10
index 684ca93f8f4..866fc20e162 100644
bc092b9
--- a/grub-core/kern/efi/efi.c
bc092b9
+++ b/grub-core/kern/efi/efi.c
6f1e3d5
@@ -304,13 +304,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",
78e1a10
+		   "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
 
bc092b9
-- 
ec4acbb
2.15.0
bc092b9