LKML Archive on
help / color / mirror / Atom feed
* [tip: efi/urgent] efi/mokvar: Reserve the table only if it is in boot services data
@ 2021-07-20 11:37 tip-bot2 for Borislav Petkov
  0 siblings, 0 replies; only message in thread
From: tip-bot2 for Borislav Petkov @ 2021-07-20 11:37 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: Borislav Petkov, Ard Biesheuvel, x86, linux-kernel

The following commit has been merged into the efi/urgent branch of tip:

Commit-ID:     47e1e233e9d822dfda068383fb9a616451bda703
Author:        Borislav Petkov <>
AuthorDate:    Tue, 20 Jul 2021 09:28:09 +02:00
Committer:     Ard Biesheuvel <>
CommitterDate: Tue, 20 Jul 2021 09:28:09 +02:00

efi/mokvar: Reserve the table only if it is in boot services data

One of the SUSE QA tests triggered:

  localhost kernel: efi: Failed to lookup EFI memory descriptor for 0x000000003dcf8000

which comes from x86's version of efi_arch_mem_reserve() trying to
reserve a memory region. Usually, that function expects
EFI_BOOT_SERVICES_DATA memory descriptors but the above case is for the
MOKvar table which is allocated in the EFI shim as runtime services.

That lead to a fix changing the allocation of that table to boot services.

However, that fix broke booting SEV guests with that shim leading to
this kernel fix

  8d651ee9c71b ("x86/ioremap: Map EFI-reserved memory as encrypted for SEV")

which extended the ioremap hint to map reserved EFI boot services as
decrypted too.

However, all that wasn't needed, IMO, because that error message in
efi_arch_mem_reserve() was innocuous in this case - if the MOKvar table
is not in boot services, then it doesn't need to be reserved in the
first place because it is, well, in runtime services which *should* be
reserved anyway.

So do that reservation for the MOKvar table only if it is allocated
in boot services data. I couldn't find any requirement about where
that table should be allocated in, unlike the ESRT which allocation is
mandated to be done in boot services data by the UEFI spec.

Signed-off-by: Borislav Petkov <>
Signed-off-by: Ard Biesheuvel <>
 drivers/firmware/efi/mokvar-table.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/firmware/efi/mokvar-table.c b/drivers/firmware/efi/mokvar-table.c
index d8bc013..38722d2 100644
--- a/drivers/firmware/efi/mokvar-table.c
+++ b/drivers/firmware/efi/mokvar-table.c
@@ -180,7 +180,10 @@ void __init efi_mokvar_table_init(void)
 		pr_err("EFI MOKvar config table is not valid\n");
-	efi_mem_reserve(efi.mokvar_table, map_size_needed);
+	if (md.type == EFI_BOOT_SERVICES_DATA)
+		efi_mem_reserve(efi.mokvar_table, map_size_needed);
 	efi_mokvar_table_size = map_size_needed;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-07-20 11:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-20 11:37 [tip: efi/urgent] efi/mokvar: Reserve the table only if it is in boot services data tip-bot2 for Borislav Petkov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).