Skip to content

Conversation

@ericcurtin
Copy link
Member

When using the efi feature on aarch64 with ExternalKernel payload (direct kernel boot), the code incorrectly tried to write EFI firmware to guest memory address 0, which wasn't mapped.

ExternalKernel payload calls arch_memory_regions with firmware_size=None, so no memory region is allocated for firmware. However, with the efi feature enabled, firmware_data is always Some(EDK2_BINARY), causing the write to fail with FirmwareInvalidAddress(InvalidGuestAddress(0)).

Skip firmware writing for ExternalKernel payload since direct kernel boot doesn't use EFI firmware.

When using the efi feature on aarch64 with ExternalKernel payload
(direct kernel boot), the code incorrectly tried to write EFI
firmware to guest memory address 0, which wasn't mapped.

ExternalKernel payload calls arch_memory_regions with firmware_size=None,
so no memory region is allocated for firmware. However, with the efi
feature enabled, firmware_data is always Some(EDK2_BINARY), causing
the write to fail with FirmwareInvalidAddress(InvalidGuestAddress(0)).

Skip firmware writing for ExternalKernel payload since direct kernel
boot doesn't use EFI firmware.

Signed-off-by: Eric Curtin <eric.curtin@docker.com>
@ericcurtin
Copy link
Member Author

@slp @mtjhrc PTAL

Copy link
Collaborator

@slp slp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While I've been tempted to simply state the EFI flavor (which we intend to deprectate) doesn't support external kernels, this change doesn't hurt and fixes this particular use case, so let's get it in. Thanks @ericcurtin !

@slp slp merged commit fa3a2a9 into containers:main Jan 9, 2026
11 checks passed
@ericcurtin
Copy link
Member Author

ericcurtin commented Jan 9, 2026

"which we intend to deprectate" this is useful info thanks. I eventually started using normal grub2 instead of using external kernels.

@ericcurtin ericcurtin deleted the fix-firmware-write branch January 9, 2026 11:20
@slp
Copy link
Collaborator

slp commented Jan 9, 2026

"which we intend to deprectate" this is useful info thanks. I eventually started using normal grub2 instead of using external kernels.

To be clear, we intend to deprecate the "EFI" flavor, not the ability to load an EFI firmware (or any other firmware). The EFI flavor was simply kind of a shortcut that automatically loads a bundled EFI firmware. Without the EFI flavor, users need carry their own firmware (they can simply pick up the binary from this repo) and configure it using krun_set_firmware.

We've already changed krunkit to do this containers/krunkit#86

The main reason is that having both libkrun and libkrun-efi on macOS was both confusing a maintenance burden. With this transition, we have switched back to a single homebrew tap.

@ericcurtin
Copy link
Member Author

ericcurtin commented Jan 9, 2026

"which we intend to deprectate" this is useful info thanks. I eventually started using normal grub2 instead of using external kernels.

To be clear, we intend to deprecate the "EFI" flavor, not the ability to load an EFI firmware (or any other firmware). The EFI flavor was simply kind of a shortcut that automatically loads a bundled EFI firmware. Without the EFI flavor, users need carry their own firmware (they can simply pick up the binary from this repo) and configure it using krun_set_firmware.

We've already changed krunkit to do this containers/krunkit#86

The main reason is that having both libkrun and libkrun-efi on macOS was both confusing a maintenance burden. With this transition, we have switched back to a single homebrew tap.

I'll move to the same technique as krunkit to help with maintenance, fwiw this is the thing that is using libkrun in this way:

https://github.com/ericcurtin/vmm

@slp
Copy link
Collaborator

slp commented Jan 9, 2026

"which we intend to deprectate" this is useful info thanks. I eventually started using normal grub2 instead of using external kernels.

To be clear, we intend to deprecate the "EFI" flavor, not the ability to load an EFI firmware (or any other firmware). The EFI flavor was simply kind of a shortcut that automatically loads a bundled EFI firmware. Without the EFI flavor, users need carry their own firmware (they can simply pick up the binary from this repo) and configure it using krun_set_firmware.
We've already changed krunkit to do this containers/krunkit#86
The main reason is that having both libkrun and libkrun-efi on macOS was both confusing a maintenance burden. With this transition, we have switched back to a single homebrew tap.

I'll move to the same technique as krunkit to help with maintenance, fwiw this is the thing that is using libkrun in this way:

https://github.com/ericcurtin/vmm

Cool! Looks like krunvm but following much closely the container semantics, neat.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants