diff options
author | Ard Biesheuvel <ardb@kernel.org> | 2022-10-28 16:39:14 +0200 |
---|---|---|
committer | Ard Biesheuvel <ardb@kernel.org> | 2023-01-16 15:27:31 +0100 |
commit | 8a9a1a18731eb123e35f48176380a18b9782845e (patch) | |
tree | f575285adbe808f8a4b9b7346a6e88a266d4b304 /arch/arm64/kernel/efi-rt-wrapper.S | |
parent | efi: tpm: Avoid READ_ONCE() for accessing the event log (diff) | |
download | linux-8a9a1a18731eb123e35f48176380a18b9782845e.tar.xz linux-8a9a1a18731eb123e35f48176380a18b9782845e.zip |
arm64: efi: Avoid workqueue to check whether EFI runtime is live
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>
Diffstat (limited to 'arch/arm64/kernel/efi-rt-wrapper.S')
-rw-r--r-- | arch/arm64/kernel/efi-rt-wrapper.S | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/arch/arm64/kernel/efi-rt-wrapper.S b/arch/arm64/kernel/efi-rt-wrapper.S index d872d18101d8..e8ae803662cf 100644 --- a/arch/arm64/kernel/efi-rt-wrapper.S +++ b/arch/arm64/kernel/efi-rt-wrapper.S @@ -46,7 +46,10 @@ SYM_FUNC_START(__efi_rt_asm_wrapper) mov x4, x6 blr x8 + mov x16, sp mov sp, x29 + str xzr, [x16, #8] // clear recorded task SP value + ldp x1, x2, [sp, #16] cmp x2, x18 ldp x29, x30, [sp], #112 @@ -71,6 +74,9 @@ SYM_FUNC_END(__efi_rt_asm_wrapper) SYM_CODE_START(__efi_rt_asm_recover) mov sp, x30 + ldr_l x16, efi_rt_stack_top // clear recorded task SP value + str xzr, [x16, #-8] + ldp x19, x20, [sp, #32] ldp x21, x22, [sp, #48] ldp x23, x24, [sp, #64] |