Skip to contentSkip to conversation

efi_loader: workaround for grub lsefi bug

PATCH Applied Rob Clark 3 participants 5 messages Jul 20, 2017 – Jul 28, 2017

lore
Share & tools
lore

Rob Clark

author
#0 lore raw

PATCH 1/1 efi_loader: workaround for grub lsefi bug

Patch has also been sent to fix grub to not ignore the error returned and treat protocol_buffer_count as valid. But that that might take a while to trickle into distro's, so this workaround might be useful.

---
 lib/efi_loader/efi_boottime.c | 1 +
 1 file changed, 1 insertion(+)
lib/efi_loader/efi_boottime.c +1 -0
index 27e51a253f..a45de39919 100644
@@ -637,6 +637,7 @@ static efi_status_t EFIAPI efi_protocols_per_handle(void *handle,
 {
 	EFI_ENTRY("%p, %p, %p", handle, protocol_buffer,
 		  protocol_buffer_count);
+	*protocol_buffer_count = 0;
 	return EFI_EXIT(EFI_OUT_OF_RESOURCES);
 }
 
Signature · 1 line
2.13.0
#1 lore raw
Quoted 15 lines · Rob Clark

Patch has also been sent to fix grub to not ignore the error returned and treat protocol_buffer_count as valid. But that that might take a while to trickle into distro's, so this workaround might be useful.

---
 lib/efi_loader/efi_boottime.c | 1 +
 1 file changed, 1 insertion(+)
lib/efi_loader/efi_boottime.c +0 -0
index 27e51a253f..a45de39919 100644

lib/efi_loader/efi_boottime.c static efi_status_t EFIAPI efi_protocols_per_handle(void *handle, · line 643

Quoted 7 lines
lib/efi_loader/efi_boottime.c +1 -0
@@ -637,6 +637,7 @@ static efi_status_t EFIAPI efi_protocols_per_handle(void *handle,
 {
 	EFI_ENTRY("%p, %p, %p", handle, protocol_buffer,
 		  protocol_buffer_count);
+	*protocol_buffer_count = 0;
 	return EFI_EXIT(EFI_OUT_OF_RESOURCES);
 }
 

NAK

We already have this patch waiting to correctly implement ProtocolsPerHandle:

efi_loader: implement ProtocolsPerHandle
https://patchwork.ozlabs.org/patch/787995/

@Rob: Could you, please, test if this patch solves your problem.

Regards

Heinrich

author
#2 lore raw
Quoted 26 lines · Heinrich Schuchardt
Quoted 15 lines · Rob Clark

Patch has also been sent to fix grub to not ignore the error returned and treat protocol_buffer_count as valid. But that that might take a while to trickle into distro's, so this workaround might be useful.

---
 lib/efi_loader/efi_boottime.c | 1 +
 1 file changed, 1 insertion(+)
lib/efi_loader/efi_boottime.c +0 -0
index 27e51a253f..a45de39919 100644

lib/efi_loader/efi_boottime.c static efi_status_t EFIAPI efi_protocols_per_handle(void *handle, · line 643

Quoted 7 lines
lib/efi_loader/efi_boottime.c +1 -0
@@ -637,6 +637,7 @@ static efi_status_t EFIAPI efi_protocols_per_handle(void *handle,
 {
      EFI_ENTRY("%p, %p, %p", handle, protocol_buffer,
                protocol_buffer_count);
+     *protocol_buffer_count = 0;
      return EFI_EXIT(EFI_OUT_OF_RESOURCES);
 }
 

NAK

Quoted 8 lines

We already have this patch waiting to correctly implement ProtocolsPerHandle:

efi_loader: implement ProtocolsPerHandle
https://patchwork.ozlabs.org/patch/787995/

@Rob: Could you, please, test if this patch solves your problem.

From a quick look, it looks like it probably should. I mostly sent this patch so people would have a way to lsefi in grub to see what my device-path patches where doing.

BR,
-R

#3 lore raw
Quoted 30 lines · Rob Clark
Quoted 29 lines · Heinrich Schuchardt
Quoted 15 lines · Rob Clark

Patch has also been sent to fix grub to not ignore the error returned and treat protocol_buffer_count as valid. But that that might take a while to trickle into distro's, so this workaround might be useful.

---
  lib/efi_loader/efi_boottime.c | 1 +
  1 file changed, 1 insertion(+)
lib/efi_loader/efi_boottime.c +0 -0
index 27e51a253f..a45de39919 100644

lib/efi_loader/efi_boottime.c static efi_status_t EFIAPI efi_protocols_per_handle(void *handle, · line 643

Quoted 7 lines
lib/efi_loader/efi_boottime.c +1 -0
@@ -637,6 +637,7 @@ static efi_status_t EFIAPI efi_protocols_per_handle(void *handle,
  {
       EFI_ENTRY("%p, %p, %p", handle, protocol_buffer,
                 protocol_buffer_count);
+     *protocol_buffer_count = 0;
       return EFI_EXIT(EFI_OUT_OF_RESOURCES);
  }
 

NAK

We already have this patch waiting to correctly implement ProtocolsPerHandle:

Quoted 7 lines
Quoted 5 lines

efi_loader: implement ProtocolsPerHandle
https://patchwork.ozlabs.org/patch/787995/

@Rob: Could you, please, test if this patch solves your problem.

From a quick look, it looks like it probably should. I mostly sent

Yes, lsefi works with your patch.

Quoted 2 lines

this patch so people would have a way to lsefi in grub to see what my device-path patches where doing.

I simply applied both now :).

Alex

#4 lore raw
In reply to Rob Clark
Quoted 5 lines

Patch has also been sent to fix grub to not ignore the error returned and treat protocol_buffer_count as valid. But that that might take a while to trickle into distro's, so this workaround might be useful.

Thanks, applied to efi-next

Alex