Skip to content

RFC bpf_panic() helper

Artem Savkov bpf lkml llvm netdev 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest4 patches 11 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4bpf: add a sysctl to enable destructive bpf helpersinclude/linux/bpf.h kernel/bpf/syscall.c+35 -00 replies
2/4bpf: add BPF_F_DESTRUCTIVE flag for BPF_PROG_LOADinclude/linux/bpf.h include/uapi/linux/bpf.h kernel/bpf/syscall.c +1 more+16 -12 replies
3/4bpf: add bpf_panic() helperinclude/linux/bpf.h include/uapi/linux/bpf.h kernel/bpf/core.c +4 more+38 -07 replies
4/4selftests/bpf: bpf_panic selftesttools/testing/selftests/bpf/prog_tests/bpf_panic.c+144 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC PATCH bpf-next 0/4] bpf_panic() helper

eBPF is often used for kernel debugging, and one of the widely used and powerful debugging techniques is post-mortem debugging with a full memory dump. Triggering a panic at exactly the right moment allows the user to get such a dump and thus a better view at the system's state. This patchset adds bpf_panic() helper to do exactly that.

I realize that even though there are multiple guards present, a helper like this is contrary to BPF being "safe", so this is sent as RFC to have a discussion on whether adding destructive capabilities is deemed acceptable.

Artem Savkov (4):
bpf: add a sysctl to enable destructive bpf helpers
bpf: add BPF_F_DESTRUCTIVE flag for BPF_PROG_LOAD
bpf: add bpf_panic() helper
selftests/bpf: bpf_panic selftest

 include/linux/bpf.h                           |   8 +
 include/uapi/linux/bpf.h                      |  13 ++
 kernel/bpf/core.c                             |   1 +
 kernel/bpf/helpers.c                          |  13 ++
 kernel/bpf/syscall.c                          |  33 +++-
 kernel/bpf/verifier.c                         |   7 +
 kernel/trace/bpf_trace.c                      |   2 +
 tools/include/uapi/linux/bpf.h                |  13 ++
 .../selftests/bpf/prog_tests/bpf_panic.c      | 144 ++++++++++++++++++
 9 files changed, 233 insertions(+), 1 deletion(-)
 create mode 100644 tools/testing/selftests/bpf/prog_tests/bpf_panic.c
Signature · 1 line
2.35.3