]> git.baikalelectronics.ru Git - kernel.git/commit
arm64: efi: Avoid workqueue to check whether EFI runtime is live
authorArd Biesheuvel <ardb@kernel.org>
Fri, 28 Oct 2022 14:39:14 +0000 (16:39 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 1 Feb 2023 07:34:34 +0000 (08:34 +0100)
commit441b14c39e2dc464b0d7c6c7e981689384f20aa8
tree2195f465dbd09df2dc7e2273544e877e21dadc35
parent27b8e116e0b8e0ad12fb04b8d88bfae14d3d82b5
arm64: efi: Avoid workqueue to check whether EFI runtime is live

[ Upstream commit cdbc33aa311b2c1860a08454e35bd089ced290d0 ]

Comparing current_work() against efi_rts_work.work is sufficient to
decide whether current is currently running EFI runtime services code at
any level in its call stack.

However, there are other potential users of the EFI runtime stack, such
as the ACPI subsystem, which may invoke efi_call_virt_pointer()
directly, and so any sync exceptions occurring in firmware during those
calls are currently misidentified.

So instead, let's check whether the stashed value of the thread stack
pointer points into current's thread stack. This can only be the case if
current was interrupted while running EFI runtime code. Note that this
implies that we should clear the stashed value after switching back, to
avoid false positives.

Reviewed-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/arm64/include/asm/efi.h
arch/arm64/kernel/efi-rt-wrapper.S
arch/arm64/kernel/efi.c