f52f8fe
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
f52f8fe
From: Javier Martinez Canillas <javierm@redhat.com>
f52f8fe
Date: Tue, 7 May 2019 13:54:23 +0200
f52f8fe
Subject: [PATCH] blscfg: remove BLS file size check
f52f8fe
f52f8fe
The read_entry() function checks the BLS file size and ignores the entry
f52f8fe
if the file size isn't correct. The problem is that it will only work if
f52f8fe
the struct grub_file layout and fields are the same in the GRUB version
f52f8fe
used to build the blscfg.mod, than the one that's installed as GRUB core.
f52f8fe
f52f8fe
But commit 84a0e9699f8 ("Add progress module to display load progress of
f52f8fe
files.") added a .name field to struct grub_file, and this change landed
f52f8fe
in the GRUB version used by Fedora 21.
f52f8fe
f52f8fe
Since the GRUB core is never updated when the grub2 package is upgraded,
f52f8fe
the blscfg module won't be compatible with any GRUB that was installed by
f52f8fe
Fedora 20 or eralier.
f52f8fe
f52f8fe
The blscfg.mod is copied to /boot/grub2/i386-pc/ in legacy BIOS installs
f52f8fe
when the GRUB configuration is switched to BLS, so this will lead to BLS
f52f8fe
files being ignored due grub_file_size() reporting wrong file sizes. This
f52f8fe
is caused by the struct grub_file .size field offset being different in
f52f8fe
Fedora 20 than later releases.
f52f8fe
f52f8fe
This check is doing more harm than good, so let's just remove it to make
f52f8fe
the blscfg module compatible at least up to GRUB core that was installed
f52f8fe
by Fedora 19.
f52f8fe
f52f8fe
Related: rhbz#1652806
f52f8fe
f52f8fe
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
f52f8fe
---
f52f8fe
 grub-core/commands/blscfg.c | 5 -----
f52f8fe
 1 file changed, 5 deletions(-)
f52f8fe
f52f8fe
diff --git a/grub-core/commands/blscfg.c b/grub-core/commands/blscfg.c
f52f8fe
index bb93b7f4904..bd008b04bec 100644
f52f8fe
--- a/grub-core/commands/blscfg.c
f52f8fe
+++ b/grub-core/commands/blscfg.c
f52f8fe
@@ -412,7 +412,6 @@ static int read_entry (
f52f8fe
   int rc = 0;
f52f8fe
   char *p = NULL;
f52f8fe
   grub_file_t f = NULL;
f52f8fe
-  grub_off_t sz;
f52f8fe
   struct bls_entry *entry;
f52f8fe
   struct read_entry_info *info = (struct read_entry_info *)data;
f52f8fe
 
f52f8fe
@@ -442,10 +441,6 @@ static int read_entry (
f52f8fe
 	goto finish;
f52f8fe
     }
f52f8fe
 
f52f8fe
-  sz = grub_file_size (f);
f52f8fe
-  if (sz == GRUB_FILE_SIZE_UNKNOWN || sz > 1024*1024)
f52f8fe
-    goto finish;
f52f8fe
-
f52f8fe
   entry = grub_zalloc (sizeof (*entry));
f52f8fe
   if (!entry)
f52f8fe
     goto finish;