Skip to contentSkip to conversation

efi: don't iterate over EFI vars pointlessly if no SSDT override was specified

PATCH In review Ard Biesheuvel 2 participants 5 messages Sep 11, 2019 – Sep 25, 2019 EFI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 efi: don't iterate over EFI vars pointlessly if no SSDT override was specified

The kernel command line option efivar_ssdt= allows a EFI variable name to be specified which contains an ACPI SSDT table that will be loaded into memory by the OS.

Currently, that code will always iterate over the EFI variables and compare each name with the provided name, even if the command line option wasn't set to begin with.

So bail early when no variable name was provided.

---
 drivers/firmware/efi/efi.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/firmware/efi/efi.c +3 -0
index ad3b1f4866b3..8f020827cdd3 100644
@@ -282,6 +282,9 @@ static __init int efivar_ssdt_load(void)
 	void *data;
 	int ret;
 
+	if (!efivar_ssdt[0])
+		return 0;
+
 	ret = efivar_init(efivar_ssdt_iter, &entries, true, &entries);
 
 	list_for_each_entry_safe(entry, aux, &entries, list) {
Signature · 1 line
2.17.1
#1 lore raw
Quoted 21 lines · Ard Biesheuvel

The kernel command line option efivar_ssdt= allows a EFI variable name to be specified which contains an ACPI SSDT table that will be loaded into memory by the OS.

Currently, that code will always iterate over the EFI variables and compare each name with the provided name, even if the command line option wasn't set to begin with.

So bail early when no variable name was provided.

---
drivers/firmware/efi/efi.c | 3 +++

1 file changed, 3 insertions(+)
drivers/firmware/efi/efi.c +0 -0
index ad3b1f4866b3..8f020827cdd3 100644

drivers/firmware/efi/efi.c static __init int efivar_ssdt_load(void) · line 290

Quoted 9 lines
drivers/firmware/efi/efi.c +3 -0
@@ -282,6 +282,9 @@ static __init int efivar_ssdt_load(void)
 	void *data;
 	int ret;
 
+	if (!efivar_ssdt[0])
+		return 0;
+
 	ret = efivar_init(efivar_ssdt_iter, &entries, true, &entries);
 
 	list_for_each_entry_safe(entry, aux, &entries, list) {

Thanks for the quick fix!

I can confirm this fixes booting on my Mac Pro 2012 system when applied to 5.3-rc7.

Whenever this makes it in, if it could be targeted for the stable kernels as well, that would be appreciated.

Thanks,
Scott

#2 lore raw
Quoted 36 lines · Scott Talbert
Quoted 21 lines · Ard Biesheuvel

The kernel command line option efivar_ssdt= allows a EFI variable name to be specified which contains an ACPI SSDT table that will be loaded into memory by the OS.

Currently, that code will always iterate over the EFI variables and compare each name with the provided name, even if the command line option wasn't set to begin with.

So bail early when no variable name was provided.

---
drivers/firmware/efi/efi.c | 3 +++

1 file changed, 3 insertions(+)
drivers/firmware/efi/efi.c +0 -0
index ad3b1f4866b3..8f020827cdd3 100644

drivers/firmware/efi/efi.c static __init int efivar_ssdt_load(void) · line 290

Quoted 9 lines
drivers/firmware/efi/efi.c +3 -0
@@ -282,6 +282,9 @@ static __init int efivar_ssdt_load(void)
      void *data;
      int ret;
 
+     if (!efivar_ssdt[0])
+             return 0;
+
      ret = efivar_init(efivar_ssdt_iter, &entries, true, &entries);
 
      list_for_each_entry_safe(entry, aux, &entries, list) {

Thanks for the quick fix!

Quoted 6 lines

I can confirm this fixes booting on my Mac Pro 2012 system when applied to 5.3-rc7.

Whenever this makes it in, if it could be targeted for the stable kernels as well, that would be appreciated.

I'll send it out as a fix with a cc to -stable.

Thanks,
Ard.

#3 lore raw
Quoted 33 lines · Ard Biesheuvel
Quoted 33 lines
Quoted 21 lines

The kernel command line option efivar_ssdt= allows a EFI variable name to be specified which contains an ACPI SSDT table that will be loaded into memory by the OS.

Currently, that code will always iterate over the EFI variables and compare each name with the provided name, even if the command line option wasn't set to begin with.

So bail early when no variable name was provided.

---
drivers/firmware/efi/efi.c | 3 +++

1 file changed, 3 insertions(+)
drivers/firmware/efi/efi.c +0 -0
index ad3b1f4866b3..8f020827cdd3 100644

drivers/firmware/efi/efi.c static __init int efivar_ssdt_load(void) · line 290

Quoted 9 lines
drivers/firmware/efi/efi.c +3 -0
@@ -282,6 +282,9 @@ static __init int efivar_ssdt_load(void)
      void *data;
      int ret;
 
+     if (!efivar_ssdt[0])
+             return 0;
+
      ret = efivar_init(efivar_ssdt_iter, &entries, true, &entries);
 
      list_for_each_entry_safe(entry, aux, &entries, list) {

Thanks for the quick fix!

Quoted 8 lines
Quoted 6 lines

I can confirm this fixes booting on my Mac Pro 2012 system when applied to 5.3-rc7.

Whenever this makes it in, if it could be targeted for the stable kernels as well, that would be appreciated.

I'll send it out as a fix with a cc to -stable.

Hi - just a quick reminder on this as I don't see it in Linus' tree yet. Not that I need it urgently, but just want to make sure it isn't forgotten.

Thanks,
Scott

#4 lore raw
Quoted 43 lines · Scott Talbert
Quoted 40 lines · Ard Biesheuvel
Quoted 39 lines
Quoted 21 lines

The kernel command line option efivar_ssdt= allows a EFI variable name to be specified which contains an ACPI SSDT table that will be loaded into memory by the OS.

Currently, that code will always iterate over the EFI variables and compare each name with the provided name, even if the command line option wasn't set to begin with.

So bail early when no variable name was provided.

---
drivers/firmware/efi/efi.c | 3 +++

1 file changed, 3 insertions(+)
drivers/firmware/efi/efi.c +0 -0
index ad3b1f4866b3..8f020827cdd3 100644

drivers/firmware/efi/efi.c static __init int efivar_ssdt_load(void) · line 290

Quoted 9 lines
drivers/firmware/efi/efi.c +3 -0
@@ -282,6 +282,9 @@ static __init int efivar_ssdt_load(void)
      void *data;
      int ret;
 
+     if (!efivar_ssdt[0])
+             return 0;
+
      ret = efivar_init(efivar_ssdt_iter, &entries, true, &entries);
 
      list_for_each_entry_safe(entry, aux, &entries, list) {

Thanks for the quick fix!

I can confirm this fixes booting on my Mac Pro 2012 system when applied to 5.3-rc7.

Whenever this makes it in, if it could be targeted for the stable kernels as well, that would be appreciated.

Quoted 6 lines
Quoted 1 line

I'll send it out as a fix with a cc to -stable.

Hi - just a quick reminder on this as I don't see it in Linus' tree yet. Not that I need it urgently, but just want to make sure it isn't forgotten.

Hi Scott,

This should get sent out in the next couple of day. It usually takes another week or so after that for changes to make it into Linus's tree.