* efi/libstub: arm64: Double check image alignment at entry - checked against EFI_KIMG_ALIGN or SEGMENT_ALIGN
@ 2022-01-14 7:29 Mihai Carabas
2022-01-14 7:52 ` Ard Biesheuvel
0 siblings, 1 reply; 2+ messages in thread
From: Mihai Carabas @ 2022-01-14 7:29 UTC (permalink / raw)
To: ardb; +Cc: stable, benh, Karl Heubaum
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?
Thank you,
Mihai
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: efi/libstub: arm64: Double check image alignment at entry - checked against EFI_KIMG_ALIGN or SEGMENT_ALIGN
2022-01-14 7:29 efi/libstub: arm64: Double check image alignment at entry - checked against EFI_KIMG_ALIGN or SEGMENT_ALIGN Mihai Carabas
@ 2022-01-14 7:52 ` Ard Biesheuvel
0 siblings, 0 replies; 2+ messages in thread
From: Ard Biesheuvel @ 2022-01-14 7:52 UTC (permalink / raw)
To: Mihai Carabas; +Cc: # 3.4.x, Benjamin Herrenschmidt, Karl Heubaum
On Fri, 14 Jan 2022 at 08:29, Mihai Carabas <mihai.carabas@oracle.com> 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.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-01-14 7:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-14 7:29 efi/libstub: arm64: Double check image alignment at entry - checked against EFI_KIMG_ALIGN or SEGMENT_ALIGN Mihai Carabas
2022-01-14 7:52 ` Ard Biesheuvel
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.