Re: [PATCH] efi: allow LoadImage from a source buffer
"Sascha Hauer" <[email protected]> Fri, 10 Jul 2026 21:49:42 +0000
| Newsgroups | org.infradead.lists.barebox |
|---|---|
| Message-ID | <[email protected]> |
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. >=20 > 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. >=20 > Assisted-by: Codex:gpt-5.5 > Signed-off-by: Ahmad Fatoum <[email protected]> > --- > efi/loader/boot.c | 13 +++++++++---- > 1 file changed, 9 insertions(+), 4 deletions(-) >=20 > 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); > =20 > - 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 =3D EFI_INVALID_PARAMETER; > @@ -2005,8 +2004,14 @@ efi_status_t EFIAPI efiloader_load_image(bool boot= _policy, > } else { > dest_buffer =3D source_buffer; > } > - /* split file_path which contains both the device and file parts */ > - ret =3D efi_dp_split_file_path(file_path, &dp, &fp); > + if (file_path) { > + /* split file_path which contains both the device and file parts */ > + ret =3D efi_dp_split_file_path(file_path, &dp, &fp); > + } else { > + dp =3D NULL; > + fp =3D NULL; > + ret =3D 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 |