All of lore.kernel.org
 help / color / mirror / Atom feed
From: Aditya Garg <gargaditya08@live.com>
To: Ard Biesheuvel <ardb@kernel.org>
Cc: "jk@ozlabs.org" <jk@ozlabs.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	"linux-efi@vger.kernel.org" <linux-efi@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Orlando Chamberlain <redecorating@protonmail.com>,
	Aun-Ali Zaidi <admin@kodeit.net>
Subject: Re: [BUG][SEVERE] Enabling EFI runtime services causes panics in the T2 security chip on Macs equipped with it.
Date: Wed, 12 Jan 2022 06:23:29 +0000	[thread overview]
Message-ID: <787447CE-C7DC-4EA3-B498-6FEA88C523A1@live.com> (raw)
In-Reply-To: <CAMj1kXEjmJxS-_r4HK_v_Qm85y2oeawk+bWUpSY7mV5NLFCm4g@mail.gmail.com>

Hi Ard
As I said before, if I apply the patch below, the things work well
> 
> Can you check whether things work as before after applying the change below?
> 
> diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
> index 147c30a81f15..d7203355cc69 100644
> --- a/arch/x86/platform/efi/efi.c
> +++ b/arch/x86/platform/efi/efi.c
> @@ -399,7 +399,7 @@ static int __init efi_systab_init(unsigned long phys)
>                efi_nr_tables           = systab32->nr_tables;
>        }
> 
> -       efi.runtime_version = hdr->revision;
> +       efi.runtime_version = EFI_1_10_SYSTEM_TABLE_REVISION;
> 
>        efi_systab_report_header(hdr, efi_fw_vendor);
>        early_memunmap(p, size);

Now, I tried to quirk on the basis of DMI data for some t2 Macs using this patch :-

diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
index 147c30a81..0d73d7709 100644
--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
@@ -44,6 +44,7 @@
 #include <linux/io.h>
 #include <linux/reboot.h>
 #include <linux/bcd.h>
+#include <linux/dmi.h>
 
 #include <asm/setup.h>
 #include <asm/efi.h>
@@ -339,6 +340,52 @@ void __init efi_print_memmap(void)
 	}
 }
 
+static const struct dmi_system_id apple_use_old_runtime_version[] = {
+	{
+		 .matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro16,1"),
+		},
+	},
+	{
+		 .matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro16,2"),
+		},
+	},
+	{
+		 .matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro16,4"),
+		},
+	},
+	{
+		 .matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "MacBookAir8,1"),
+		},
+	},
+	{
+		 .matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "MacBookAir8,2"),
+		},
+	},
+	{
+		 .matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "iMac20,1"),
+		},
+	},
+	{
+		 .matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "iMac20,2"),
+		},
+	},
+	{ }
+};
+
 static int __init efi_systab_init(unsigned long phys)
 {
 	int size = efi_enabled(EFI_64BIT) ? sizeof(efi_system_table_64_t)
@@ -347,6 +394,7 @@ static int __init efi_systab_init(unsigned long phys)
 	bool over4g = false;
 	void *p;
 	int ret;
+	const struct dmi_system_id *dmi_id;
 
 	hdr = p = early_memremap_ro(phys, size);
 	if (p == NULL) {
@@ -398,8 +446,15 @@ static int __init efi_systab_init(unsigned long phys)
 		efi_config_table	= systab32->tables;
 		efi_nr_tables		= systab32->nr_tables;
 	}
-
-	efi.runtime_version = hdr->revision;
+	
+	dmi_id = dmi_first_match(apple_use_old_runtime_version);
+	if (dmi_id) {
+		efi.runtime_version = EFI_1_10_SYSTEM_TABLE_REVISION;
+		pr_info("T2 Mac detected. Using runtime service version 1.10\n");
+	}
+	else {
+		efi.runtime_version = hdr->revision;
+	}
 
 	efi_systab_report_header(hdr, efi_fw_vendor);
 	early_memunmap(p, size);
-- 
2.25.1

But, now the issue doesn't seen to get resolved
Could you help me in this?

  parent reply	other threads:[~2022-01-12  6:23 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-10 15:37 [BUG][SEVERE] Enabling EFI runtime services causes panics in the T2 security chip on Macs equipped with it Aditya Garg
2022-01-10 16:02 ` Ard Biesheuvel
2022-01-10 16:27   ` Aditya Garg
2022-01-10 16:37     ` Ard Biesheuvel
2022-01-10 17:45       ` Ard Biesheuvel
2022-01-11  5:17         ` Orlando Chamberlain
2022-01-11  7:35           ` Aditya Garg
2022-01-11  7:32         ` Aditya Garg
2022-01-12  6:23         ` Aditya Garg [this message]
2022-01-12  8:21           ` Ard Biesheuvel
2022-01-12  9:06             ` Orlando Chamberlain
2022-01-12  9:13               ` Ard Biesheuvel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=787447CE-C7DC-4EA3-B498-6FEA88C523A1@live.com \
    --to=gargaditya08@live.com \
    --cc=admin@kodeit.net \
    --cc=ardb@kernel.org \
    --cc=jk@ozlabs.org \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=redecorating@protonmail.com \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.