summaryrefslogtreecommitdiff
path: root/lib/efi_loader/efi_variable_tee.c
diff options
context:
space:
mode:
authorIlias Apalodimas <ilias.apalodimas@linaro.org>2025-02-14 15:46:45 +0200
committerHeinrich Schuchardt <heinrich.schuchardt@canonical.com>2025-02-20 09:22:53 +0100
commit530e869ff89d9575103637af201fe97864d4f577 (patch)
treea7223c97c2e9ca2f33d01c5311301179c6aabd19 /lib/efi_loader/efi_variable_tee.c
parent80908fee7705cd2edb2df94c3d124c44dd515582 (diff)
efi_loader: remove comparisons to string literals from runtime
For EFI runtime services, we manage to preserve string literals by placing the .efi_runtime section just before .data and preserving it when marking the runtime memory by marking surrounding boottime code as runtime. This is ok for now but will break if we update any linker scripts and decouple .text and .runtime sections. So let's define the strings we used to compare in the appropriate section for runtime services Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Reviewed-by: Mark Kettenis <kettenis@openbsd.org>
Diffstat (limited to 'lib/efi_loader/efi_variable_tee.c')
-rw-r--r--lib/efi_loader/efi_variable_tee.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/efi_loader/efi_variable_tee.c b/lib/efi_loader/efi_variable_tee.c
index 0d090d051dd..6a1fa39bb6f 100644
--- a/lib/efi_loader/efi_variable_tee.c
+++ b/lib/efi_loader/efi_variable_tee.c
@@ -41,6 +41,7 @@ static u16 mm_sp_id;
extern struct efi_var_file __efi_runtime_data *efi_var_buf;
static efi_uintn_t max_buffer_size; /* comm + var + func + data */
static efi_uintn_t max_payload_size; /* func + data */
+static const u16 __efi_runtime_rodata pk[] = u"PK";
struct mm_connection {
struct udevice *tee;
@@ -858,7 +859,7 @@ efi_status_t efi_set_variable_int(const u16 *variable_name,
if (alt_ret != EFI_SUCCESS)
goto out;
- if (!u16_strcmp(variable_name, u"PK"))
+ if (!u16_strcmp(variable_name, pk))
alt_ret = efi_init_secure_state();
out:
free(comm_buf);