Skip to content

Commit

Permalink
efi_loader: detach runtime in ExitBootServices()
Browse files Browse the repository at this point in the history
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 <[email protected]>
Suggested-by: Alexander Graf <[email protected]>
Signed-off-by: Heinrich Schuchardt <[email protected]>
  • Loading branch information
xypron committed Jul 6, 2019
1 parent b23ffcb commit 7f95104
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions include/efi_loader.h
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,8 @@ void efi_variables_boot_exit_notify(void);
efi_status_t efi_root_node_register(void);
/* Called by bootefi to initialize runtime */
efi_status_t efi_initialize_system_table(void);
/* efi_runtime_detach() - detach unimplemented runtime functions */
void efi_runtime_detach(void);
/* Called by bootefi to make console interface available */
efi_status_t efi_console_register(void);
/* Called by bootefi to make all disk storage accessible as EFI objects */
Expand Down
3 changes: 3 additions & 0 deletions lib/efi_loader/efi_boottime.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
2 changes: 1 addition & 1 deletion lib/efi_loader/efi_runtime.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 7f95104

Please sign in to comment.