Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'efi-fixes-for-v6.1-4' of git://git.kernel.org/pub/scm/linux/kernel/git/efi/efi

Pull EFI fix from Ard Biesheuvel:
"A single revert for some code that I added during this cycle. The code
is not wrong, but it should be a bit more careful about how to handle
the shadow call stack pointer, so it is better to revert it for now
and bring it back later in improved form.

Summary:

- Revert runtime service sync exception recovery on arm64"

* tag 'efi-fixes-for-v6.1-4' of git://git.kernel.org/pub/scm/linux/kernel/git/efi/efi:
arm64: efi: Revert "Recover from synchronous exceptions ..."

+2 -69
-8
arch/arm64/include/asm/efi.h
··· 14 14 15 15 #ifdef CONFIG_EFI 16 16 extern void efi_init(void); 17 - 18 - bool efi_runtime_fixup_exception(struct pt_regs *regs, const char *msg); 19 17 #else 20 18 #define efi_init() 21 - 22 - static inline 23 - bool efi_runtime_fixup_exception(struct pt_regs *regs, const char *msg) 24 - { 25 - return false; 26 - } 27 19 #endif 28 20 29 21 int efi_create_mapping(struct mm_struct *mm, efi_memory_desc_t *md);
+2 -31
arch/arm64/kernel/efi-rt-wrapper.S
··· 6 6 #include <linux/linkage.h> 7 7 8 8 SYM_FUNC_START(__efi_rt_asm_wrapper) 9 - stp x29, x30, [sp, #-112]! 9 + stp x29, x30, [sp, #-32]! 10 10 mov x29, sp 11 11 12 12 /* ··· 15 15 * (such as UEFI) should never touch it. 16 16 */ 17 17 stp x1, x18, [sp, #16] 18 - 19 - /* 20 - * Preserve all callee saved registers and record the stack pointer 21 - * value in a per-CPU variable so we can recover from synchronous 22 - * exceptions occurring while running the firmware routines. 23 - */ 24 - stp x19, x20, [sp, #32] 25 - stp x21, x22, [sp, #48] 26 - stp x23, x24, [sp, #64] 27 - stp x25, x26, [sp, #80] 28 - stp x27, x28, [sp, #96] 29 - 30 - adr_this_cpu x8, __efi_rt_asm_recover_sp, x9 31 - str x29, [x8] 32 18 33 19 /* 34 20 * We are lucky enough that no EFI runtime services take more than ··· 31 45 32 46 ldp x1, x2, [sp, #16] 33 47 cmp x2, x18 34 - ldp x29, x30, [sp], #112 48 + ldp x29, x30, [sp], #32 35 49 b.ne 0f 36 50 ret 37 51 0: ··· 45 59 mov x18, x2 46 60 b efi_handle_corrupted_x18 // tail call 47 61 SYM_FUNC_END(__efi_rt_asm_wrapper) 48 - 49 - SYM_FUNC_START(__efi_rt_asm_recover) 50 - ldr_this_cpu x8, __efi_rt_asm_recover_sp, x9 51 - mov sp, x8 52 - 53 - ldp x0, x18, [sp, #16] 54 - ldp x19, x20, [sp, #32] 55 - ldp x21, x22, [sp, #48] 56 - ldp x23, x24, [sp, #64] 57 - ldp x25, x26, [sp, #80] 58 - ldp x27, x28, [sp, #96] 59 - ldp x29, x30, [sp], #112 60 - 61 - b efi_handle_runtime_exception 62 - SYM_FUNC_END(__efi_rt_asm_recover)
-26
arch/arm64/kernel/efi.c
··· 9 9 10 10 #include <linux/efi.h> 11 11 #include <linux/init.h> 12 - #include <linux/percpu.h> 13 12 14 13 #include <asm/efi.h> 15 14 ··· 143 144 { 144 145 pr_err_ratelimited(FW_BUG "register x18 corrupted by EFI %s\n", f); 145 146 return s; 146 - } 147 - 148 - asmlinkage DEFINE_PER_CPU(u64, __efi_rt_asm_recover_sp); 149 - 150 - asmlinkage efi_status_t __efi_rt_asm_recover(void); 151 - 152 - asmlinkage efi_status_t efi_handle_runtime_exception(const char *f) 153 - { 154 - pr_err(FW_BUG "Synchronous exception occurred in EFI runtime service %s()\n", f); 155 - clear_bit(EFI_RUNTIME_SERVICES, &efi.flags); 156 - return EFI_ABORTED; 157 - } 158 - 159 - bool efi_runtime_fixup_exception(struct pt_regs *regs, const char *msg) 160 - { 161 - /* Check whether the exception occurred while running the firmware */ 162 - if (current_work() != &efi_rts_work.work || regs->pc >= TASK_SIZE_64) 163 - return false; 164 - 165 - pr_err(FW_BUG "Unable to handle %s in EFI runtime service\n", msg); 166 - add_taint(TAINT_FIRMWARE_WORKAROUND, LOCKDEP_STILL_OK); 167 - dump_stack(); 168 - 169 - regs->pc = (u64)__efi_rt_asm_recover; 170 - return true; 171 147 }
-4
arch/arm64/mm/fault.c
··· 30 30 #include <asm/bug.h> 31 31 #include <asm/cmpxchg.h> 32 32 #include <asm/cpufeature.h> 33 - #include <asm/efi.h> 34 33 #include <asm/exception.h> 35 34 #include <asm/daifflags.h> 36 35 #include <asm/debug-monitors.h> ··· 390 391 391 392 msg = "paging request"; 392 393 } 393 - 394 - if (efi_runtime_fixup_exception(regs, msg)) 395 - return; 396 394 397 395 die_kernel_fault(msg, addr, esr, regs); 398 396 }