Re: [BUG][SEVERE] Enabling EFI runtime services causes panics in the T2 security chip on Macs equipped with it.

From: Ard Biesheuvel
Date: Wed Jan 12 2022 - 03:22:14 EST


On Wed, 12 Jan 2022 at 07:23, Aditya Garg <gargaditya08@xxxxxxxx> wrote:
>
> 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 :-
>

Hello Aditya,

This code runs far too early for DMI checks.

What we might do is just use EFI 1.10 for all Apple x86 EFI machines.

Please try the below:

diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
index ae79c3300129..2303f9b06412 100644
--- a/drivers/firmware/efi/efi.c
+++ b/drivers/firmware/efi/efi.c
@@ -722,6 +722,13 @@ void __init efi_systab_report_header(const
efi_table_hdr_t *systab_hdr,
systab_hdr->revision >> 16,
systab_hdr->revision & 0xffff,
vendor);
+
+ if (IS_ENABLED(CONFIG_X86_64) &&
+ systab_hdr->revision > EFI_1_10_SYSTEM_TABLE_REVISION &&
+ !strcmp(vendor, "Apple")) {
+ pr_info("Apple EFI Mac detected, using EFI v1.10
runtime services only\n");
+ efi.runtime_version = EFI_1_10_SYSTEM_TABLE_REVISION;
+ }
}

static __initdata char memory_type_name[][13] = {