summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Aloni <daloni@magicleap.com>2018-12-05 16:46:44 +0200
committerBruno Martins <bgcngm@gmail.com>2022-10-28 15:57:23 +0100
commit6488cb478f043acd964f68228c5e5a1eeda7bb3a (patch)
treea88af2353f0f83300a7eda8acb7548a368e7332e
parentdba4259216a0f1152a1cffea0f1afb40b74a4fe0 (diff)
drivers/firmware/efi/libstub.c: prevent a relocation
This prevents a variable-reference relocation inside the EFI stub by using a wrapper API. Change-Id: I46f7827959a1f702dac42447277c3f7f1ba8612f Signed-off-by: Dan Aloni <daloni@magicleap.com> Signed-off-by: Davide Garberi <dade.garberi@gmail.com>
-rw-r--r--drivers/firmware/efi/libstub/arm-stub.c5
-rw-r--r--drivers/firmware/efi/libstub/arm64-stub.c2
-rw-r--r--drivers/firmware/efi/libstub/efistub.h2
3 files changed, 8 insertions, 1 deletions
diff --git a/drivers/firmware/efi/libstub/arm-stub.c b/drivers/firmware/efi/libstub/arm-stub.c
index 832df3c58e2f..b858494a0a55 100644
--- a/drivers/firmware/efi/libstub/arm-stub.c
+++ b/drivers/firmware/efi/libstub/arm-stub.c
@@ -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;
diff --git a/drivers/firmware/efi/libstub/arm64-stub.c b/drivers/firmware/efi/libstub/arm64-stub.c
index e33593ed8f84..1f84f9ac5430 100644
--- a/drivers/firmware/efi/libstub/arm64-stub.c
+++ b/drivers/firmware/efi/libstub/arm64-stub.c
@@ -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);
diff --git a/drivers/firmware/efi/libstub/efistub.h b/drivers/firmware/efi/libstub/efistub.h
index a5eaa3ac0a5d..f1907c792a52 100644
--- a/drivers/firmware/efi/libstub/efistub.h
+++ b/drivers/firmware/efi/libstub/efistub.h
@@ -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);