Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'efi-fixes-for-v6.11-1' of git://git.kernel.org/pub/scm/linux/kernel/git/efi/efi

Pull EFI fixes from Ard Biesheuvel:

- Wipe screen_info after allocating it from the heap - used by arm32
and EFI zboot, other EFI architectures allocate it statically

- Revert to allocating boot_params from the heap on x86 when entering
via the native PE entrypoint, to work around a regression on older
Dell hardware

* tag 'efi-fixes-for-v6.11-1' of git://git.kernel.org/pub/scm/linux/kernel/git/efi/efi:
x86/efistub: Revert to heap allocated boot_params for PE entrypoint
efi/libstub: Zero initialize heap allocated struct screen_info

+17 -5
+2
drivers/firmware/efi/libstub/screen_info.c
··· 32 32 if (status != EFI_SUCCESS) 33 33 return NULL; 34 34 35 + memset(si, 0, sizeof(*si)); 36 + 35 37 status = efi_bs_call(install_configuration_table, 36 38 &screen_info_guid, si); 37 39 if (status == EFI_SUCCESS)
+15 -5
drivers/firmware/efi/libstub/x86-stub.c
··· 534 534 efi_status_t __efiapi efi_pe_entry(efi_handle_t handle, 535 535 efi_system_table_t *sys_table_arg) 536 536 { 537 - static struct boot_params boot_params __page_aligned_bss; 538 - struct setup_header *hdr = &boot_params.hdr; 539 537 efi_guid_t proto = LOADED_IMAGE_PROTOCOL_GUID; 538 + struct boot_params *boot_params; 539 + struct setup_header *hdr; 540 540 int options_size = 0; 541 541 efi_status_t status; 542 + unsigned long alloc; 542 543 char *cmdline_ptr; 543 544 544 545 efi_system_table = sys_table_arg; ··· 554 553 efi_exit(handle, status); 555 554 } 556 555 556 + status = efi_allocate_pages(PARAM_SIZE, &alloc, ULONG_MAX); 557 + if (status != EFI_SUCCESS) 558 + efi_exit(handle, status); 559 + 560 + boot_params = memset((void *)alloc, 0x0, PARAM_SIZE); 561 + hdr = &boot_params->hdr; 562 + 557 563 /* Assign the setup_header fields that the kernel actually cares about */ 558 564 hdr->root_flags = 1; 559 565 hdr->vid_mode = 0xffff; ··· 570 562 571 563 /* Convert unicode cmdline to ascii */ 572 564 cmdline_ptr = efi_convert_cmdline(image, &options_size); 573 - if (!cmdline_ptr) 565 + if (!cmdline_ptr) { 566 + efi_free(PARAM_SIZE, alloc); 574 567 efi_exit(handle, EFI_OUT_OF_RESOURCES); 568 + } 575 569 576 570 efi_set_u64_split((unsigned long)cmdline_ptr, &hdr->cmd_line_ptr, 577 - &boot_params.ext_cmd_line_ptr); 571 + &boot_params->ext_cmd_line_ptr); 578 572 579 - efi_stub_entry(handle, sys_table_arg, &boot_params); 573 + efi_stub_entry(handle, sys_table_arg, boot_params); 580 574 /* not reached */ 581 575 } 582 576