[PATCH] multiboot: Add support for program headers at "strange" locations

2020-05-23 Thread Jacob Paul via Grub-devel
Currently, grub_multiboot_load_elf() will throw an error if the program header is at a too high offset (since it would be outside the allocated buffer space of MULTIBOOT_SEARCH bytes). It is understandable why it does this, since 99.99% of all cases e_phoff has a value of 0x34 or 0x40. So, to b

Multiboot 2 Header Alignment: implementation contradicts specification

2020-05-23 Thread Jacob Paul via Grub-devel
The Multiboot2 specification specifies that the Multiboot2 header should be 8-byte (64-bit) aligned: >An OS image must contain an additional header called Multiboot2 header, >besides the headers of the format used by the OS image. The Multiboot2 >header must be contained completely within the firs

Re: Multiboot 2 Header Alignment: implementation contradicts specification

2020-05-23 Thread Jacob Paul via Grub-devel
On 2020-05-23 20:33, Hans Ulrich Niedermann wrote: The comment is valid for MB1, but not for MB2. Both regarding the alignment and regarding the size. And regarding the size, this actually means there is a bug in the code here: An MB2 header is at least 16 bytes for the header magic plus at least

[PATCH v2] multiboot: Add support for program headers at "strange" locations

2020-05-25 Thread Jacob Paul via Grub-devel
Currently, grub_multiboot_load_elf() will throw an error if the program header is at a too high offset (since it would be outside the allocated buffer space of MULTIBOOT_SEARCH bytes). It is understandable why it does this, since 99.99% of all cases e_phoff has a value of 0x34 or 0x40. So, to be