Skip to contentSkip to conversation

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

PATCH Superseded Szymon Acedański 4 participants 4 messages Jun 2

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

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

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.

---
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(-)
xen/common/efi/boot.c +2 -1
index 2971ea8696..8f24df9bc2 100644
@@ -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,
Signature · 1 line
2.53.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · Szymon Acedański

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.

While Linux uses Link:, as per sending-patches.pandoc we don't. It wants to be Reported-by: instead, and there wants to be a Fixes: tag.

Quoted 1 line

With the above properly sorted:

Jan

#2 lore raw
Quoted 10 lines · Jan Beulich
Quoted 9 lines · Szymon Acedański

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.

Quoted 7 lines
Quoted 1 line

While Linux uses Link:, as per sending-patches.pandoc we don't. It wants to be Reported-by: instead, and there wants to be a Fixes: tag.

Quoted 1 line

With the above properly sorted:

CC Oleksi.  We're past RC1 now, so everything needs release acks.

~Andrew

#3 lore raw
Quoted 12 lines · Andrew Cooper
Quoted 11 lines · Jan Beulich
Quoted 10 lines · Szymon Acedański

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.

Quoted 8 lines
Quoted 6 lines

While Linux uses Link:, as per sending-patches.pandoc we don't. It wants to be Reported-by: instead, and there wants to be a Fixes: tag.

Quoted 1 line

With the above properly sorted:

CC Oleksi.  We're past RC1 now, so everything needs release acks.

Thanks.

~ Oleksii