Skip to content

Commit 355479c

Browse files
committed
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 parents e214dd9 + 7572ac3 commit 355479c

File tree

4 files changed

+2
-69
lines changed

4 files changed

+2
-69
lines changed

arch/arm64/include/asm/efi.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,8 @@
1414

1515
#ifdef CONFIG_EFI
1616
extern void efi_init(void);
17-
18-
bool efi_runtime_fixup_exception(struct pt_regs *regs, const char *msg);
1917
#else
2018
#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-
}
2719
#endif
2820

2921
int efi_create_mapping(struct mm_struct *mm, efi_memory_desc_t *md);

arch/arm64/kernel/efi-rt-wrapper.S

Lines changed: 2 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#include <linux/linkage.h>
77

88
SYM_FUNC_START(__efi_rt_asm_wrapper)
9-
stp x29, x30, [sp, #-112]!
9+
stp x29, x30, [sp, #-32]!
1010
mov x29, sp
1111

1212
/*
@@ -16,20 +16,6 @@ SYM_FUNC_START(__efi_rt_asm_wrapper)
1616
*/
1717
stp x1, x18, [sp, #16]
1818

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-
3319
/*
3420
* We are lucky enough that no EFI runtime services take more than
3521
* 5 arguments, so all are passed in registers rather than via the
@@ -45,7 +31,7 @@ SYM_FUNC_START(__efi_rt_asm_wrapper)
4531

4632
ldp x1, x2, [sp, #16]
4733
cmp x2, x18
48-
ldp x29, x30, [sp], #112
34+
ldp x29, x30, [sp], #32
4935
b.ne 0f
5036
ret
5137
0:
@@ -59,18 +45,3 @@ SYM_FUNC_START(__efi_rt_asm_wrapper)
5945
mov x18, x2
6046
b efi_handle_corrupted_x18 // tail call
6147
SYM_FUNC_END(__efi_rt_asm_wrapper)
62-
63-
SYM_FUNC_START(__efi_rt_asm_recover)
64-
ldr_this_cpu x8, __efi_rt_asm_recover_sp, x9
65-
mov sp, x8
66-
67-
ldp x0, x18, [sp, #16]
68-
ldp x19, x20, [sp, #32]
69-
ldp x21, x22, [sp, #48]
70-
ldp x23, x24, [sp, #64]
71-
ldp x25, x26, [sp, #80]
72-
ldp x27, x28, [sp, #96]
73-
ldp x29, x30, [sp], #112
74-
75-
b efi_handle_runtime_exception
76-
SYM_FUNC_END(__efi_rt_asm_recover)

arch/arm64/kernel/efi.c

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
#include <linux/efi.h>
1111
#include <linux/init.h>
12-
#include <linux/percpu.h>
1312

1413
#include <asm/efi.h>
1514

@@ -145,28 +144,3 @@ asmlinkage efi_status_t efi_handle_corrupted_x18(efi_status_t s, const char *f)
145144
pr_err_ratelimited(FW_BUG "register x18 corrupted by EFI %s\n", f);
146145
return s;
147146
}
148-
149-
asmlinkage DEFINE_PER_CPU(u64, __efi_rt_asm_recover_sp);
150-
151-
asmlinkage efi_status_t __efi_rt_asm_recover(void);
152-
153-
asmlinkage efi_status_t efi_handle_runtime_exception(const char *f)
154-
{
155-
pr_err(FW_BUG "Synchronous exception occurred in EFI runtime service %s()\n", f);
156-
clear_bit(EFI_RUNTIME_SERVICES, &efi.flags);
157-
return EFI_ABORTED;
158-
}
159-
160-
bool efi_runtime_fixup_exception(struct pt_regs *regs, const char *msg)
161-
{
162-
/* Check whether the exception occurred while running the firmware */
163-
if (current_work() != &efi_rts_work.work || regs->pc >= TASK_SIZE_64)
164-
return false;
165-
166-
pr_err(FW_BUG "Unable to handle %s in EFI runtime service\n", msg);
167-
add_taint(TAINT_FIRMWARE_WORKAROUND, LOCKDEP_STILL_OK);
168-
dump_stack();
169-
170-
regs->pc = (u64)__efi_rt_asm_recover;
171-
return true;
172-
}

arch/arm64/mm/fault.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
#include <asm/bug.h>
3131
#include <asm/cmpxchg.h>
3232
#include <asm/cpufeature.h>
33-
#include <asm/efi.h>
3433
#include <asm/exception.h>
3534
#include <asm/daifflags.h>
3635
#include <asm/debug-monitors.h>
@@ -392,9 +391,6 @@ static void __do_kernel_fault(unsigned long addr, unsigned long esr,
392391
msg = "paging request";
393392
}
394393

395-
if (efi_runtime_fixup_exception(regs, msg))
396-
return;
397-
398394
die_kernel_fault(msg, addr, esr, regs);
399395
}
400396

0 commit comments

Comments
 (0)