Re: [PATCH v2 02/10] arm64: asm: Override SYM_FUNC_START when building the kernel with BTI

Will Deacon
2020-05-05T16:09:01Z

On Tue, May 05, 2020 at 04:18:06PM +0100, Mark Brown wrote:
> On Tue, May 05, 2020 at 03:56:42PM +0100, Will Deacon wrote:
> > On Wed, Apr 29, 2020 at 10:16:33PM +0100, Mark Brown wrote:
>
> > > +#define SYM_INNER_LABEL(name, linkage) \
> > > + .type name SYM_T_NONE ASM_NL \
> > > + SYM_ENTRY(name, linkage, SYM_A_NONE) \
> > > + BTI_J
>
> > This break building the compat vDSO:
>
> Right, fixed locally.

Thanks!

> > I also see a scary linker warning about the native VDSO:
>
> > aarch64-none-linux-gnu-ld: arch/arm64/kernel/vdso/vgettimeofday.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
>
> I can't reproduce this, I am using clang-10 as well... can you share
> your exact command line and config? I'm using
>
> make -j56 ARCH=arm64 CROSS_COMPILE=aarch64-none-linux-gnu- CC=clang-10
>
> which is the same clang version as you, not that I'd expect that to make
> a difference. This looks like the C code isn't being built with BTI
> enabled but I can't see how you're managing to do that and I'm not -
> this is the warning that "arm64: vdso: Force the VDSO to be linked as
> BTI when built for BTI" is intended to trigger if something goes wrong
> so I guess it's a good job I enabled that :/

Just been debugging this, and it seems that not all clangs are created
equal. Updating mine from 10.0.2 to 11.0.1 means I now get the
'.note.gnu.property' sections emitted for C files compiled using
'-mbranch-protection=pac-ret+leaf+bti', whereas I didn't before.

Cheers,

Will