summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Muellner <christoph.muellner@theobroma-systems.com>2018-05-15 10:25:30 +0200
committerChristoph Muellner <christoph.muellner@theobroma-systems.com>2018-05-23 13:00:32 +0200
commit62f249fad38a13f7f2f2262a941ea8a56ada2b9f (patch)
tree05671a758d09b2516bbfb75875f4e8b76b0d0572
parent3f70392c65d21618e31128451743abb93cb1e396 (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.S2
-rw-r--r--arch/arm64/kernel/entry.S8
-rw-r--r--arch/arm64/kvm/hyp/hyp-entry.S2
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 f36464bd57c5..2e098c1248f7 100644
--- a/arch/arm64/kvm/hyp/hyp-entry.S
+++ b/arch/arm64/kvm/hyp/hyp-entry.S
@@ -38,7 +38,7 @@
mov x0, x1
mov x1, x2
mov x2, x3
- blr lr
+ blr_nospec_lr
ldr lr, [sp], #16
.endm