On Thu, Apr 25, 2024 at 09:10:08PM +0100, Alex Bennée wrote:
> Alex Bennée <alex.ben...@linaro.org> writes:
> 
> > Julian Andres Klode <julian.kl...@canonical.com> writes:
> >
> >> On Thu, Apr 25, 2024 at 06:30:52PM +0100, Alex Bennée wrote:
> >>> 
> >>> Continuing to debug on QEMU it seems there is an incompatibility with
> >>> the images and the peloader (which overrides the normal efi loader):
> >>> 
> <snip>
> >
> >> In the error case you can see though, that one of the section
> >> addresses in the Xen binary to be relocated points into the (PE)
> >> header of the binary, which obviously seems wrong.
> >>
> >> So go check your PE sections and check which one is wrong?
> >
> > Is there any tooling for examining PE sections?
> 
> Nothing really jumps out from objdump:
> 
> 1:08:50 [root@debian-arm64:~] # objdump -h /boot/xen
> 
>   /boot/xen:     file format pei-aarch64-little
> 
>   Sections:
>   Idx Name          Size      VMA               LMA               File off  
> Algn
>     0 .reloc        00000000  0000000000000000  0000000000000000  00000000  
> 2**0
>                     ALLOC, LOAD, READONLY, DATA


This looks suspicious. Yes it's 0 size but it's address is 0 which
clearly points into the header, and we don't skip 0 size sections when
loading the PE binary for later relocation, and we don't use any .reloc
section.


>     1 .text         00107ea8  0000000000000160  0000000000000160  00000160  
> 2**4
>                     CONTENTS, ALLOC, LOAD, CODE
>   21:08:53 [root@debian-arm64:~] # objdump -h /boot/vmlinuz


I suppose the header is smaller than 0x160 bytes and this is ok.

My colleague Heinrich has written a nice PE analyser tool too:

https://github.com/xypron/efi_analyzer


-- 
debian developer - deb.li/jak | jak-linux.org - free software dev
ubuntu core developer                              i speak de, en

Reply via email to