* [PATCH v2] xen/efi: Use blexit() instead of BUG_ON() in read_file()
@ 2026-06-02 13:17 Szymon Acedański
2026-06-02 14:06 ` Marek Marczykowski-Górecki
2026-06-02 15:18 ` Oleksii Kurochko
0 siblings, 2 replies; 3+ messages in thread
From: Szymon Acedański @ 2026-06-02 13:17 UTC (permalink / raw)
To: xen-devel
Cc: Oleksii Kurochko, Szymon Acedański, Jan Beulich,
Daniel P. Smith, Marek Marczykowski-Górecki
Follow-up to 880e40b187aa, 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.
Fixes: 880e40b187aa ("xen/efi: Fix boot from a device without a file system")
Reported-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Szymon Acedański <accek@invisiblethingslab.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
Changes in v2:
- Drop the Link: tag; use Reported-by: and Fixes: instead. (Jan)
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 2971ea8696d1..8f24df9bc23a 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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] xen/efi: Use blexit() instead of BUG_ON() in read_file()
2026-06-02 13:17 [PATCH v2] xen/efi: Use blexit() instead of BUG_ON() in read_file() Szymon Acedański
@ 2026-06-02 14:06 ` Marek Marczykowski-Górecki
2026-06-02 15:18 ` Oleksii Kurochko
1 sibling, 0 replies; 3+ messages in thread
From: Marek Marczykowski-Górecki @ 2026-06-02 14:06 UTC (permalink / raw)
To: Szymon Acedański
Cc: xen-devel, Oleksii Kurochko, Jan Beulich, Daniel P. Smith
[-- Attachment #1: Type: text/plain, Size: 1676 bytes --]
On Tue, Jun 02, 2026 at 03:17:37PM +0200, Szymon Acedański wrote:
> Follow-up to 880e40b187aa, 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.
>
> Fixes: 880e40b187aa ("xen/efi: Fix boot from a device without a file system")
> Reported-by: Jan Beulich <jbeulich@suse.com>
> Signed-off-by: Szymon Acedański <accek@invisiblethingslab.com>
> Reviewed-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
> ---
> Changes in v2:
> - Drop the Link: tag; use Reported-by: and Fixes: instead. (Jan)
>
> 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 2971ea8696d1..8f24df9bc23a 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
>
>
--
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] xen/efi: Use blexit() instead of BUG_ON() in read_file()
2026-06-02 13:17 [PATCH v2] xen/efi: Use blexit() instead of BUG_ON() in read_file() Szymon Acedański
2026-06-02 14:06 ` Marek Marczykowski-Górecki
@ 2026-06-02 15:18 ` Oleksii Kurochko
1 sibling, 0 replies; 3+ messages in thread
From: Oleksii Kurochko @ 2026-06-02 15:18 UTC (permalink / raw)
To: Szymon Acedański, xen-devel
Cc: Jan Beulich, Daniel P. Smith, Marek Marczykowski-Górecki
On 6/2/26 3:17 PM, Szymon Acedański wrote:
> Follow-up to 880e40b187aa, 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.
>
> Fixes: 880e40b187aa ("xen/efi: Fix boot from a device without a file system")
> Reported-by: Jan Beulich <jbeulich@suse.com>
> Signed-off-by: Szymon Acedański <accek@invisiblethingslab.com>
> Reviewed-by: Jan Beulich <jbeulich@suse.com>
Release-Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
Thanks.
~ Oleksii
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-06-02 15:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-02 13:17 [PATCH v2] xen/efi: Use blexit() instead of BUG_ON() in read_file() Szymon Acedański
2026-06-02 14:06 ` Marek Marczykowski-Górecki
2026-06-02 15:18 ` Oleksii Kurochko
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.