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

Re: [PATCH for-4.22] EFI: Fix boot from a device without a file system


  • To: Szymon Acedański <accek@xxxxxxxxxxxxxxxxxxxxxx>
  • From: Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>
  • Date: Tue, 19 May 2026 15:41:28 +0200
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=fm3 header.d=invisiblethingslab.com header.i="@invisiblethingslab.com" header.h="Cc:Content-Type:Date:From:In-Reply-To:Message-ID:MIME-Version:References:Subject:To"; dkim=pass header.s=fm3 header.d=messagingengine.com header.i="@messagingengine.com" header.h="Cc:Content-Type:Date:Feedback-ID:From:In-Reply-To:Message-ID:MIME-Version:References:Subject:To:X-ME-Proxy:X-ME-Sender"
  • Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx, "Daniel P. Smith" <dpsmith@xxxxxxxxxxxxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>
  • Delivery-date: Tue, 19 May 2026 13:41:37 +0000
  • Feedback-id: i1568416f:Fastmail
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Tue, May 19, 2026 at 03:06:57PM +0200, Szymon Acedański wrote:
> When netbooting a unified Xen kernel image (via GRUB chainloader),
> the resulting loaded_image->DeviceHandle does not support
> SIMPLE_FILE_SYSTEM_PROTOCOL.
> 
> Instead of crashing via noreturn PrintErrMesg(), print a message
> via PrintStr() and return NULL from get_parent_handle().

It's worth noting this isn't the first instance of returning NULL from
get_parent_handle(). The return value is used only as an argument
to read_file() (sometimes indirectly), and if it gets to be called with
NULL, read_file() will terminate execution via PrintErrMesg(). But with
unified Xen image, the intention is to not call read_file() at all, only
read_section(), so tolerating get_parent_handle() failure in this case
is desired. Keeping the message in place will ease debugging if
read_file() will actually be called later.

Acked-by: Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>

As a side note, a slightly better approach would be to call
get_parent_handle() lazily (on the first call to read_file()?). But it's
a bigger change that I feel may be too late for in Xen 4.22.

Also, adding cc: Oleksii for release ack.

> Signed-off-by: Szymon Acedański <accek@xxxxxxxxxxxxxxxxxxxxxx>
> ---
> Tested on Intel Lunar Lake laptop via PXE-loaded GRUB chainloading
> the unified image including Xen built from upstream staging. Without
> the patch the boot aborts with:
> 
>   Couldn't obtain the File System Protocol Interface: ErrCode: 
> 0x8000000000000003
> 
> (EFI_UNSUPPORTED, per UEFI spec Appendix D). With the patch, dom0
> reaches login.
> 
>  xen/common/efi/boot.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c
> index 9ea2183c0b..a6c3c371c6 100644
> --- a/xen/common/efi/boot.c
> +++ b/xen/common/efi/boot.c
> @@ -471,6 +471,15 @@ static EFI_FILE_HANDLE __init get_parent_handle(const 
> EFI_LOADED_IMAGE *loaded_i
>          /* Get the file system interface. */
>          ret = efi_bs->HandleProtocol(loaded_image->DeviceHandle,
>                                       &fs_protocol, (void **)&fio);
> +        if ( ret == EFI_UNSUPPORTED )
> +        {
> +            /*
> +             * The image could come from a device without a file system,
> +             * for example it could be a netbooted unified Xen kernel image.
> +             */
> +            PrintStr(L"File System Protocol not supported on boot 
> device\r\n");
> +            return NULL;
> +        }
>          if ( EFI_ERROR(ret) )
>              PrintErrMesg(L"Couldn't obtain the File System Protocol 
> Interface",
>                           ret);
> -- 
> 2.53.0
> 

-- 
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab

Attachment: signature.asc
Description: PGP signature


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.