]> xenbits.xensource.com Git - xen.git/commit
x86/EFI: correct mkreloc header (field) reading
authorJan Beulich <jbeulich@suse.com>
Wed, 23 Apr 2025 07:39:44 +0000 (09:39 +0200)
committerJan Beulich <jbeulich@suse.com>
Wed, 23 Apr 2025 07:39:44 +0000 (09:39 +0200)
commit042e9616f2e67476635487f2cd530406c6e3c0c1
tree9745318893ce7c4810e90fa345bb42f107dbe74a
parent920cc4e65e9ea15676c2326656674c9e212e55fe
x86/EFI: correct mkreloc header (field) reading

With us now reading the full combined optional and NT headers, the
subsequent reading of (and seeking to) NT header fields is wrong. Since
PE32 and PE32+ NT headers are different anyway (beyond the image base
oddity extending across both headers), switch to using a union. This
allows to fetch the image base more directly then.

Additionally add checking to map_section(), which would have caught at
least the wrong (zero) image size that we previously used.

Fixes: f7f42accbbbb ("x86/efi: Use generic PE/COFF structures")
Reported-by: Roger Pau Monné <roger.pau@citrix.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Daniel P. Smith <dpsmith@apertussolutions.com>
xen/arch/x86/efi/mkreloc.c