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

Will Deacon
2020-05-05T14:56:50Z

On Wed, Apr 29, 2020 at 10:16:33PM +0100, Mark Brown wrote:
> +#define SYM_FUNC_START(name) \
> + SYM_START(name, SYM_L_GLOBAL, SYM_A_ALIGN) \
> + BTI_C
> +
> +#define SYM_FUNC_START_NOALIGN(name) \
> + SYM_START(name, SYM_L_GLOBAL, SYM_A_NONE) \
> + BTI_C
> +
> +#define SYM_FUNC_START_LOCAL(name) \
> + SYM_START(name, SYM_L_LOCAL, SYM_A_ALIGN) \
> + BTI_C
> +
> +#define SYM_FUNC_START_LOCAL_NOALIGN(name) \
> + SYM_START(name, SYM_L_LOCAL, SYM_A_NONE) \
> + BTI_C
> +
> +#define SYM_FUNC_START_WEAK(name) \
> + SYM_START(name, SYM_L_WEAK, SYM_A_ALIGN) \
> + BTI_C
> +
> +#define SYM_FUNC_START_WEAK_NOALIGN(name) \
> + SYM_START(name, SYM_L_WEAK, SYM_A_NONE) \
> + BTI_C
> +
> +#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:

arch/arm64/kernel/vdso32/sigreturn.S: Assembler messages:
arch/arm64/kernel/vdso32/sigreturn.S:20: Error: bad instruction `hint 34'
arch/arm64/kernel/vdso32/sigreturn.S:30: Error: bad instruction `hint 34'
arch/arm64/kernel/vdso32/sigreturn.S:41: Error: bad instruction `hint 34'
arch/arm64/kernel/vdso32/sigreturn.S:51: Error: bad instruction `hint 34'
clang-10: error: assembler command failed with exit code 1 (use -v to see invocation)

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.

Will