summaryrefslogtreecommitdiff
path: root/arch/s390/include/asm/nospec-insn.h
diff options
context:
space:
mode:
authorVasily Gorbik <gor@linux.ibm.com>2022-03-06 22:56:07 +0300
committerVasily Gorbik <gor@linux.ibm.com>2022-03-10 17:58:17 +0300
commit1d2ad084800edad81cdc955304272742b10721c7 (patch)
treedc6e27260422f6792ffb40a3e7b4d06c7fcf0720 /arch/s390/include/asm/nospec-insn.h
parenteed38cd2f46f6c4f97c730abd8f23a19db0afbc8 (diff)
downloadlinux-1d2ad084800edad81cdc955304272742b10721c7.tar.xz
s390/nospec: add an option to use thunk-extern
Currently with -mindirect-branch=thunk and -mfunction-return=thunk compiler options expoline thunks are put into individual COMDAT group sections. s390 is the only architecture which has group sections and it has implications for kpatch and objtool tools support. Using -mindirect-branch=thunk-extern and -mfunction-return=thunk-extern is an alternative, which comes with a need to generate all required expoline thunks manually. Unfortunately modules area is too far away from the kernel image, and expolines from the kernel image cannon be used. But since all new distributions (except Debian) build kernels for machine generations newer than z10, where "exrl" instruction is available, that leaves only 16 expolines thunks possible. Provide an option to build the kernel with -mindirect-branch=thunk-extern and -mfunction-return=thunk-extern for z10 or newer. This also requires to postlink expoline thunks into all modules explicitly. Currently modules already contain most expolines anyhow. Unfortunately -mindirect-branch=thunk-extern and -mfunction-return=thunk-extern options support is broken in gcc <= 11.2. Additional compile test is required to verify proper gcc support. Acked-by: Ilya Leoshkevich <iii@linux.ibm.com> Co-developed-by: Sumanth Korikkar <sumanthk@linux.ibm.com> Signed-off-by: Sumanth Korikkar <sumanthk@linux.ibm.com> Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Diffstat (limited to 'arch/s390/include/asm/nospec-insn.h')
-rw-r--r--arch/s390/include/asm/nospec-insn.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/arch/s390/include/asm/nospec-insn.h b/arch/s390/include/asm/nospec-insn.h
index 4397eae15e34..bbb5c4d84db9 100644
--- a/arch/s390/include/asm/nospec-insn.h
+++ b/arch/s390/include/asm/nospec-insn.h
@@ -18,7 +18,11 @@ _LC_BR_R1 = __LC_BR_R1
* the various thunks are merged into a single copy.
*/
.macro __THUNK_PROLOG_NAME name
+#ifdef CONFIG_EXPOLINE_EXTERN
+ .pushsection .text,"ax",@progbits
+#else
.pushsection .text.\name,"axG",@progbits,\name,comdat
+#endif
.globl \name
.hidden \name
.type \name,@function
@@ -115,7 +119,13 @@ _LC_BR_R1 = __LC_BR_R1
555: br \reg
.endm
+#ifdef CONFIG_EXPOLINE_EXTERN
+ .macro GEN_BR_THUNK reg,ruse=%r1
+ .endm
+ .macro GEN_BR_THUNK_EXTERN reg,ruse=%r1
+#else
.macro GEN_BR_THUNK reg,ruse=%r1
+#endif
__DECODE_RR __THUNK_PROLOG_BR,\reg,\ruse
__THUNK_EX_BR \reg,\ruse
__THUNK_EPILOG