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
 	DBGC ( &tick, "ENTROPY %s RNG protocol\n",
79
 	DBGC ( &tick, "ENTROPY %s RNG protocol\n",
80
 	       ( efirng ? "has" : "has no" ) );
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
 	/* Create timer tick event */
85
 	/* Create timer tick event */
83
 	if ( ( efirc = bs->CreateEvent ( EVT_TIMER, TPL_NOTIFY, NULL, NULL,
86
 	if ( ( efirc = bs->CreateEvent ( EVT_TIMER, TPL_NOTIFY, NULL, NULL,
84
 					 &tick ) ) != 0 ) {
87
 					 &tick ) ) != 0 ) {
100
 
103
 
101
 	/* Close timer tick event */
104
 	/* Close timer tick event */
102
 	bs->CloseEvent ( tick );
105
 	bs->CloseEvent ( tick );
106
+
107
+	/* Return to TPL_CALLBACK */
108
+	bs->RaiseTPL ( TPL_CALLBACK );
103
 }
109
 }
104
 
110
 
105
 /**
111
 /**

Loading…
Cancel
Save