From: Michael Brown Date: Mon, 12 Mar 2018 10:55:28 +0000 (+0000) Subject: [efi] Drop to TPL_APPLICATION when gathering entropy X-Git-Tag: v1.20.1~112 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d8c500b7945e57023dde5bd0be2b0e40963315d9;p=thirdparty%2Fipxe.git [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 Tested-by: Andreas Hammarskjöld Signed-off-by: Michael Brown --- diff --git a/src/interface/efi/efi_entropy.c b/src/interface/efi/efi_entropy.c index 881c4c9a2..2a2fc9054 100644 --- a/src/interface/efi/efi_entropy.c +++ b/src/interface/efi/efi_entropy.c @@ -79,6 +79,9 @@ static int efi_entropy_enable ( void ) { DBGC ( &tick, "ENTROPY %s RNG protocol\n", ( efirng ? "has" : "has no" ) ); + /* Drop to TPL_APPLICATION to allow timer tick event to take place */ + bs->RestoreTPL ( TPL_APPLICATION ); + /* Create timer tick event */ if ( ( efirc = bs->CreateEvent ( EVT_TIMER, TPL_NOTIFY, NULL, NULL, &tick ) ) != 0 ) { @@ -100,6 +103,9 @@ static void efi_entropy_disable ( void ) { /* Close timer tick event */ bs->CloseEvent ( tick ); + + /* Return to TPL_CALLBACK */ + bs->RaiseTPL ( TPL_CALLBACK ); } /**