From: "Sascha Hauer" <s.hauer@pengutronix.de>
To: "Ahmad Fatoum" <a.fatoum@barebox.org>
Cc: barebox@lists.infradead.org, "Ahmad Fatoum" <a.fatoum@barebox.org>
Subject: Re: [PATCH] efi: allow LoadImage from a source buffer
Date: Fri, 10 Jul 2026 21:49:42 +0000 [thread overview]
Message-ID: <E1wiJ6M-0000000GID3-3Jzs@pty.whiteo.stw.pengutronix.de> (raw)
In-Reply-To: <20260709074335.533190-1-a.fatoum@barebox.org>
On 2026-07-09 09:43, Ahmad Fatoum wrote:
> LoadImage is allowed to load a PE image from a caller-provided source
> buffer when no device path is supplied. The SCT covers that path and
> barebox only handled filesystem-backed images, so valid test images were
> rejected before StartImage could run them.
>
> Add the source-buffer path and feed it through the normal image loader so
> the loaded image uses the same validation and bookkeeping as file-backed
> images.
>
> Assisted-by: Codex:gpt-5.5
> Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
> ---
> efi/loader/boot.c | 13 +++++++++----
> 1 file changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/efi/loader/boot.c b/efi/loader/boot.c
> index b92e6bb33093..d34de119f4e7 100644
> --- a/efi/loader/boot.c
> +++ b/efi/loader/boot.c
> @@ -1988,8 +1988,7 @@ efi_status_t EFIAPI efiloader_load_image(bool boot_policy,
> EFI_ENTRY("%d, %p, %pD, %p, %zu, %p", boot_policy, parent_image,
> file_path, source_buffer, source_size, image_handle);
>
> - if (!image_handle || (!source_buffer && !file_path) ||
> - !efi_search_obj(parent_image) ||
> + if (!image_handle || !efi_search_obj(parent_image) ||
> /* The parent image handle must refer to a loaded image */
> !parent_image->type) {
> ret = EFI_INVALID_PARAMETER;
> @@ -2005,8 +2004,14 @@ efi_status_t EFIAPI efiloader_load_image(bool boot_policy,
> } else {
> dest_buffer = source_buffer;
> }
> - /* split file_path which contains both the device and file parts */
> - ret = efi_dp_split_file_path(file_path, &dp, &fp);
> + if (file_path) {
> + /* split file_path which contains both the device and file parts */
> + ret = efi_dp_split_file_path(file_path, &dp, &fp);
> + } else {
> + dp = NULL;
> + fp = NULL;
> + ret = EFI_SUCCESS;
> + }
This hunk doesn't apply on my tree. Can you have a look?
Sascha
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
prev parent reply other threads:[~2026-07-10 21:50 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-09 7:43 Ahmad Fatoum
2026-07-10 21:49 ` Sascha Hauer [this message]
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=E1wiJ6M-0000000GID3-3Jzs@pty.whiteo.stw.pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=a.fatoum@barebox.org \
--cc=barebox@lists.infradead.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