stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Martin Schwidefsky <schwidefsky@de.ibm.com>
To: Greg KH <greg@kroah.com>
Cc: stable@vger.kernel.org
Subject: Re: [PATCH 4/9] s390/ftrace: use expoline for indirect branches
Date: Mon, 28 May 2018 09:11:19 +0200	[thread overview]
Message-ID: <20180528091119.2267de99@mschwideX1> (raw)
In-Reply-To: <20180525140913.GA2559@kroah.com>

On Fri, 25 May 2018 16:09:13 +0200
Greg KH <greg@kroah.com> wrote:

> 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 :)

Uh-oh, yes. The reason is that the backport for 4.4 misses two lines
from nospec-insn.h:

+_LC_BR_R1 = __LC_BR_R1
+

The compile only fails for CONFIG_MARCH_Z900=y. With a newer processor
type it compiles just fine, I wonder why. Anyway I'll send a new patch.

-- 
blue skies,
   Martin.

"Reality continues to ruin my life." - Calvin.

  reply	other threads:[~2018-05-28  7:11 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-23 16:21 [PATCH 0/9] s390 spectre update for 4.4 Martin Schwidefsky
2018-05-23 16:21 ` [PATCH 1/9] s390: add assembler macros for CPU alternatives Martin Schwidefsky
2018-05-23 16:21 ` [PATCH 2/9] s390: move expoline assembler macros to a header Martin Schwidefsky
2018-05-23 16:21 ` [PATCH 3/9] s390/lib: use expoline for indirect branches Martin Schwidefsky
2018-05-23 16:21 ` [PATCH 4/9] s390/ftrace: " Martin Schwidefsky
2018-05-25 13:54   ` Greg KH
2018-05-25 14:09     ` Greg KH
2018-05-28  7:11       ` Martin Schwidefsky [this message]
2018-05-23 16:21 ` [PATCH 5/9] s390/kernel: " Martin Schwidefsky
2018-05-23 16:21 ` [PATCH 6/9] s390: move spectre sysfs attribute code Martin Schwidefsky
2018-05-23 16:21 ` [PATCH 7/9] s390: remove indirect branch from do_softirq_own_stack Martin Schwidefsky
2018-05-23 16:21 ` [PATCH 8/9] s390: extend expoline to BC instructions Martin Schwidefsky
2018-05-23 16:21 ` [PATCH 9/9] s390: use expoline thunks in the BPF JIT Martin Schwidefsky
2018-05-23 17:43 ` [PATCH 0/9] s390 spectre update for 4.4 Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180528091119.2267de99@mschwideX1 \
    --to=schwidefsky@de.ibm.com \
    --cc=greg@kroah.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).