mirror of
https://xff.cz/git/u-boot/
synced 2025-09-03 17:52:07 +02:00
efi_loader: Fix loaded image alignment
We are ignoring the alignment communicated via the PE/COFF header. Starting 5.10 the Linux kernel will loudly complain about it. For more details look at [1] (in linux kernel). So add a function that can allocate aligned EFI memory and use it for our relocated loaded image. [1] c32ac11da3f83 ("efi/libstub: arm64: Double check image alignment at entry") Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Tested-by: Vincent Stehlé <vincent.stehle@arm.com> Acked-by: Ard Biesheuvel <ardb@kernel.org> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
This commit is contained in:
committed by
Heinrich Schuchardt
parent
fa00b6fc3f
commit
ebdea88d57
@@ -898,9 +898,9 @@ efi_status_t efi_load_pe(struct efi_loaded_image_obj *handle,
|
||||
image_base = opt->ImageBase;
|
||||
efi_set_code_and_data_type(loaded_image_info, opt->Subsystem);
|
||||
handle->image_type = opt->Subsystem;
|
||||
virt_size = ALIGN(virt_size, opt->SectionAlignment);
|
||||
efi_reloc = efi_alloc(virt_size,
|
||||
loaded_image_info->image_code_type);
|
||||
efi_reloc = efi_alloc_aligned_pages(virt_size,
|
||||
loaded_image_info->image_code_type,
|
||||
opt->SectionAlignment);
|
||||
if (!efi_reloc) {
|
||||
log_err("Out of memory\n");
|
||||
ret = EFI_OUT_OF_RESOURCES;
|
||||
@@ -914,9 +914,9 @@ efi_status_t efi_load_pe(struct efi_loaded_image_obj *handle,
|
||||
image_base = opt->ImageBase;
|
||||
efi_set_code_and_data_type(loaded_image_info, opt->Subsystem);
|
||||
handle->image_type = opt->Subsystem;
|
||||
virt_size = ALIGN(virt_size, opt->SectionAlignment);
|
||||
efi_reloc = efi_alloc(virt_size,
|
||||
loaded_image_info->image_code_type);
|
||||
efi_reloc = efi_alloc_aligned_pages(virt_size,
|
||||
loaded_image_info->image_code_type,
|
||||
opt->SectionAlignment);
|
||||
if (!efi_reloc) {
|
||||
log_err("Out of memory\n");
|
||||
ret = EFI_OUT_OF_RESOURCES;
|
||||
|
Reference in New Issue
Block a user