diff options
author | Christoph Muellner <christoph.muellner@theobroma-systems.com> | 2018-05-15 10:25:30 +0200 |
---|---|---|
committer | Christoph Muellner <christoph.muellner@theobroma-systems.com> | 2018-05-16 00:11:58 +0200 |
commit | a8deb8044515dd10a4bbb96a1a76022fdd0636b4 (patch) | |
tree | 74229dfc3550f38931c95896585ebb8b59ed5280 | |
parent | 69610a2b7c7512f4e951d05b4fdf86b2e7d46770 (diff) |
arm64: asm: Use *_nospec variants for blr and br.
Replace indirect branch instructions (br and blr) by
*_nospec variants, which prevent speculative execution
in case CONFIG_RETPOLINE is enabled.
Signed-off-by: Christoph Muellner <christoph.muellner@theobroma-systems.com>
-rw-r--r-- | arch/arm64/kernel/entry-ftrace.S | 2 | ||||
-rw-r--r-- | arch/arm64/kernel/entry.S | 8 | ||||
-rw-r--r-- | arch/arm64/kvm/hyp/hyp-entry.S | 2 |
3 files changed, 6 insertions, 6 deletions
diff --git a/arch/arm64/kernel/entry-ftrace.S b/arch/arm64/kernel/entry-ftrace.S index 1175f5827ae1..8393d3db6022 100644 --- a/arch/arm64/kernel/entry-ftrace.S +++ b/arch/arm64/kernel/entry-ftrace.S @@ -106,7 +106,7 @@ ENTRY(_mcount) mcount_get_pc x0 // function's pc mcount_get_lr x1 // function's lr (= parent's pc) - blr x2 // (*ftrace_trace_function)(pc, lr); + blr_nospec x2 // (*ftrace_trace_function)(pc, lr); skip_ftrace_call: // } #ifdef CONFIG_FUNCTION_GRAPH_TRACER diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S index ec2ee720e33e..bc76a6a47eaf 100644 --- a/arch/arm64/kernel/entry.S +++ b/arch/arm64/kernel/entry.S @@ -395,7 +395,7 @@ tsk .req x28 // current thread_info ldr_l x1, handle_arch_irq mov x0, sp irq_stack_entry - blr x1 + blr_nospec x1 irq_stack_exit .endm @@ -950,7 +950,7 @@ el0_svc_naked: // compat entry point b.hs ni_sys mask_nospec64 xscno, xsc_nr, x19 // enforce bounds for syscall number ldr x16, [stbl, xscno, lsl #3] // address in the syscall table - blr x16 // call sys_* routine + blr_nospec x16 // call sys_* routine b ret_fast_syscall ni_sys: mov x0, sp @@ -980,7 +980,7 @@ __sys_trace: ldp x4, x5, [sp, #S_X4] ldp x6, x7, [sp, #S_X6] ldr x16, [stbl, xscno, lsl #3] // address in the syscall table - blr x16 // call sys_* routine + blr_nospec x16 // call sys_* routine __sys_trace_return: str x0, [sp, #S_X0] // save returned x0 @@ -1155,7 +1155,7 @@ ENTRY(ret_from_fork) bl schedule_tail cbz x19, 1f // not a kernel thread mov x0, x20 - blr x19 + blr_nospec x19 1: get_thread_info tsk b ret_to_user ENDPROC(ret_from_fork) diff --git a/arch/arm64/kvm/hyp/hyp-entry.S b/arch/arm64/kvm/hyp/hyp-entry.S index bffece27b5c1..383e2716daf1 100644 --- a/arch/arm64/kvm/hyp/hyp-entry.S +++ b/arch/arm64/kvm/hyp/hyp-entry.S @@ -39,7 +39,7 @@ mov x0, x1 mov x1, x2 mov x2, x3 - blr lr + blr_nospec_lr ldr lr, [sp], #16 .endm |