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

[PATCH] xen/efi: Use blexit() instead of BUG_ON() in read_file()


  • To: xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Szymon Acedański <accek@xxxxxxxxxxxxxxxxxxxxxx>
  • Date: Tue, 2 Jun 2026 14:24:41 +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=fm1 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, 02 Jun 2026 12:25:19 +0000
  • Feedback-id: i792e4853:Fastmail
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Follow-up to 880e40b187aa ("xen/efi: Fix boot from a device without
a file system"), which added a BUG_ON() guard in read_file().

But as Jan pointed out, before ExitBootServices BUG_ON()
is not functional. It results in a hang with no message.

On the other hand blexit() prints a message and returns back
to the bootloader.

Link: 
https://lore.kernel.org/xen-devel/bb0f007e-697e-4501-97ea-3b59cf494ec6@xxxxxxxx/T/#m4725c8cbc0946a5533aea03fc240267ef139648d
Signed-off-by: Szymon Acedański <accek@xxxxxxxxxxxxxxxxxxxxxx>
---
blexit() has been chosen over PrintErrMesg(), as the latter
is predominantly used in cases where an EFI call fails
(and it prints the status).

 xen/common/efi/boot.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c
index 2971ea8696..8f24df9bc2 100644
--- a/xen/common/efi/boot.c
+++ b/xen/common/efi/boot.c
@@ -849,7 +849,8 @@ static bool __init read_file(EFI_FILE_HANDLE dir_handle, 
CHAR16 *name,
     if ( !name )
         PrintErrMesg(L"No filename", EFI_OUT_OF_RESOURCES);
 
-    BUG_ON(!dir_handle);
+    if ( !dir_handle )
+        blexit(L"BUG: !dir_handle in read_file()");
 
     what = L"Open";
     ret = dir_handle->Open(dir_handle, &FileHandle, name,
-- 
2.53.0




 


Rackspace

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