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

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


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

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().

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




 


Rackspace

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