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

Will Deacon
2020-05-06T07:10:39Z

On Tue, May 05, 2020 at 06:21:00PM +0100, Mark Brown wrote:
> On Tue, May 05, 2020 at 05:08:53PM +0100, Will Deacon wrote:
> > On Tue, May 05, 2020 at 04:18:06PM +0100, Mark Brown wrote:
>
> > > > 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
>
> > 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.
>
> Oh, that's irritating. I'm using clang from the llvm.org packages,
> currently that's:
>
> 10.0.0-++20200115115127+cbe681bd833-1~exp1~20200115105727.528
>
> so if this is a clang issue it looks like they fixed it in the clang-10
> branch. I'm not sure it's worth trying to detect and handle this or
> not, I don't know how widely deployed toolchains that don't emit the
> property are and there's a fairly clear solution. What do you think?

The linker fixes this up when it warns, right? If so, I think the current
behaviour is fine *but* we might want to improve the diagnostic a bit not
to worry/confuse people. e.g. something like:

"Your compiler is not emitting '.note.gnu.property' sections: forcing
support for BTI in the linker, but consider upgrading your toolchain."

Will