[PATCH v2 2/3] multiboot2: Add PE load support

2024-03-28 Thread Ross Lagerwall via Grub-devel
Add the ability to load multiboot binaries in PE format. This allows the binaries to be signed and verified. Signed-off-by: Ross Lagerwall --- grub-core/Makefile.core.def | 1 + grub-core/loader/multiboot.c | 7 + grub-core/loader/multiboot_mbi2.c | 11 +-

[PATCH v2 3/3] efi: Allow loading multiboot modules without verification

2024-03-28 Thread Ross Lagerwall via Grub-devel
GRUB doesn't do anything with multiboot modules except loading them and passing a pointer to the multiboot kernel. Therefore GRUB itself doesn't need to verify the module. Multiboot modules may contain code that needs to be verified. If this is the case, the expectation is that the multiboot

[PATCH v2 1/3] multiboot2: Add support for the PE binary type

2024-03-28 Thread Ross Lagerwall via Grub-devel
Currently, multiboot2-compatible bootloaders can load ELF binaries and a.out binaries. The presence of the address header tag determines how the bootloader tries to interpret the binary (a.out if the address tag is present else ELF). In addition to the existing address and ELF load types, specify

[PATCH v2 0/3] GRUB: Supporting Secure Boot of xen

2024-03-28 Thread Ross Lagerwall via Grub-devel
This patch series implements support for loading and verifying a signed xen binary. This would allow the same xen binary to be used for BIOS boot, UEFI boot, and UEFI boot with Secure Boot verification. There is an accompanying Xen patch series. The first patch updates the multiboot2

Re: [PATCH 2/7] multiboot2: Allow 64-bit entry tags

2024-03-28 Thread Ross Lagerwall via Grub-devel
On Tue, Mar 19, 2024 at 10:07 AM Roger Pau Monné wrote: > > On Wed, Mar 13, 2024 at 03:07:43PM +, Ross Lagerwall wrote: > > Binaries may be built with entry points above 4G. While bootloaders may > > relocate them below 4G, it should be possible for the binary to specify > > those entry

Re: [PATCH 3/7] multiboot2: Add support for the load type header tag

2024-03-28 Thread Ross Lagerwall via Grub-devel
On Fri, Mar 15, 2024 at 7:31 AM Vladimir 'phcoder' Serbinenko wrote: > > Not a full review. Just one blocking problem > >> >> >> } >> + case MULTIBOOT_LOAD_TYPE_PE: >> + grub_fatal ("Unsupported load type: %u\n", mld.load_type); >> + default: >> +/* should be impossible */ >> +

Re: [PATCH 7/7] verifiers: Verify after decompression

2024-03-28 Thread Ross Lagerwall via Grub-devel
On Fri, Mar 15, 2024 at 7:26 AM Vladimir 'phcoder' Serbinenko wrote: > > Verifying after decompression is a bad security practice. It relies on > decompression having no security holes. Given how complex decompression is, > this is almost guaranteed to be false. > Point taken... I'll drop this

Re: [PATCH 1/7] multiboot2: Add load type header and support for the PE binary type

2024-03-19 Thread Ross Lagerwall via Grub-devel
On Tue, Mar 19, 2024 at 1:18 PM Roger Pau Monné wrote: > > On Wed, Mar 13, 2024 at 03:07:42PM +, Ross Lagerwall wrote: > > Currently, multiboot2-compatible bootloaders can load ELF binaries and > > a.out binaries. The presence of the address header tag determines > > how the bootloader tries

Re: [PATCH 1/7] multiboot2: Add load type header and support for the PE binary type

2024-03-14 Thread Ross Lagerwall via Grub-devel
On Thu, Mar 14, 2024 at 1:37 PM Jan Beulich wrote: > > On 14.03.2024 10:30, Ross Lagerwall wrote: > > On Thu, Mar 14, 2024 at 7:24 AM Jan Beulich wrote: > >> > >> On 13.03.2024 16:07, Ross Lagerwall wrote: > >>> In addition to the existing address and ELF load types, specify a new > >>> optional

Re: [PATCH 1/7] multiboot2: Add load type header and support for the PE binary type

2024-03-14 Thread Ross Lagerwall via Grub-devel
On Thu, Mar 14, 2024 at 7:24 AM Jan Beulich wrote: > > On 13.03.2024 16:07, Ross Lagerwall wrote: > > In addition to the existing address and ELF load types, specify a new > > optional PE binary load type. This new type is a useful addition since > > PE binaries can be signed and verified (i.e.

[PATCH 2/7] multiboot2: Allow 64-bit entry tags

2024-03-13 Thread Ross Lagerwall via Grub-devel
Binaries may be built with entry points above 4G. While bootloaders may relocate them below 4G, it should be possible for the binary to specify those entry points. Therefore, extend the multiboot2 protocol such that 64 bit addresses are allowed for entry points. The extension is done in a

[PATCH 1/7] multiboot2: Add load type header and support for the PE binary type

2024-03-13 Thread Ross Lagerwall via Grub-devel
Currently, multiboot2-compatible bootloaders can load ELF binaries and a.out binaries. The presence of the address header tag determines how the bootloader tries to interpret the binary (a.out if the address tag is present else ELF). Add a new load type header tag that explicitly states the type

[PATCH 3/7] multiboot2: Add support for the load type header tag

2024-03-13 Thread Ross Lagerwall via Grub-devel
The binary may expose its type using the load type header tag. Implement it according to the specification. Signed-off-by: Ross Lagerwall --- grub-core/loader/multiboot_mbi2.c | 45 --- include/grub/multiboot2.h | 1 + include/multiboot2.h | 13

[PATCH 7/7] verifiers: Verify after decompression

2024-03-13 Thread Ross Lagerwall via Grub-devel
It is convenient and common to have binaries stored in gzip archives (e.g. xen.gz). Verification should be run after decompression rather than before so reorder the file filter list as appropriate. Signed-off-by: Ross Lagerwall --- include/grub/file.h | 2 +- 1 file changed, 1 insertion(+), 1

[PATCH 5/7] multiboot2: Add support for 64-bit entry addresses

2024-03-13 Thread Ross Lagerwall via Grub-devel
Add support for entry addresses that may be either 32 bits or 64 bits in size. This may be necessary if the binary is built with an entry address above 4G. Signed-off-by: Ross Lagerwall --- grub-core/loader/multiboot_mbi2.c | 10 -- include/multiboot2.h | 6 +- 2 files

[PATCH 6/7] efi: Allow loading multiboot modules without verification

2024-03-13 Thread Ross Lagerwall via Grub-devel
GRUB doesn't do anything with multiboot modules except loading them and passing a pointer to the multiboot kernel. Therefore GRUB itself doesn't need to verify the module. Multiboot modules may contain code that needs to be verified. If this is the case, the expectation is that the multiboot

[PATCH 4/7] multiboot2: Add PE load support

2024-03-13 Thread Ross Lagerwall via Grub-devel
Add the ability to load multiboot binaries in PE format. This allows the binaries to be signed and verified. Signed-off-by: Ross Lagerwall --- grub-core/Makefile.core.def | 1 + grub-core/loader/multiboot_mbi2.c | 15 +- grub-core/loader/multiboot_pe.c | 694

[PATCH 0/7] GRUB: Supporting Secure Boot of xen.gz

2024-03-13 Thread Ross Lagerwall via Grub-devel
This patch series implements support for loading and verifying a signed xen.gz binary. This would allow the same xen.gz binary to be used for BIOS boot, UEFI boot, and UEFI boot with Secure Boot verification. There is an accompanying Xen patch series. The first two patches update the multiboot2