Skip to content

tools: ksnoop: tracing kernel function entry/return with argument/return value display

Alan Maguire bpf netdev 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 3 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3tools: ksnoop: kernel argument/return value tracing/display using BTFtools/bpf/Makefile tools/bpf/ksnoop/Makefile tools/bpf/ksnoop/ksnoop.bpf.c +2 more+1497 -50 replies
2/3tools: ksnoop: document ksnoop tracing of entry/return with value displaytools/bpf/ksnoop/Documentation/Makefile tools/bpf/ksnoop/Documentation/ksnoop.rst tools/bpf/ksnoop/Makefile+244 -40 replies
3/3tools: ksnoop: add .gitignoretools/bpf/ksnoop/.gitignore+1 -00 replies

Reviews trailers per patch

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

Read the v1 thread

Cover letter [PATCH bpf-next 0/3] tools: ksnoop: tracing kernel function entry/return with argument/return value display

Recent functionality added to libbpf [1] enables typed display of kernel data structures; here that functionality is exploited to provide a simple example of how a tracer can support deep argument/return value inspection. The intent is to provide a demonstration of these features to help facilitate tracer adoption, while also providing a tool which can be useful for kernel debugging.

Changes since RFC [2]:

- In the RFC version, kernel data structures were string-ified in BPF program context vi bpf_snprintf_btf(); Alexei pointed out that it would be better to dump memory to userspace and let the interpretation happen there. btf_dump__dump_type_data() in libbpf now supports this (Alexei, patch 1)
- Added the "stack mode" specification where we trace a specific set of functions being called in order (though not necessarily directly). This mode of tracing is useful when debugging issues with a specific stack signature.

[1] https://lore.kernel.org/bpf/[email protected]/
[2] https://lore.kernel.org/bpf/[email protected]/

Alan Maguire (3):
tools: ksnoop: kernel argument/return value tracing/display using BTF
tools: ksnoop: document ksnoop tracing of entry/return with value
display
tools: ksnoop: add .gitignore

 tools/bpf/Makefile                        |  20 +-
 tools/bpf/ksnoop/.gitignore               |   1 +
 tools/bpf/ksnoop/Documentation/Makefile   |  58 ++
 tools/bpf/ksnoop/Documentation/ksnoop.rst | 173 ++++++
 tools/bpf/ksnoop/Makefile                 | 107 ++++
 tools/bpf/ksnoop/ksnoop.bpf.c             | 391 +++++++++++++
 tools/bpf/ksnoop/ksnoop.c                 | 890 ++++++++++++++++++++++++++++++
 tools/bpf/ksnoop/ksnoop.h                 | 103 ++++
 8 files changed, 1738 insertions(+), 5 deletions(-)
 create mode 100644 tools/bpf/ksnoop/.gitignore
 create mode 100644 tools/bpf/ksnoop/Documentation/Makefile
 create mode 100644 tools/bpf/ksnoop/Documentation/ksnoop.rst
 create mode 100644 tools/bpf/ksnoop/Makefile
 create mode 100644 tools/bpf/ksnoop/ksnoop.bpf.c
 create mode 100644 tools/bpf/ksnoop/ksnoop.c
 create mode 100644 tools/bpf/ksnoop/ksnoop.h
Signature · 1 line
1.8.3.1