The arm64 test machine boot failed when using hulk_defconfig after d63c76835476 ("arm64: efi: Execute runtime services from a dedicated stack"), revert it first for weekly release.
Wei Li (3): Revert "arm64: efi: Make efi_rt_lock a raw_spinlock" Revert "arm64: efi: Recover from synchronous exceptions occurring in firmware" Revert "arm64: efi: Execute runtime services from a dedicated stack"
arch/arm64/include/asm/efi.h | 12 ------ arch/arm64/kernel/efi-rt-wrapper.S | 39 ++----------------- arch/arm64/kernel/efi.c | 50 ------------------------- arch/arm64/mm/fault.c | 4 -- drivers/firmware/efi/runtime-wrappers.c | 1 - 5 files changed, 3 insertions(+), 103 deletions(-)
hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I80QRY CVE: NA
--------------------------------
This reverts commit 213aa9a96141dff62378d075c452fc5e5ff72628.
Signed-off-by: Wei Li liwei391@huawei.com --- arch/arm64/include/asm/efi.h | 6 +++--- arch/arm64/kernel/efi.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/arch/arm64/include/asm/efi.h b/arch/arm64/include/asm/efi.h index 647ea987da0e..3cc753db9035 100644 --- a/arch/arm64/include/asm/efi.h +++ b/arch/arm64/include/asm/efi.h @@ -34,7 +34,7 @@ int efi_set_mapping_permissions(struct mm_struct *mm, efi_memory_desc_t *md); ({ \ efi_virtmap_load(); \ __efi_fpsimd_begin(); \ - raw_spin_lock(&efi_rt_lock); \ + spin_lock(&efi_rt_lock); \ })
#define arch_efi_call_virt(p, f, args...) \ @@ -46,12 +46,12 @@ int efi_set_mapping_permissions(struct mm_struct *mm, efi_memory_desc_t *md);
#define arch_efi_call_virt_teardown() \ ({ \ - raw_spin_unlock(&efi_rt_lock); \ + spin_unlock(&efi_rt_lock); \ __efi_fpsimd_end(); \ efi_virtmap_unload(); \ })
-extern raw_spinlock_t efi_rt_lock; +extern spinlock_t efi_rt_lock; efi_status_t __efi_rt_asm_wrapper(void *, const char *, ...);
#define ARCH_EFI_IRQ_FLAGS_MASK (PSR_D_BIT | PSR_A_BIT | PSR_I_BIT | PSR_F_BIT) diff --git a/arch/arm64/kernel/efi.c b/arch/arm64/kernel/efi.c index b2a3d5f5d36f..923970fb0394 100644 --- a/arch/arm64/kernel/efi.c +++ b/arch/arm64/kernel/efi.c @@ -133,7 +133,7 @@ asmlinkage efi_status_t efi_handle_corrupted_x18(efi_status_t s, const char *f) return s; }
-DEFINE_RAW_SPINLOCK(efi_rt_lock); +DEFINE_SPINLOCK(efi_rt_lock);
asmlinkage u64 *efi_rt_stack_top __ro_after_init;
hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I80QRY CVE: NA
--------------------------------
This reverts commit 7c55f3f97afa71cde005b5ed89bf7944c6f7c9ec.
Signed-off-by: Wei Li liwei391@huawei.com --- arch/arm64/include/asm/efi.h | 9 ------- arch/arm64/kernel/efi-rt-wrapper.S | 32 ++++--------------------- arch/arm64/kernel/efi.c | 22 ----------------- arch/arm64/mm/fault.c | 4 ---- drivers/firmware/efi/runtime-wrappers.c | 1 - 5 files changed, 5 insertions(+), 63 deletions(-)
diff --git a/arch/arm64/include/asm/efi.h b/arch/arm64/include/asm/efi.h index 3cc753db9035..9e780a68883c 100644 --- a/arch/arm64/include/asm/efi.h +++ b/arch/arm64/include/asm/efi.h @@ -11,20 +11,11 @@ #include <asm/neon.h> #include <asm/ptrace.h> #include <asm/tlbflush.h> -#include <linux/efi.h>
#ifdef CONFIG_EFI extern void efi_init(void); - -bool efi_runtime_fixup_exception(struct pt_regs *regs, const char *msg); #else #define efi_init() - -static inline -bool efi_runtime_fixup_exception(struct pt_regs *regs, const char *msg) -{ - return false; -} #endif
int efi_create_mapping(struct mm_struct *mm, efi_memory_desc_t *md); diff --git a/arch/arm64/kernel/efi-rt-wrapper.S b/arch/arm64/kernel/efi-rt-wrapper.S index a9ae26e176f1..e275bf6407bc 100644 --- a/arch/arm64/kernel/efi-rt-wrapper.S +++ b/arch/arm64/kernel/efi-rt-wrapper.S @@ -10,7 +10,7 @@ #include <asm/assembler.h>
ENTRY(__efi_rt_asm_wrapper) - stp x29, x30, [sp, #-112]! + stp x29, x30, [sp, #-32]! mov x29, sp
/* @@ -20,21 +20,11 @@ ENTRY(__efi_rt_asm_wrapper) */ stp x1, x18, [sp, #16]
- /* - * Preserve all callee saved registers and preserve the stack pointer - * value at the base of the EFI runtime stack so we can recover from - * synchronous exceptions occurring while executing the firmware - * routines. - */ - stp x19, x20, [sp, #32] - stp x21, x22, [sp, #48] - stp x23, x24, [sp, #64] - stp x25, x26, [sp, #80] - stp x27, x28, [sp, #96] - ldr_l x16, efi_rt_stack_top mov sp, x16 - stp x18, x29, [sp, #-16]! +#ifdef CONFIG_SHADOW_CALL_STACK + str x18, [sp, #-16]! +#endif
/* * We are lucky enough that no EFI runtime services take more than @@ -52,7 +42,7 @@ ENTRY(__efi_rt_asm_wrapper) mov sp, x29 ldp x1, x2, [sp, #16] cmp x2, x18 - ldp x29, x30, [sp], #112 + ldp x29, x30, [sp], #32 b.ne 0f ret 0: @@ -70,15 +60,3 @@ ENTRY(__efi_rt_asm_wrapper)
b efi_handle_corrupted_x18 // tail call ENDPROC(__efi_rt_asm_wrapper) - -ENTRY(__efi_rt_asm_recover) - mov sp, x30 - - ldp x19, x20, [sp, #32] - ldp x21, x22, [sp, #48] - ldp x23, x24, [sp, #64] - ldp x25, x26, [sp, #80] - ldp x27, x28, [sp, #96] - ldp x29, x30, [sp], #112 - ret -ENDPROC(__efi_rt_asm_recover) diff --git a/arch/arm64/kernel/efi.c b/arch/arm64/kernel/efi.c index 923970fb0394..fb7f5e9e8114 100644 --- a/arch/arm64/kernel/efi.c +++ b/arch/arm64/kernel/efi.c @@ -137,28 +137,6 @@ DEFINE_SPINLOCK(efi_rt_lock);
asmlinkage u64 *efi_rt_stack_top __ro_after_init;
-asmlinkage efi_status_t __efi_rt_asm_recover(void); - -bool efi_runtime_fixup_exception(struct pt_regs *regs, const char *msg) -{ - /* Check whether the exception occurred while running the firmware */ - if (current_work() != &efi_rts_work.work || regs->pc >= TASK_SIZE_64) - return false; - - pr_err(FW_BUG "Unable to handle %s in EFI runtime service\n", msg); - add_taint(TAINT_FIRMWARE_WORKAROUND, LOCKDEP_STILL_OK); - clear_bit(EFI_RUNTIME_SERVICES, &efi.flags); - - regs->regs[0] = EFI_ABORTED; - regs->regs[30] = efi_rt_stack_top[-1]; - regs->pc = (u64)__efi_rt_asm_recover; - - if (IS_ENABLED(CONFIG_SHADOW_CALL_STACK)) - regs->regs[18] = efi_rt_stack_top[-2]; - - return true; -} - /* EFI requires 8 KiB of stack space for runtime services */ static_assert(THREAD_SIZE >= SZ_8K);
diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c index a3c33ccecd83..96bfdade877a 100644 --- a/arch/arm64/mm/fault.c +++ b/arch/arm64/mm/fault.c @@ -37,7 +37,6 @@ #include <asm/bug.h> #include <asm/cmpxchg.h> #include <asm/cpufeature.h> -#include <asm/efi.h> #include <asm/exception.h> #include <asm/daifflags.h> #include <asm/debug-monitors.h> @@ -333,9 +332,6 @@ static void __do_kernel_fault(unsigned long addr, unsigned int esr, msg = "paging request"; }
- if (efi_runtime_fixup_exception(regs, msg)) - return; - die_kernel_fault(msg, addr, esr, regs); }
diff --git a/drivers/firmware/efi/runtime-wrappers.c b/drivers/firmware/efi/runtime-wrappers.c index cba62aded6d1..f40c0e215f84 100644 --- a/drivers/firmware/efi/runtime-wrappers.c +++ b/drivers/firmware/efi/runtime-wrappers.c @@ -85,7 +85,6 @@ struct efi_runtime_work efi_rts_work; else \ pr_err("Failed to queue work to efi_rts_wq.\n"); \ \ - WARN_ON_ONCE(efi_rts_work.status == EFI_ABORTED); \ exit: \ efi_rts_work.efi_rts_id = EFI_NONE; \ efi_rts_work.status; \
hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I80QRY CVE: NA
--------------------------------
This reverts commit d63c76835476f9cb183af549d790dc7893cd07b8.
Signed-off-by: Wei Li liwei391@huawei.com --- arch/arm64/include/asm/efi.h | 3 --- arch/arm64/kernel/efi-rt-wrapper.S | 13 +------------ arch/arm64/kernel/efi.c | 28 ---------------------------- 3 files changed, 1 insertion(+), 43 deletions(-)
diff --git a/arch/arm64/include/asm/efi.h b/arch/arm64/include/asm/efi.h index 9e780a68883c..d3cb42fd51ec 100644 --- a/arch/arm64/include/asm/efi.h +++ b/arch/arm64/include/asm/efi.h @@ -25,7 +25,6 @@ int efi_set_mapping_permissions(struct mm_struct *mm, efi_memory_desc_t *md); ({ \ efi_virtmap_load(); \ __efi_fpsimd_begin(); \ - spin_lock(&efi_rt_lock); \ })
#define arch_efi_call_virt(p, f, args...) \ @@ -37,12 +36,10 @@ int efi_set_mapping_permissions(struct mm_struct *mm, efi_memory_desc_t *md);
#define arch_efi_call_virt_teardown() \ ({ \ - spin_unlock(&efi_rt_lock); \ __efi_fpsimd_end(); \ efi_virtmap_unload(); \ })
-extern spinlock_t efi_rt_lock; efi_status_t __efi_rt_asm_wrapper(void *, const char *, ...);
#define ARCH_EFI_IRQ_FLAGS_MASK (PSR_D_BIT | PSR_A_BIT | PSR_I_BIT | PSR_F_BIT) diff --git a/arch/arm64/kernel/efi-rt-wrapper.S b/arch/arm64/kernel/efi-rt-wrapper.S index e275bf6407bc..f513e6af971b 100644 --- a/arch/arm64/kernel/efi-rt-wrapper.S +++ b/arch/arm64/kernel/efi-rt-wrapper.S @@ -20,12 +20,6 @@ ENTRY(__efi_rt_asm_wrapper) */ stp x1, x18, [sp, #16]
- ldr_l x16, efi_rt_stack_top - mov sp, x16 -#ifdef CONFIG_SHADOW_CALL_STACK - str x18, [sp, #-16]! -#endif - /* * We are lucky enough that no EFI runtime services take more than * 5 arguments, so all are passed in registers rather than via the @@ -39,7 +33,6 @@ ENTRY(__efi_rt_asm_wrapper) mov x4, x6 blr x8
- mov sp, x29 ldp x1, x2, [sp, #16] cmp x2, x18 ldp x29, x30, [sp], #32 @@ -53,10 +46,6 @@ ENTRY(__efi_rt_asm_wrapper) * called with preemption disabled and a separate shadow stack is used * for interrupts. */ -#ifdef CONFIG_SHADOW_CALL_STACK - ldr_l x18, efi_rt_stack_top - ldr x18, [x18, #-16] -#endif - + mov x18, x2 b efi_handle_corrupted_x18 // tail call ENDPROC(__efi_rt_asm_wrapper) diff --git a/arch/arm64/kernel/efi.c b/arch/arm64/kernel/efi.c index fb7f5e9e8114..4f9acb5fbe97 100644 --- a/arch/arm64/kernel/efi.c +++ b/arch/arm64/kernel/efi.c @@ -132,31 +132,3 @@ asmlinkage efi_status_t efi_handle_corrupted_x18(efi_status_t s, const char *f) pr_err_ratelimited(FW_BUG "register x18 corrupted by EFI %s\n", f); return s; } - -DEFINE_SPINLOCK(efi_rt_lock); - -asmlinkage u64 *efi_rt_stack_top __ro_after_init; - -/* EFI requires 8 KiB of stack space for runtime services */ -static_assert(THREAD_SIZE >= SZ_8K); - -static int __init arm64_efi_rt_init(void) -{ - void *p; - - if (!efi_enabled(EFI_RUNTIME_SERVICES)) - return 0; - - p = __vmalloc_node(THREAD_SIZE, THREAD_ALIGN, GFP_KERNEL, - PAGE_KERNEL, 0, - NUMA_NO_NODE, &&l); -l: if (!p) { - pr_warn("Failed to allocate EFI runtime stack\n"); - clear_bit(EFI_RUNTIME_SERVICES, &efi.flags); - return -ENOMEM; - } - - efi_rt_stack_top = p + THREAD_SIZE; - return 0; -} -core_initcall(arm64_efi_rt_init);
反馈: 您发送到kernel@openeuler.org的补丁/补丁集,已成功转换为PR! PR链接地址: https://gitee.com/openeuler/kernel/pulls/2196 邮件列表地址:https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/L...
FeedBack: The patch(es) which you have sent to kernel@openeuler.org mailing list has been converted to a pull request successfully! Pull request link: https://gitee.com/openeuler/kernel/pulls/2196 Mailing list address: https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/L...