Commit e9b7c3a4 authored by Mihai Carabas's avatar Mihai Carabas Committed by Ard Biesheuvel
Browse files

efi/libstub: arm64: Fix image check alignment at entry



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 this message started to appear
even though the loader is taking into account the PE header (which is stating
SEGMENT_ALIGN).

Fixes: c32ac11d ("efi/libstub: arm64: Double check image alignment at entry")
Signed-off-by: default avatarMihai Carabas <mihai.carabas@oracle.com>
Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
parent e783362e
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -119,9 +119,9 @@ efi_status_t handle_kernel_image(unsigned long *image_addr,
	if (image->image_base != _text)
		efi_err("FIRMWARE BUG: efi_loaded_image_t::image_base has bogus value\n");

	if (!IS_ALIGNED((u64)_text, EFI_KIMG_ALIGN))
		efi_err("FIRMWARE BUG: kernel image not aligned on %ldk boundary\n",
			EFI_KIMG_ALIGN >> 10);
	if (!IS_ALIGNED((u64)_text, SEGMENT_ALIGN))
		efi_err("FIRMWARE BUG: kernel image not aligned on %dk boundary\n",
			SEGMENT_ALIGN >> 10);

	kernel_size = _edata - _text;
	kernel_memsize = kernel_size + (_end - _edata);