Commit 97489e06 authored by Martin Schwidefsky's avatar Martin Schwidefsky

s390/lib: use expoline for indirect branches

The return from the memmove, memset, memcpy, __memset16, __memset32 and
__memset64 functions are done with "br %r14". These are indirect branches
as well and need to use execute trampolines for CONFIG_EXPOLINE=y.

Cc: stable@vger.kernel.org # 4.16
Fixes: f19fbd5e ("s390: introduce execute-trampolines for branches")
Reviewed-by: default avatarHendrik Brueckner <brueckner@linux.vnet.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent 467a3bf2
...@@ -7,6 +7,9 @@ ...@@ -7,6 +7,9 @@
#include <linux/linkage.h> #include <linux/linkage.h>
#include <asm/export.h> #include <asm/export.h>
#include <asm/nospec-insn.h>
GEN_BR_THUNK %r14
/* /*
* void *memmove(void *dest, const void *src, size_t n) * void *memmove(void *dest, const void *src, size_t n)
...@@ -33,14 +36,14 @@ ENTRY(memmove) ...@@ -33,14 +36,14 @@ ENTRY(memmove)
.Lmemmove_forward_remainder: .Lmemmove_forward_remainder:
larl %r5,.Lmemmove_mvc larl %r5,.Lmemmove_mvc
ex %r4,0(%r5) ex %r4,0(%r5)
br %r14 BR_EX %r14
.Lmemmove_reverse: .Lmemmove_reverse:
ic %r0,0(%r4,%r3) ic %r0,0(%r4,%r3)
stc %r0,0(%r4,%r1) stc %r0,0(%r4,%r1)
brctg %r4,.Lmemmove_reverse brctg %r4,.Lmemmove_reverse
ic %r0,0(%r4,%r3) ic %r0,0(%r4,%r3)
stc %r0,0(%r4,%r1) stc %r0,0(%r4,%r1)
br %r14 BR_EX %r14
.Lmemmove_mvc: .Lmemmove_mvc:
mvc 0(1,%r1),0(%r3) mvc 0(1,%r1),0(%r3)
EXPORT_SYMBOL(memmove) EXPORT_SYMBOL(memmove)
...@@ -77,7 +80,7 @@ ENTRY(memset) ...@@ -77,7 +80,7 @@ ENTRY(memset)
.Lmemset_clear_remainder: .Lmemset_clear_remainder:
larl %r3,.Lmemset_xc larl %r3,.Lmemset_xc
ex %r4,0(%r3) ex %r4,0(%r3)
br %r14 BR_EX %r14
.Lmemset_fill: .Lmemset_fill:
cghi %r4,1 cghi %r4,1
lgr %r1,%r2 lgr %r1,%r2
...@@ -95,10 +98,10 @@ ENTRY(memset) ...@@ -95,10 +98,10 @@ ENTRY(memset)
stc %r3,0(%r1) stc %r3,0(%r1)
larl %r5,.Lmemset_mvc larl %r5,.Lmemset_mvc
ex %r4,0(%r5) ex %r4,0(%r5)
br %r14 BR_EX %r14
.Lmemset_fill_exit: .Lmemset_fill_exit:
stc %r3,0(%r1) stc %r3,0(%r1)
br %r14 BR_EX %r14
.Lmemset_xc: .Lmemset_xc:
xc 0(1,%r1),0(%r1) xc 0(1,%r1),0(%r1)
.Lmemset_mvc: .Lmemset_mvc:
...@@ -121,7 +124,7 @@ ENTRY(memcpy) ...@@ -121,7 +124,7 @@ ENTRY(memcpy)
.Lmemcpy_remainder: .Lmemcpy_remainder:
larl %r5,.Lmemcpy_mvc larl %r5,.Lmemcpy_mvc
ex %r4,0(%r5) ex %r4,0(%r5)
br %r14 BR_EX %r14
.Lmemcpy_loop: .Lmemcpy_loop:
mvc 0(256,%r1),0(%r3) mvc 0(256,%r1),0(%r3)
la %r1,256(%r1) la %r1,256(%r1)
...@@ -159,10 +162,10 @@ ENTRY(__memset\bits) ...@@ -159,10 +162,10 @@ ENTRY(__memset\bits)
\insn %r3,0(%r1) \insn %r3,0(%r1)
larl %r5,.L__memset_mvc\bits larl %r5,.L__memset_mvc\bits
ex %r4,0(%r5) ex %r4,0(%r5)
br %r14 BR_EX %r14
.L__memset_exit\bits: .L__memset_exit\bits:
\insn %r3,0(%r2) \insn %r3,0(%r2)
br %r14 BR_EX %r14
.L__memset_mvc\bits: .L__memset_mvc\bits:
mvc \bytes(1,%r1),0(%r1) mvc \bytes(1,%r1),0(%r1)
.endm .endm
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment