[PATCH 0/2] kernel-stub: correctly handle if boot part UUID cannot be resolved

6 views
Skip to first unread message

Felix Moessbauer

unread,
May 14, 2025, 4:53:24 AMMay 14
to efibootg...@googlegroups.com, Felix Moessbauer
Hi,

we got reports from the field stating that the boot failed because the
efi variables could not be set and we bail out in this case. Handling this
gracefully is fixed in this series.

Notes on testing: I was only able to test the "good" path. Testing the
bad path is tricky as I don't have an EFI implementation at hand that does
not support getting the boot part UUID.

Best regards,
Felix

Felix Moessbauer (2):
kernel-stub: only warn if device part uuid variable cannot be set
kernel-stub: fix nullptr deref on error getting boot part UUID

main.c | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)

--
2.49.0

Felix Moessbauer

unread,
May 14, 2025, 7:15:28 AMMay 14
to efibootg...@googlegroups.com, Felix Moessbauer, Jan Kiszka
We got reports from the field stating that the boot failed because the
efi variables could not be set and we bail out in this case. As the
systemd boot protocol is not a mandatory feature, we can safely ignore
this case. This is in line with the implementation in systemd-boot.

We now change the bail-out to an error message without bail-out.

Fixes: 7c90e82 ("efi: implement systemd boot loader interface")
Reported-by: Jan Kiszka <jan.k...@siemens.com>
Signed-off-by: Felix Moessbauer <felix.mo...@siemens.com>
---
main.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/main.c b/main.c
index 3885754..77475cb 100644
--- a/main.c
+++ b/main.c
@@ -192,8 +192,8 @@ EFI_STATUS efi_main(EFI_HANDLE image_handle, EFI_SYSTEM_TABLE *system_table)
bg_interface_params.loader_device_part_uuid = boot_medium_uuidstr;
status = set_bg_interface_vars(&bg_interface_params);
if (EFI_ERROR(status)) {
- error_exit(L"Cannot set bootloader interface variables",
- status);
+ WARNING(L"Cannot set bootloader interface variables (%r)\n",
+ status);
}
INFO(L"LoaderDevicePartUUID=%s\n", boot_medium_uuidstr);
FreePool(boot_medium_uuidstr);
--
2.49.0

Felix Moessbauer

unread,
May 14, 2025, 7:15:28 AMMay 14
to efibootg...@googlegroups.com, Felix Moessbauer
Hi,

we got reports from the field stating that the boot failed because the
efi variables could not be set and we bail out in this case. Handling this
gracefully is fixed in this series.

Notes on testing: I was only able to test the "good" path. Testing the
bad path is tricky as I don't have an EFI implementation at hand that does
not support getting the boot part UUID.

Changes since v1:

- log messages as warning instead of error

Jan Kiszka

unread,
May 15, 2025, 4:02:38 AMMay 15
to Felix Moessbauer, efibootg...@googlegroups.com
Thanks, applied.

I was briefly wondering if the second fix this could also be security
relevant, but we would be consistently crashing due to strlen(NULL).

Jan

--
Siemens AG, Foundational Technologies
Linux Expert Center
Reply all
Reply to author
Forward
0 new messages