]> git.baikalelectronics.ru Git - kernel.git/commit
bpf, arm64: Add BPF exception tables
authorJean-Philippe Brucker <jean-philippe@linaro.org>
Tue, 28 Jul 2020 15:21:26 +0000 (17:21 +0200)
committerDaniel Borkmann <daniel@iogearbox.net>
Thu, 30 Jul 2020 22:43:40 +0000 (00:43 +0200)
commit04c2fe760c4ca4d46e84f7169d52530766092673
tree3d71922e36f8eea73368d4cd821143bab2b9b6ad
parentd88f7047bddcf9d79b3f7a77cc2f6d9481e8e6b2
bpf, arm64: Add BPF exception tables

When a tracing BPF program attempts to read memory without using the
bpf_probe_read() helper, the verifier marks the load instruction with
the BPF_PROBE_MEM flag. Since the arm64 JIT does not currently recognize
this flag it falls back to the interpreter.

Add support for BPF_PROBE_MEM, by appending an exception table to the
BPF program. If the load instruction causes a data abort, the fixup
infrastructure finds the exception table and fixes up the fault, by
clearing the destination register and jumping over the faulting
instruction.

To keep the compact exception table entry format, inspect the pc in
fixup_exception(). A more generic solution would add a "handler" field
to the table entry, like on x86 and s390.

Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Song Liu <songliubraving@fb.com>
Link: https://lore.kernel.org/bpf/20200728152122.1292756-2-jean-philippe@linaro.org
arch/arm64/include/asm/extable.h
arch/arm64/mm/extable.c
arch/arm64/net/bpf_jit_comp.c