]> git.ipfire.org Git - thirdparty/grub.git/commit
efi/efinet: Don't close connections at fini_hw() time
authorArd Biesheuvel <ardb@kernel.org>
Tue, 18 Oct 2022 19:05:05 +0000 (21:05 +0200)
committerDaniel Kiper <daniel.kiper@oracle.com>
Thu, 27 Oct 2022 15:24:59 +0000 (17:24 +0200)
commit7b0809bc3a7611419a5251de70cc522e48ff97b5
tree3754675a09ba154b43e9bf6d151f8939a56242ae
parent12edfe42212af738f6e2f4aa733b690f26a43039
efi/efinet: Don't close connections at fini_hw() time

When GRUB runs on top of EFI firmware, it only has access to block and
network device abstractions exposed by the firmware, and it is up to the
firmware to quiesce the underlying hardware when exiting boot services
and handing over to the OS.

This is especially important for network devices, to prevent incoming
packets from being DMA'd straight into memory after the OS has taken
over but before it has managed to reconfigure the network hardware.

GRUB handles this by means of the grub_net_fini_hw() preboot hook, which
is executed before calling into the booted image. This means that all
network devices disappear or become inoperable before the EFI stub
executes on EFI targeted builds. This is problematic as it prevents the
EFI stub from calling back into GRUB provided protocols such as
LoadFile2 for the initrd, which we will provide in a subsequent patch.

So add a flag that indicates to the network core that EFI network
devices should not be closed when grub_net_fini_hw() is called.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
grub-core/net/drivers/efi/efinet.c
grub-core/net/net.c
include/grub/net.h