331d9e4
From c94146470358e5ba3b2047f8e0aa762f9357a15e Mon Sep 17 00:00:00 2001
bc092b9
From: Peter Jones <pjones@redhat.com>
bc092b9
Date: Mon, 1 May 2017 11:19:40 -0400
bbc6a89
Subject: [PATCH 173/192] 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
bc092b9
index 684ca93f8..1f3ac5e1d 100644
bc092b9
--- a/grub-core/kern/efi/efi.c
bc092b9
+++ b/grub-core/kern/efi/efi.c
bc092b9
@@ -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",
bc092b9
+		   "section %d has bad magic %08lx, should be %08lx\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
-- 
bbc6a89
2.13.4
bc092b9