Re: efi/libstub: arm64: Double check image alignment at entry - checked against EFI_KIMG_ALIGN or SEGMENT_ALIGN

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 14 Jan 2022 at 08:29, Mihai Carabas <mihai.carabas@xxxxxxxxxx> wrote:
>
> Hello Ard,
>
> In patch 'efi/libstub: arm64: Double check image alignment at entry'
> (c32ac11da3f83bb42b986702a9b92f0a14ed4182) you added the following check:
>
> if (!IS_ALIGNED((u64)_text, EFI_KIMG_ALIGN))
>      efi_err("FIRMWARE BUG: kernel image not aligned on %ldk boundary\n", +
> EFI_KIMG_ALIGN >> 10);
>
> Unfortunatelly the kernel is aligned at SEGMENT_SIZE and this is the size
> populated in the PE headers:
>
> arch/arm64/kernel/efi-header.S: .long   SEGMENT_ALIGN
> // SectionAlignment
>
> EFI_KIMG_ALIGN is defined as: (SEGMENT_ALIGN > THREAD_ALIGN ? SEGMENT_ALIGN
> : THREAD_ALIGN)
>
> So it depends on THREAD_ALIGN. On newer builds these message started to
> appear even though the loader (Grub) is taking into account the PE header
> (which is stating 64K).
>
> Did you want to also modify the alignment in the headers/linkers or may be
> check against SEGMENT_ALIGN?
>

Thanks for the report.

I missed that 64k pages kernels will need more alignment than what
they describe in the PE/COFF header. 64k is the maximum here so we
should check against SEGMENT_ALIGN not EFI_KIMG_ALIGN for the warning.



[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux