diff options
author | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2018-01-26 14:46:47 +0300 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2018-02-07 17:57:02 +0300 |
commit | f19fbd5ed642dc31c809596412dab1ed56f2f156 (patch) | |
tree | b1ef7f48d102801d718baab1ae4cec2588cc5862 /arch/s390/Kconfig | |
parent | 6b73044b2b0081ee3dd1cd6eaab7dee552601efb (diff) | |
download | linux-f19fbd5ed642dc31c809596412dab1ed56f2f156.tar.xz |
s390: introduce execute-trampolines for branches
Add CONFIG_EXPOLINE to enable the use of the new -mindirect-branch= and
-mfunction_return= compiler options to create a kernel fortified against
the specte v2 attack.
With CONFIG_EXPOLINE=y all indirect branches will be issued with an
execute type instruction. For z10 or newer the EXRL instruction will
be used, for older machines the EX instruction. The typical indirect
call
basr %r14,%r1
is replaced with a PC relative call to a new thunk
brasl %r14,__s390x_indirect_jump_r1
The thunk contains the EXRL/EX instruction to the indirect branch
__s390x_indirect_jump_r1:
exrl 0,0f
j .
0: br %r1
The detour via the execute type instruction has a performance impact.
To get rid of the detour the new kernel parameter "nospectre_v2" and
"spectre_v2=[on,off,auto]" can be used. If the parameter is specified
the kernel and module code will be patched at runtime.
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390/Kconfig')
-rw-r--r-- | arch/s390/Kconfig | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig index d514e25095c2..0636229dae22 100644 --- a/arch/s390/Kconfig +++ b/arch/s390/Kconfig @@ -557,6 +557,34 @@ config KERNEL_NOBP If unsure, say N. +config EXPOLINE + def_bool n + prompt "Avoid speculative indirect branches in the kernel" + help + Compile the kernel with the expoline compiler options to guard + against kernel-to-user data leaks by avoiding speculative indirect + branches. + Requires a compiler with -mindirect-branch=thunk support for full + protection. The kernel may run slower. + + If unsure, say N. + +choice + prompt "Expoline default" + depends on EXPOLINE + default EXPOLINE_FULL + +config EXPOLINE_OFF + bool "spectre_v2=off" + +config EXPOLINE_MEDIUM + bool "spectre_v2=auto" + +config EXPOLINE_FULL + bool "spectre_v2=on" + +endchoice + endmenu menu "Memory setup" |