]> Git Repo - linux.git/commit
riscv, bpf: Add BPF exception tables
authorTong Tiangen <[email protected]>
Wed, 27 Oct 2021 11:18:22 +0000 (11:18 +0000)
committerDaniel Borkmann <[email protected]>
Wed, 27 Oct 2021 23:02:44 +0000 (01:02 +0200)
commit252c765bd764a246a8bd516fabf6d6123df4a24f
tree47ba312f3ec4698cd0829237b01d3f2bbc5ee492
parent03e6a7a94001b9582ef6549e5709f3d684217b28
riscv, bpf: 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 riscv 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.

A more generic solution would add a "handler" field to the table entry,
like on x86 and s390. The same issue in ARM64 is fixed in 800834285361
("bpf, arm64: Add BPF exception tables").

Signed-off-by: Tong Tiangen <[email protected]>
Signed-off-by: Daniel Borkmann <[email protected]>
Tested-by: Pu Lehui <[email protected]>
Tested-by: Björn Töpel <[email protected]>
Acked-by: Björn Töpel <[email protected]>
Link: https://lore.kernel.org/bpf/[email protected]
arch/riscv/mm/extable.c
arch/riscv/net/bpf_jit.h
arch/riscv/net/bpf_jit_comp64.c
arch/riscv/net/bpf_jit_core.c
This page took 0.043695 seconds and 4 git commands to generate.