Skip to content

Commit

Permalink
drivers/firmware/efi/libstub.c: prevent a relocation
Browse files Browse the repository at this point in the history
This prevents a variable-reference relocation inside the EFI stub by
using a wrapper API.

Change-Id: I46f7827959a1f702dac42447277c3f7f1ba8612f
Signed-off-by: Dan Aloni <[email protected]>
Signed-off-by: Davide Garberi <[email protected]>
  • Loading branch information
Dan Aloni authored and chrmhoffmann committed Nov 15, 2022
1 parent d586a54 commit aa345ee
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions drivers/firmware/efi/libstub/arm-stub.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@

#include "efistub.h"

bool efi__get___nokaslr(void)
{
return nokaslr();
}

static int efi_secureboot_enabled(efi_system_table_t *sys_table_arg)
{
static efi_guid_t const var_guid = EFI_GLOBAL_VARIABLE_GUID;
Expand Down
2 changes: 1 addition & 1 deletion drivers/firmware/efi/libstub/arm64-stub.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ efi_status_t __init handle_kernel_image(efi_system_table_t *sys_table_arg,
u64 phys_seed = 0;

if (IS_ENABLED(CONFIG_RANDOMIZE_BASE)) {
if (!nokaslr()) {
if (!efi__get___nokaslr()) {
status = efi_get_random_bytes(sys_table_arg,
sizeof(phys_seed),
(u8 *)&phys_seed);
Expand Down
2 changes: 2 additions & 0 deletions drivers/firmware/efi/libstub/efistub.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ extern int __pure nokaslr(void);

void efi_char16_printk(efi_system_table_t *, efi_char16_t *);

bool efi__get___nokaslr(void);

efi_status_t efi_open_volume(efi_system_table_t *sys_table_arg, void *__image,
void **__fh);

Expand Down

0 comments on commit aa345ee

Please sign in to comment.