Skip to content

Commit e006ac3

Browse files
cdkeyardbiesheuvel
authored andcommitted
efi: fix userspace infinite retry read efivars after EFI runtime services page fault
After [1][2], if we catch exceptions due to EFI runtime service, we will clear EFI_RUNTIME_SERVICES bit to disable EFI runtime service, then the subsequent routine which invoke the EFI runtime service should fail. But the userspace cat efivars through /sys/firmware/efi/efivars/ will stuck and infinite loop calling read() due to efivarfs_file_read() return -EINTR. The -EINTR is converted from EFI_ABORTED by efi_status_to_err(), and is an improper return value in this situation, so let virt_efi_xxx() return EFI_DEVICE_ERROR and converted to -EIO to invoker. Cc: <[email protected]> Fixes: 3425d93 ("efi/x86: Handle page faults occurring while running EFI runtime services") Fixes: 23715a2 ("arm64: efi: Recover from synchronous exceptions occurring in firmware") Signed-off-by: Ding Hui <[email protected]> Signed-off-by: Ard Biesheuvel <[email protected]>
1 parent 703c13f commit e006ac3

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/firmware/efi/runtime-wrappers.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ struct efi_runtime_work efi_rts_work;
6262
\
6363
if (!efi_enabled(EFI_RUNTIME_SERVICES)) { \
6464
pr_warn_once("EFI Runtime Services are disabled!\n"); \
65+
efi_rts_work.status = EFI_DEVICE_ERROR; \
6566
goto exit; \
6667
} \
6768
\

0 commit comments

Comments
 (0)