[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220211162857.GB10606@srcf.ucam.org>
Date: Fri, 11 Feb 2022 16:28:57 +0000
From: Matthew Garrett <mjg59@...f.ucam.org>
To: Aditya Garg <gargaditya08@...e.com>
Cc: Ard Biesheuvel <ardb@...nel.org>, Jeremy Kerr <jk@...abs.org>,
"joeyli.kernel@...il.com" <joeyli.kernel@...il.com>,
"zohar@...ux.ibm.com" <zohar@...ux.ibm.com>,
"jmorris@...ei.org" <jmorris@...ei.org>,
"eric.snowberg@...cle.com" <eric.snowberg@...cle.com>,
"dhowells@...hat.com" <dhowells@...hat.com>,
"jlee@...e.com" <jlee@...e.com>,
"James.Bottomley@...senpartnership.com"
<James.Bottomley@...senPartnership.com>,
"jarkko@...nel.org" <jarkko@...nel.org>,
"mic@...ikod.net" <mic@...ikod.net>,
"dmitry.kasatkin@...il.com" <dmitry.kasatkin@...il.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
"linux-efi@...r.kernel.org" <linux-efi@...r.kernel.org>,
"linux-security-module@...r.kernel.org"
<linux-security-module@...r.kernel.org>,
"stable@...r.kernel.org" <stable@...r.kernel.org>,
"keyrings@...r.kernel.org" <keyrings@...r.kernel.org>,
"linux-integrity@...r.kernel.org" <linux-integrity@...r.kernel.org>,
Orlando Chamberlain <redecorating@...tonmail.com>,
Aun-Ali Zaidi <admin@...eit.net>
Subject: Re: [PATCH] efi: Do not import certificates from UEFI Secure Boot
for T2 Macs
On Fri, Feb 11, 2022 at 04:51:22AM +0000, Aditya Garg wrote:
> With this patch, I built 2 kernels, one with CONFIG_LOAD_UEFI_KEYS=y and other with CONFIG_LOAD_UEFI_KEYS=n. I have got different variables causing panics in both cases. The logs couldn't get saved in journalctl so, I clicked a picture of the same. The kernel anyways was refusing to boot after these logs.
Oh gosh I'm an idiot. Please try this one instead.
diff --git a/drivers/firmware/efi/runtime-wrappers.c b/drivers/firmware/efi/runtime-wrappers.c
index f3e54f6616f0..79a003c2f7b6 100644
--- a/drivers/firmware/efi/runtime-wrappers.c
+++ b/drivers/firmware/efi/runtime-wrappers.c
@@ -32,6 +32,8 @@
#include <linux/stringify.h>
#include <linux/workqueue.h>
#include <linux/completion.h>
+#include <linux/ucs2_string.h>
+#include <linux/slab.h>
#include <asm/efi.h>
@@ -179,6 +181,9 @@ static void efi_call_rts(struct work_struct *work)
{
void *arg1, *arg2, *arg3, *arg4, *arg5;
efi_status_t status = EFI_NOT_FOUND;
+ unsigned long utf8_name_size;
+ char *utf8_name;
+ char guid_str[UUID_STRING_LEN + 1];
arg1 = efi_rts_work.arg1;
arg2 = efi_rts_work.arg2;
@@ -203,6 +208,17 @@ static void efi_call_rts(struct work_struct *work)
(efi_time_t *)arg2);
break;
case EFI_GET_VARIABLE:
+ utf8_name_size = ucs2_utf8size((efi_char16_t *)arg1);
+ utf8_name = kmalloc(utf8_name_size+1, GFP_KERNEL);
+ if (!utf8_name) {
+ printk(KERN_INFO "failed to allocate UTF8 buffer\n");
+ break;
+ }
+
+ ucs2_as_utf8(utf8_name, (efi_char16_t *)arg1, utf8_name_size + 1);
+ efi_guid_to_str((efi_guid_t *)arg2, guid_str);
+
+ printk(KERN_INFO "Reading EFI variable %s-%s\n", utf8_name, guid_str);
status = efi_call_virt(get_variable, (efi_char16_t *)arg1,
(efi_guid_t *)arg2, (u32 *)arg3,
(unsigned long *)arg4, (void *)arg5);
Powered by blists - more mailing lists