Re: [PATCH 1/2] efi: libstub: Pass loaded image EFI handle to efi_load_initrd()

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

 



Hi Ard,

On Fri, Mar 10, 2023 at 09:45:28AM +0100, Ard Biesheuvel wrote:
> In preparation for allowing loaders to pass the initrd loadfile2
> protocol implementation via the loaded image handle instead of a global
> singleton device path, pass the loaded image EFI handle down to the code
> that loads the initrd.
>
> Signed-off-by: Ard Biesheuvel <ardb@xxxxxxxxxx>
> ---
>  drivers/firmware/efi/libstub/efi-stub-helper.c | 3 ++-
>  drivers/firmware/efi/libstub/efi-stub.c        | 4 ++--
>  drivers/firmware/efi/libstub/efistub.h         | 3 ++-
>  drivers/firmware/efi/libstub/x86-stub.c        | 4 ++--
>  4 files changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/firmware/efi/libstub/efi-stub-helper.c b/drivers/firmware/efi/libstub/efi-stub-helper.c
> index 1e0203d74691ffcc..d47aa855398b39a6 100644
> --- a/drivers/firmware/efi/libstub/efi-stub-helper.c
> +++ b/drivers/firmware/efi/libstub/efi-stub-helper.c
> @@ -554,7 +554,8 @@ efi_status_t efi_load_initrd_cmdline(efi_loaded_image_t *image,
>   *
>   * Return:	status code
>   */
> -efi_status_t efi_load_initrd(efi_loaded_image_t *image,
> +efi_status_t efi_load_initrd(efi_handle_t handle,
> +			     efi_loaded_image_t *image,
>  			     unsigned long soft_limit,
>  			     unsigned long hard_limit,
>  			     const struct linux_efi_initrd **out)
> diff --git a/drivers/firmware/efi/libstub/efi-stub.c b/drivers/firmware/efi/libstub/efi-stub.c
> index 2955c1ac6a36ee00..a5eb773a574143cf 100644
> --- a/drivers/firmware/efi/libstub/efi-stub.c
> +++ b/drivers/firmware/efi/libstub/efi-stub.c
> @@ -177,8 +177,8 @@ efi_status_t efi_stub_common(efi_handle_t handle,
>  	/* Ask the firmware to clear memory on unclean shutdown */
>  	efi_enable_reset_attack_mitigation();
>
> -	efi_load_initrd(image, ULONG_MAX, efi_get_max_initrd_addr(image_addr),
> -			NULL);
> +	efi_load_initrd(handle, image, ULONG_MAX,
> +			efi_get_max_initrd_addr(image_addr), NULL);
>
>  	efi_random_get_seed();
>
> diff --git a/drivers/firmware/efi/libstub/efistub.h b/drivers/firmware/efi/libstub/efistub.h
> index 6bd3bb86d9679a1c..8a77aeae9e2215a5 100644
> --- a/drivers/firmware/efi/libstub/efistub.h
> +++ b/drivers/firmware/efi/libstub/efistub.h
> @@ -1019,7 +1019,8 @@ static inline efi_status_t efi_load_dtb(efi_loaded_image_t *image,
>  				    ULONG_MAX, ULONG_MAX, load_addr, load_size);
>  }
>
> -efi_status_t efi_load_initrd(efi_loaded_image_t *image,
> +efi_status_t efi_load_initrd(efi_handle_t handle,
> +			     efi_loaded_image_t *image,
>  			     unsigned long soft_limit,
>  			     unsigned long hard_limit,
>  			     const struct linux_efi_initrd **out);
> diff --git a/drivers/firmware/efi/libstub/x86-stub.c b/drivers/firmware/efi/libstub/x86-stub.c
> index a0bfd31358ba97b1..e79f6977b41c15c2 100644
> --- a/drivers/firmware/efi/libstub/x86-stub.c
> +++ b/drivers/firmware/efi/libstub/x86-stub.c
> @@ -867,8 +867,8 @@ asmlinkage unsigned long efi_main(efi_handle_t handle,
>  	 * arguments will be processed only if image is not NULL, which will be
>  	 * the case only if we were loaded via the PE entry point.
>  	 */
> -	status = efi_load_initrd(image, hdr->initrd_addr_max, ULONG_MAX,
> -				 &initrd);
> +	status = efi_load_initrd(handle, image, hdr->initrd_addr_max,
> +				 ULONG_MAX, &initrd);
>  	if (status != EFI_SUCCESS)
>  		goto fail;
>  	if (initrd && initrd->size > 0) {
> --
> 2.39.2
>

Tested-by: Ilias Apalodimas <ilias.apalodimas@xxxxxxxxxx>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@xxxxxxxxxx>




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux