summaryrefslogtreecommitdiff
path: root/debian/patches/MOK-BootServicesData.patch
diff options
context:
space:
mode:
Diffstat (limited to 'debian/patches/MOK-BootServicesData.patch')
-rw-r--r--debian/patches/MOK-BootServicesData.patch34
1 files changed, 34 insertions, 0 deletions
diff --git a/debian/patches/MOK-BootServicesData.patch b/debian/patches/MOK-BootServicesData.patch
new file mode 100644
index 00000000..948b89b9
--- /dev/null
+++ b/debian/patches/MOK-BootServicesData.patch
@@ -0,0 +1,34 @@
+commit 4068fd42c891ea6ebdec056f461babc6e4048844
+Author: Gary Lin <glin@suse.com>
+Date: Thu Apr 8 16:23:03 2021 +0800
+
+ mok: allocate MOK config table as BootServicesData
+
+ Linux kernel is picky when reserving the memory for x86 and it only
+ expects BootServicesData:
+
+ https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/x86/platform/efi/quirks.c?h=v5.11#n254
+
+ Otherwise, the following error would show during system boot:
+
+ Apr 07 12:31:56.743925 localhost kernel: efi: Failed to lookup EFI memory descriptor for 0x000000003dcf8000
+
+ Although BootServicesData would be reclaimed after ExitBootService(),
+ linux kernel reserves MOK config table when it detects the existence of
+ the table, so it's fine to allocate the table as BootServicesData.
+
+ Signed-off-by: Gary Lin <glin@suse.com>
+
+diff --git a/mok.c b/mok.c
+index 9e37d6ab..9b8fc2bc 100644
+--- a/mok.c
++++ b/mok.c
+@@ -999,7 +999,7 @@ EFI_STATUS import_mok_state(EFI_HANDLE image_handle)
+ npages = ALIGN_VALUE(config_sz, PAGE_SIZE) >> EFI_PAGE_SHIFT;
+ config_table = NULL;
+ efi_status = gBS->AllocatePages(AllocateAnyPages,
+- EfiRuntimeServicesData,
++ EfiBootServicesData,
+ npages,
+ (EFI_PHYSICAL_ADDRESS *)&config_table);
+ if (EFI_ERROR(efi_status) || !config_table) {