Re: [PATCH v3 00/11] arm64: BTI kernel and vDSO support

Will Deacon
2020-05-07T14:59:14Z

On Thu, May 07, 2020 at 03:35:47PM +0100, Will Deacon wrote:
> On Thu, May 07, 2020 at 03:33:32PM +0100, Will Deacon wrote:
> > On Wed, May 06, 2020 at 08:51:27PM +0100, Mark Brown wrote:
> > > This patch series adds support for protecting the kernel and vDSO with
> > > BTI including code compiled with the BPF JIT at runtime.
> > >
> > > We build the kernel with annotations for BTI and then map the kernel
> > > with GP based on the support on the boot CPU, rejecting secondaries that
> > > don't have BTI support. If there is a need to handle big.LITTLE systems
> > > with mismatched BTI support we will have to revisit this, currently no
> > > such implementations exist.
> > >
> > > This series depends on several branches in the arm64 tree:
> > >
> > > - for-next/bti-user
> > > - for-next/insn
> > > - for-next/asm
> > >
> > > v3:
> > > - Add a patch adding a comment about why we enable leaf support for
> > > PAC.
> > > - Fix build of the 32 bit vDSO.
> > > - Refactor the macro for emitting the ELF note for BTI code so that
> > > the flags are defined separately in order to make it easier to
> > > add handling for any future users.
> >
> > Bugger, I'm still getting warnings (clang 11.0.1), but from an allmodconfig
> > build now:
> >
> > warning: some functions compiled with BTI and some compiled without BTI
> > warning: not setting BTI in feature flags
> >
> > (repeated many, many times).
> >
> > I'll try to get you some more info.
>
> Quick look at the log suggests that these are caused by HDRTEST, whatever
> that is.

Sorry, my parallel build threw me off, so I don't think it's HDRTEST after
all. One of the problems appears to be tracing:

CC kernel/trace/trace_clock.o
warning: some functions compiled with BTI and some compiled without BTI
warning: not setting BTI in feature flags

Looking at objdump, there are funny gcov functions with PACISAP prologues:

0000000000023e40 <__llvm_gcov_writeout>:
23e40: a9be57fe stp x30, x21, [sp, #-32]!
23e44: a9014ff4 stp x20, x19, [sp, #16]
23e48: 94000000 bl 0 <__sanitizer_cov_trace_pc>
23e4c: 90000000 adrp x0, 0 <__register_ftrace_function>
23e50: 90000001 adrp x1, 0 <__register_ftrace_function>
23e54: 5293ac02 mov w2, #0x9d60 // #40288
23e58: 91000000 add x0, x0, #0x0
[...]

:/

Will