Comment # 18 on bug 954126 from
(In reply to Andrei Borzenkov from comment #6)
> OK, I found bootmgfw.efi, and it confirms it. The problem is in
> grub2-efi-chainload-harder.patch that adds check for valid PE32+ header; but
> this check is wrong.
> 
>   if (grub_memcmp (pe32->signature, "PE\0\0", 4) != 0
> 
> pe32 header is not located at fixed address. pe32 is of type
> grub_pe32_header and expects header at offset 0x80; but botomgfw.efi has
> header at offset 0xe0. See PE COFF specification. Code should fetch header
> address at fixed offset 0x3b.

You're right, we should check msdos header from offset 0x3c for looking up file
offset of pe header.

I was misguided by this comment in include/grub/efi/pe32.h so that I went
straight to ignore the msdos header. And it happened to work well with my
testing with xen.efi. :(

/* The MSDOS compatibility stub. This was copied from the output of
   objcopy, and it is not necessary to care about what this means.  */

I'm going to build a test package.


You are receiving this mail because: