Commit f5f7537c authored by Ding Hui's avatar Ding Hui
Browse files

efi: fix userspace infinite retry read efivars after EFI runtime services page fault

mainline inclusion
from mainline-v6.1-rc4
commit e006ac30
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I67RIP
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e006ac3003080177cf0b673441a4241f77aaecce



--------------------------------

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: <stable@vger.kernel.org>
Fixes: 3425d934 ("efi/x86: Handle page faults occurring while running EFI runtime services")
Fixes: 23715a26 ("arm64: efi: Recover from synchronous exceptions occurring in firmware")
Signed-off-by: default avatarDing Hui <dinghui@sangfor.com.cn>
Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
Signed-off-by: default avatarDing Hui <dinghui@sangfor.com.cn>
parent 1928ac07
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment