Merge branch 'writeable-bpf-tracepoints'
Matt Mullins says:
====================
This adds an opt-in interface for tracepoints to expose a writable context to
BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE programs that are attached, while
supporting read-only access from existing BPF_PROG_TYPE_RAW_TRACEPOINT
programs, as well as from non-BPF-based tracepoints.
The initial motivation is to support tracing that can be observed from the
remote end of an NBD socket, e.g. by adding flags to the struct nbd_request
header. Earlier attempts included adding an NBD-specific tracepoint fd, but in
code review, I was recommended to implement it more generically -- as a result,
this patchset is far simpler than my initial try.
v4->v5:
* rebased onto bpf-next/master and fixed merge conflicts
* "tools: sync bpf.h" also syncs comments that have previously changed
in bpf-next
v3->v4:
* fixed a silly copy/paste typo in include/trace/events/bpf_test_run.h
(_TRACE_NBD_H -> _TRACE_BPF_TEST_RUN_H)
* fixed incorrect/misleading wording in patch 1's commit message,
since the pointer cannot be directly dereferenced in a
BPF_PROG_TYPE_RAW_TRACEPOINT
* cleaned up the error message wording if the prog_tests fail
* Addressed feedback from Yonghong
* reject non-pointer-sized accesses to the buffer pointer
* use sizeof(struct nbd_request) as one-byte-past-the-end in
raw_tp_writable_reject_nbd_invalid.c
* use BPF_MOV64_IMM instead of BPF_LD_IMM64
v2->v3:
* Andrew addressed Josef's comments:
* C-style commenting in nbd.c
* Collapsed identical events into a single DECLARE_EVENT_CLASS.
This saves about 2kB of kernel text
v1->v2:
* add selftests
* sync tools/include/uapi/linux/bpf.h
* reject variable offset into the buffer
* add string representation of PTR_TO_TP_BUFFER to reg_type_str
====================
Signed-off-by:
Alexei Starovoitov <ast@kernel.org>
Showing
- MAINTAINERS 1 addition, 0 deletionsMAINTAINERS
- drivers/block/nbd.c 13 additions, 0 deletionsdrivers/block/nbd.c
- include/linux/bpf.h 2 additions, 0 deletionsinclude/linux/bpf.h
- include/linux/bpf_types.h 1 addition, 0 deletionsinclude/linux/bpf_types.h
- include/linux/tracepoint-defs.h 1 addition, 0 deletionsinclude/linux/tracepoint-defs.h
- include/trace/bpf_probe.h 25 additions, 2 deletionsinclude/trace/bpf_probe.h
- include/trace/events/bpf_test_run.h 50 additions, 0 deletionsinclude/trace/events/bpf_test_run.h
- include/trace/events/nbd.h 107 additions, 0 deletionsinclude/trace/events/nbd.h
- include/uapi/linux/bpf.h 1 addition, 0 deletionsinclude/uapi/linux/bpf.h
- kernel/bpf/syscall.c 6 additions, 2 deletionskernel/bpf/syscall.c
- kernel/bpf/verifier.c 31 additions, 0 deletionskernel/bpf/verifier.c
- kernel/trace/bpf_trace.c 24 additions, 0 deletionskernel/trace/bpf_trace.c
- net/bpf/test_run.c 4 additions, 0 deletionsnet/bpf/test_run.c
- tools/include/uapi/linux/bpf.h 9 additions, 1 deletiontools/include/uapi/linux/bpf.h
- tools/lib/bpf/libbpf.c 1 addition, 0 deletionstools/lib/bpf/libbpf.c
- tools/lib/bpf/libbpf_probes.c 1 addition, 0 deletionstools/lib/bpf/libbpf_probes.c
- tools/testing/selftests/bpf/prog_tests/raw_tp_writable_reject_nbd_invalid.c 42 additions, 0 deletions...tests/bpf/prog_tests/raw_tp_writable_reject_nbd_invalid.c
- tools/testing/selftests/bpf/prog_tests/raw_tp_writable_test_run.c 80 additions, 0 deletions...sting/selftests/bpf/prog_tests/raw_tp_writable_test_run.c
- tools/testing/selftests/bpf/verifier/raw_tp_writable.c 34 additions, 0 deletionstools/testing/selftests/bpf/verifier/raw_tp_writable.c
Loading
Please register or sign in to comment