dcavalca / rpms / grub2

Forked from rpms/grub2 3 years ago
Clone

Blame SOURCES/0086-print-more-debug-info-in-our-module-loader.patch

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