[PATCH] arm64: ftrace: add missing BTIs

Mark Rutland mark.rutland at arm.com
Mon Nov 29 09:37:51 PST 2021


On Mon, Nov 29, 2021 at 04:50:39PM +0000, Mark Brown wrote:
> On Mon, Nov 29, 2021 at 01:57:09PM +0000, Mark Rutland wrote:
> 
> > When branch target identifiers are in use, code reachable via an
> > indirect branch requires a BTI landing pad at the branch target site.
> 
> Reviewed-by: Mark Brown <broonie at kernel.org>

Cheers!

> > In future we may wish to consider adding a new SYM_CODE_START_*()
> > variant which has an implicit BTI.
> 
> > +#ifdef BTI_C
> > +	BTI_C
> > +#endif
> 
> The ifdefs here feel ugly enough that it might be worth doing that right
> now TBH.  I'm trying to think of any cases where we might also need a
> BTI J but nothing springs to mind right now.

Agreed on the ugliness -- I'd like to revisit that with some related
cleanup/improvement to our existing SYM_*() macros. I just didn't want to do
that as a prerequisite for the fix as it'd make backports painful, e.g. by
creating a dependency on commit:

  1cbdf60bd1b74e39 ("kasan: arm64: support specialized outlined tag mismatch checks")

... which uses the ifdef pattern above.

I'm also not sure what naming/structure we'd like, or whether it's simpler to
unconditionally define BTI_C.

Thanks,
Mark.



More information about the linux-arm-kernel mailing list