Browse Source

[efi] Drop to TPL_APPLICATION when gathering entropy

Commit c89a446 ("[efi] Run at TPL_CALLBACK to protect against UEFI
timers") introduced a regression in the EFI entropy gathering code.
When the EFI_RNG_PROTOCOL is not present, we fall back to using timer
interrupts (as for the BIOS build).  Since timer interrupts are
disabled at TPL_CALLBACK, WaitForEvent() fails and no entropy can be
gathered.

Fix by dropping to TPL_APPLICATION while entropy gathering is enabled.

Reported-by: Andreas Hammarskjöld <junior@2PintSoftware.com>
Tested-by: Andreas Hammarskjöld <junior@2PintSoftware.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 6 years ago
parent
commit
d8c500b794
1 changed files with 6 additions and 0 deletions
  1. 6
    0
      src/interface/efi/efi_entropy.c

+ 6
- 0
src/interface/efi/efi_entropy.c View File

@@ -79,6 +79,9 @@ static int efi_entropy_enable ( void ) {
79 79
 	DBGC ( &tick, "ENTROPY %s RNG protocol\n",
80 80
 	       ( efirng ? "has" : "has no" ) );
81 81
 
82
+	/* Drop to TPL_APPLICATION to allow timer tick event to take place */
83
+	bs->RestoreTPL ( TPL_APPLICATION );
84
+
82 85
 	/* Create timer tick event */
83 86
 	if ( ( efirc = bs->CreateEvent ( EVT_TIMER, TPL_NOTIFY, NULL, NULL,
84 87
 					 &tick ) ) != 0 ) {
@@ -100,6 +103,9 @@ static void efi_entropy_disable ( void ) {
100 103
 
101 104
 	/* Close timer tick event */
102 105
 	bs->CloseEvent ( tick );
106
+
107
+	/* Return to TPL_CALLBACK */
108
+	bs->RaiseTPL ( TPL_CALLBACK );
103 109
 }
104 110
 
105 111
 /**

Loading…
Cancel
Save