[RFC PATCH bpf-next 0/7] bpf: Implement BPF_LINK_UPDATE for tracing links
Jordan Rife
jordan at jrife.io
Mon Nov 17 16:52:52 PST 2025
Implement update_prog for bpf_tracing_link_lops to enable
BPF_LINK_UPDATE for fentry, fexit, fmod_ret, freplace, etc. links.
My initial motivation for this was to enable a use case where one
process creates and owns links pointing to "hooks" within a tc, xdp, ...
attachment and an external "plugin" loads freplace programs and updates
links to these hooks. Aside from that though, it seemed like it could
be useful to be able to atomically swap out the program associated with
an freplace/fentry/fexit/fmod_ret link more generally.
Implementing program updates for freplace links was fairly
straightforward but proved more difficult for the other link types. The
third patch in this series discusses some other approaches I considered
before settling on the current approach, but I'd appreciate others'
input here to see if there is a better way to implement this that
doesn't require architecture-specific changes.
Thanks!
Jordan
Jordan Rife (7):
bpf: Set up update_prog scaffolding for bpf_tracing_link_lops
bpf: Enable BPF_LINK_UPDATE for freplace links
bpf: Enable BPF_LINK_UPDATE for fentry/fexit/fmod_ret links
bpf, x86: Make program update work for trampoline ops
bpf, s390: Make program update work for trampoline ops
bpf, arm64: Make program update work for trampoline ops
selftests/bpf: Test BPF_LINK_UPDATE behavior for tracing links
arch/arm64/net/bpf_jit_comp.c | 23 +-
arch/s390/net/bpf_jit_comp.c | 24 +-
arch/x86/net/bpf_jit_comp.c | 17 +-
include/linux/bpf.h | 21 +
kernel/bpf/syscall.c | 68 +++
kernel/bpf/trampoline.c | 75 ++-
.../bpf/prog_tests/prog_update_tracing.c | 460 ++++++++++++++++++
.../selftests/bpf/progs/prog_update_tracing.c | 133 +++++
8 files changed, 796 insertions(+), 25 deletions(-)
create mode 100644 tools/testing/selftests/bpf/prog_tests/prog_update_tracing.c
create mode 100644 tools/testing/selftests/bpf/progs/prog_update_tracing.c
--
2.43.0
More information about the linux-arm-kernel
mailing list