On Fri, May 25, 2018 at 03:54:20PM +0200, Greg KH wrote:
On Wed, May 23, 2018 at 06:21:31PM +0200, Martin Schwidefsky wrote:
[ Upstream commit 23a4d7fd34856da8218c4cfc23dba7a6ec0a423a ]
The return from the ftrace_stub, _mcount, ftrace_caller and return_to_handler functions is done with "br %r14" and "br %r1". These are indirect branches as well and need to use execute trampolines for CONFIG_EXPOLINE=y.
The ftrace_caller function is a special case as it returns to the start of a function and may only use %r0 and %r1. For a pre z10 machine the standard execute trampoline uses a LARL + EX to do this, but this requires *two* registers in the range %r1..%r15. To get around this the 'br %r1' located in the lowcore is used, then the EX instruction does not need an address register. But the lowcore trick may only be used for pre z14 machines, with noexec=on the mapping for the first page may not contain instructions. The solution for that is an ALTERNATIVE in the expoline THUNK generated by 'GEN_BR_THUNK %r1' to switch to EXRL, this relies on the fact that a machine that supports noexec=on has EXRL as well.
Cc: stable@vger.kernel.org # 4.16 Fixes: f19fbd5ed6 ("s390: introduce execute-trampolines for branches") Signed-off-by: Martin Schwidefsky schwidefsky@de.ibm.com
arch/s390/include/asm/nospec-insn.h | 11 +++++++++++ arch/s390/kernel/asm-offsets.c | 1 + arch/s390/kernel/mcount.S | 14 +++++++++----- 3 files changed, 21 insertions(+), 5 deletions(-)
This patch breaks the build for 'allmodconfig' for s390, but defconfig works fine :(
The error is: LD init/built-in.o arch/s390/built-in.o: In function `__s390x_indirect_jump_r1use_r1': (.text.__s390x_indirect_jump_r1use_r1[__s390x_indirect_jump_r1use_r1]+0x2): undefined reference to `_LC_BR_R1' make: *** [Makefile:956: vmlinux] Error 1
So I'm going to drop this patch, and the rest in the series, from the 4.4.y tree. Can you please fix this up and resend the needed patches after I do the next 4.4.y kernel release?
Hm, it looks like everything at least boots with just this one patch removed, so I've done that. I have no idea if it boots, I'll leave that to people who have access to those types of boxes :)
thanks,
greg k-h