]> git.ipfire.org Git - thirdparty/grub.git/commit
loader/arm64/linux: Account for COFF headers appearing at unexpected offsets
authorArd Biesheuvel <ardb@kernel.org>
Tue, 18 Oct 2022 19:05:04 +0000 (21:05 +0200)
committerDaniel Kiper <daniel.kiper@oracle.com>
Thu, 27 Oct 2022 15:19:10 +0000 (17:19 +0200)
commit12edfe42212af738f6e2f4aa733b690f26a43039
treedece84119f2dc06d25039538dbb0b6c9efed5fd8
parentb040285628c31d4951d54f061731f3971c6e73e5
loader/arm64/linux: Account for COFF headers appearing at unexpected offsets

The way we load the Linux and PE/COFF image headers depends on a fixed
placement of the COFF header at offset 0x40 into the file. This is
a reasonable default, given that this is where Linux emits it today.
However, in order to comply with the PE/COFF spec, which allows this
header to appear anywhere in the file, let's ensure that we read the
header from where it actually appears in the file if it is not located
at offset 0x40.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
grub-core/loader/arm64/linux.c