On Sun, Nov 10, 2019 at 09:04:58AM -0800, Andrii Nakryiko wrote:
On Thu, Nov 7, 2019 at 10:43 PM Alexei Starovoitov [off-list ref] wrote:
quoted
Add a test that attaches one FEXIT program to main sched_cls networking program
and two other FEXIT programs to subprograms. All three tracing programs
access return values and skb->len of networking program and subprograms.
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
---
Acked-by: Andrii Nakryiko <redacted>
quoted
.../selftests/bpf/prog_tests/fexit_bpf2bpf.c | 76 ++++++++++++++++
.../selftests/bpf/progs/fexit_bpf2bpf.c | 91 +++++++++++++++++++
2 files changed, 167 insertions(+)
create mode 100644 tools/testing/selftests/bpf/prog_tests/fexit_bpf2bpf.c
create mode 100644 tools/testing/selftests/bpf/progs/fexit_bpf2bpf.c
[...]
quoted
+SEC("fexit/test_pkt_access_subprog2")
+int test_subprog2(struct args_subprog2 *ctx)
+{
+ struct sk_buff *skb = (void *)ctx->args[0];
+ __u64 ret;
+ int len;
+
+ bpf_probe_read(&len, sizeof(len),
+ __builtin_preserve_access_index(&skb->len));
nit: we have bpf_core_read() for this, but I suspect you may have
wanted __builtin spelled out explicitly
exactly. it should have been bpf_probe_read_kernel though. will fix.