[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [SECURITY PATCH 108/117] util/mkimage: Refactor section setup to use a helper



Hello!

On 3/18/21 9:38 AM, John Paul Adrian Glaubitz wrote:
> This change broke GRUB on ia64 for me. It now fails to perform any basic commands:
> 
> Loading.: grub                                                              
> Starting: grub                                                              
> Welcome to GRUB!                                                                                                                                                                                                                                         
> error: unknown filesystem.
> Entering rescue mode...
> grub rescue> insmod ext2
> error: unknown filesystem.
> grub rescue> help
> Unknown command `help'.
> grub rescue> ?
> Unknown command `?'.
> grub rescue> linux
> Unknown command `linux'.
> grub rescue>

The problem seems that the module loader tries to load the modules from the address
mentioned in the PE header which has changed before this patch was introduced.

However, the modules are still located at the same address in memory which is why
the module loader can no longer find them.

For reference, here is a hex diff of core.efi for the working and non-working builds
(without and with the patch):

--- grub-working.txt	2021-03-20 15:45:43.788950935 +0100
+++ grub-broken.txt	2021-03-20 15:46:05.588885451 +0100
@@ -25,10 +25,10 @@
 00000180: 0000 0000 0000 0000 2e74 6578 7400 0000  .........text...
 00000190: 00e0 0100 0010 0000 00e0 0100 0010 0000  ................
 000001a0: 0000 0000 0000 0000 0000 0000 2000 0060  ............ ..`
-000001b0: 2e64 6174 6100 0000 e094 0100 00f0 0100  .data...........
-000001c0: e094 0100 00f0 0100 0000 0000 0000 0000  ................
+000001b0: 2e64 6174 6100 0000 00a0 0100 00f0 0100  .data...........
+000001c0: 00a0 0100 00f0 0100 0000 0000 0000 0000  ................
 000001d0: 0000 0000 4000 00c0 6d6f 6473 0000 0000  ....@...mods....
-000001e0: 206b 0000 e084 0300 206b 0000 e084 0300   k...... k......
+000001e0: 0060 0000 0090 0300 0060 0000 0090 0300  .`.......`......
 000001f0: 0000 0000 0000 0000 0000 0000 4000 00c0  ............@...
 00000200: 2e72 656c 6f63 0000 0010 0000 00f0 0300  .reloc..........
 00000210: 0010 0000 00f0 0300 0000 0000 0000 0000  ................

Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaubitz@debian.org
`. `'   Freie Universitaet Berlin - glaubitz@physik.fu-berlin.de
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913


Reply to: