From 7f95104d91ccfb26f802feb5300838b41bc5fbb1 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Fri, 5 Jul 2019 17:42:16 +0200 Subject: efi_loader: detach runtime in ExitBootServices() Linux can be called with a command line parameter efi=novamap, cf. commit 4e46c2a95621 ("efi/arm/arm64: Allow SetVirtualAddressMap() to be omitted"). In this case SetVirtualAddressMap() is not called after ExitBootServices(). OpenBSD 32bit does not call SetVirtualAddressMap() either. Runtime services must be set to an implementation supported at runtime in ExitBootServices(). Reported-by: Ard Biesheuvel Suggested-by: Alexander Graf Signed-off-by: Heinrich Schuchardt --- lib/efi_loader/efi_boottime.c | 3 +++ lib/efi_loader/efi_runtime.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c index ba4c1e5..c2f8980 100644 --- a/lib/efi_loader/efi_boottime.c +++ b/lib/efi_loader/efi_boottime.c @@ -1973,6 +1973,9 @@ static efi_status_t EFIAPI efi_exit_boot_services(efi_handle_t image_handle, board_quiesce_devices(); + /* Patch out unsupported runtime function */ + efi_runtime_detach(); + /* Fix up caches for EFI payloads if necessary */ efi_exit_caches(); diff --git a/lib/efi_loader/efi_runtime.c b/lib/efi_loader/efi_runtime.c index dcbe824..7a64dd4 100644 --- a/lib/efi_loader/efi_runtime.c +++ b/lib/efi_loader/efi_runtime.c @@ -398,7 +398,7 @@ static bool efi_is_runtime_service_pointer(void *p) /** * efi_runtime_detach() - detach unimplemented runtime functions */ -static __efi_runtime void efi_runtime_detach(void) +void efi_runtime_detach(void) { efi_runtime_services.reset_system = efi_reset_system; efi_runtime_services.get_time = efi_get_time; -- cgit v1.1