Re: [PATCH v2 00/15] x86/boot: Rework PE header generation

From: Ard Biesheuvel
Date: Fri Sep 15 2023 - 09:28:50 EST


On Fri, 15 Sept 2023 at 15:21, Ard Biesheuvel <ardb@xxxxxxxxxx> wrote:
>
> On Fri, Sep 15, 2023 at 1:31 PM Ingo Molnar <mingo@xxxxxxxxxx> wrote:
> >
> >
> > * Ingo Molnar <mingo@xxxxxxxxxx> wrote:
> >
> > > > Ard Biesheuvel (15):
> > > > x86/efi: Drop EFI stub .bss from .data section
> > > > x86/efi: Disregard setup header of loaded image
> > > > x86/efi: Drop alignment flags from PE section headers
> > > > x86/boot: Remove the 'bugger off' message
> > > > x86/boot: Omit compression buffer from PE/COFF image memory footprint
> > > > x86/boot: Drop redundant code setting the root device
> > > > x86/boot: Grab kernel_info offset from zoffset header directly
> > > > x86/boot: Drop references to startup_64
> > >
> > > I've applied these first 8 patches to tip:x86/boot with minor edits.
>
> Thanks.
>
> > > (Please preserve existing comment capitalization conventions ...)
> > >
>
> Ack
>
> > > > x86/boot: Set EFI handover offset directly in header asm
> > > > x86/boot: Define setup size in linker script
> > > > x86/boot: Derive file size from _edata symbol
> > > > x86/boot: Construct PE/COFF .text section from assembler
> > > > x86/boot: Drop PE/COFF .reloc section
> > > > x86/boot: Split off PE/COFF .data section
> > > > x86/boot: Increase section and file alignment to 4k/512
> > >
> > > The rest conflicted with recent upstream changes, and I suppose it's
> > > prudent to test these changes bit by bit anyway.
> >
>
> Agreed. So you mean this conflicts with other stuff queued up in -tip
> already, right?
>
> > So, the first 8 patches broke the x86-64-defconfig-ish Qemu bzImage bootup,
> > due to the 8th patch:
> >
> > 988b52b207a9fe74c3699bda8c2256714926b94b is the first bad commit
> > commit 988b52b207a9fe74c3699bda8c2256714926b94b
> > Author: Ard Biesheuvel <ardb@xxxxxxxxxx>
> > Date: Tue Sep 12 09:01:01 2023 +0000
> >
> > x86/boot: Define setup size in linker script
> >
> > I've removed it for now - but this side effect was not expected.
> >
>
> No, definitely not expected. I tested various combinations of i386 /
> x86_64 built with GCC / Clang doing EFI or BIOS boot.
>
> I'll rebase the remaining stuff onto -tip and see if I can reproduce this.

This is actually quite bizarre. x86_64_defconfig has
CONFIG_EFI_MIXED=y and i tested that this change produces the exact
same bzImage binary in that case.

Could you send me the .config and the QEMU command line perhaps?