selftests/bpf: Add kfree_skb raw_tp test
authorAlexei Starovoitov <ast@kernel.org>
Wed, 16 Oct 2019 03:25:05 +0000 (20:25 -0700)
committerDaniel Borkmann <daniel@iogearbox.net>
Thu, 17 Oct 2019 14:44:36 +0000 (16:44 +0200)
commit580d656d80cfe616432fddd1ec35297a1454e05a
tree7b4106d91e7dcc48dbd1bc70b47ef67ff6cfd81a
parenta7658e1a4164ce2b9eb4a11aadbba38586e93bd6
selftests/bpf: Add kfree_skb raw_tp test

Load basic cls_bpf program.
Load raw_tracepoint program and attach to kfree_skb raw tracepoint.
Trigger cls_bpf via prog_test_run.
At the end of test_run kernel will call kfree_skb
which will trigger trace_kfree_skb tracepoint.
Which will call our raw_tracepoint program.
Which will take that skb and will dump it into perf ring buffer.
Check that user space received correct packet.

Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Andrii Nakryiko <andriin@fb.com>
Acked-by: Martin KaFai Lau <kafai@fb.com>
Link: https://lore.kernel.org/bpf/20191016032505.2089704-12-ast@kernel.org
tools/testing/selftests/bpf/prog_tests/kfree_skb.c [new file with mode: 0644]
tools/testing/selftests/bpf/progs/kfree_skb.c [new file with mode: 0644]