[PATCH] arm64: Don't insert a BTI instruction at inner labels

Dave Martin Dave.Martin at arm.com
Wed Jun 24 09:44:25 EDT 2020


On Wed, Jun 24, 2020 at 02:21:14PM +0100, Mark Brown wrote:
> On Wed, Jun 24, 2020 at 01:22:54PM +0200, Jean-Philippe Brucker wrote:
> 
> > It turns out we don't currently need the BTI landing pads inserted by
> > SYM_INNER_LABEL:
> 
> > * ftrace_call and ftrace_graph_call are only used for runtime patching
> >   of the active tracer. The patched code is not reached from a branch.
> > * install_el2_stub is reached from a CBZ instruction, which doesn't
> >   change PSTATE.BTYPE.
> > * __guest_exit is reached from B instructions in the hyp-entry vectors,
> >   which aren't subject to BTI checks either.
> 
> > Remove the BTI annotation from SYM_INNER_LABEL.
> 
> This fixes things for now but it feels like it's going to be fragile in
> the long run since inner labels are a bit of a wild west in terms of how
> they're going to be referenced - I can't think of a better solution at
> this level though :(
> 
> Reviewed-by: Mark Brown <broonie at kernel.org>

Since inner labels requiring landing pads are going to be the exception
rather than the rule, perhaps we can introduce a different macro for
this.  It feels arch-specific to me (indeed, inner labels are kind of
arch-specific, since they're inevitably in the middle of some asm that
is unlikely to be handled by core code).

Do we know of any code that requires landing pads on inner labels?

The uaccess fault stuff probably doesn't, because the error path is
reached via ERET.  I wondered about the suspend/resume code in sleep.S,
but I don't see any inner labels in there.

Cheers
---Dave



More information about the linux-arm-kernel mailing list