arm64: bpf: Annotate JITed code for BTI
authorMark Brown <broonie@kernel.org>
Wed, 6 May 2020 19:51:32 +0000 (20:51 +0100)
committerWill Deacon <will@kernel.org>
Thu, 7 May 2020 16:53:20 +0000 (17:53 +0100)
commitfa76cfe65c1d748ef418e930a4b631a03b28f04c
tree88e80af33df552d3947701536401eedf38592828
parentc8027285e3660e3b76eb2fb75a32f1596064b5e4
arm64: bpf: Annotate JITed code for BTI

In order to extend the protection offered by BTI to all code executing in
kernel mode we need to annotate JITed BPF code appropriately for BTI. To
do this we need to add a landing pad to the start of each BPF function and
also immediately after the function prologue if we are emitting a function
which can be tail called. Jumps within BPF functions are all to immediate
offsets and therefore do not require landing pads.

Signed-off-by: Mark Brown <broonie@kernel.org>
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Link: https://lore.kernel.org/r/20200506195138.22086-6-broonie@kernel.org
Signed-off-by: Will Deacon <will@kernel.org>
arch/arm64/net/bpf_jit.h
arch/arm64/net/bpf_jit_comp.c