From: Ilias Apalodimas <ilias.apalodimas@linaro.org>
To: Ard Biesheuvel <ardb@kernel.org>
Cc: linux-efi@vger.kernel.org, Michael Brown <mcb30@ipxe.org>
Subject: Re: [PATCH 1/2] efi: libstub: Pass loaded image EFI handle to efi_load_initrd()
Date: Mon, 13 Mar 2023 09:25:36 +0200 [thread overview]
Message-ID: <ZA7P8DdLaknIHQGR@hera> (raw)
In-Reply-To: <20230310084529.3229983-2-ardb@kernel.org>
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@kernel.org>
> ---
> 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@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
next prev parent reply other threads:[~2023-03-13 7:25 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-10 8:45 [PATCH 0/2] efi: Allow initrd LoadFile2 proto on loaded image Ard Biesheuvel
2023-03-10 8:45 ` [PATCH 1/2] efi: libstub: Pass loaded image EFI handle to efi_load_initrd() Ard Biesheuvel
2023-03-13 7:25 ` Ilias Apalodimas [this message]
2023-03-10 8:45 ` [PATCH 2/2] efi: libstub: Look for initrd LoadFile2 protocol on image handle Ard Biesheuvel
2023-03-13 8:11 ` Ilias Apalodimas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZA7P8DdLaknIHQGR@hera \
--to=ilias.apalodimas@linaro.org \
--cc=ardb@kernel.org \
--cc=linux-efi@vger.kernel.org \
--cc=mcb30@ipxe.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox