diff options
author | Eric Dumazet <edumazet@google.com> | 2019-07-23 03:15:38 -0700 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2019-07-23 14:12:37 -0700 |
commit | be69483bf4f3abaaca5d5ba460dbb50239463552 (patch) | |
tree | 1aaff1884ece785915c25780bd7d2f5666c5e941 | |
parent | 06a22d897d82f12776d44dbf0850f5895469cb2a (diff) |
selftests/bpf: add another gso_segs access
Use BPF_REG_1 for source and destination of gso_segs read,
to exercise "bpf: fix access to skb_shared_info->gso_segs" fix.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Suggested-by: Stanislav Fomichev <sdf@google.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
-rw-r--r-- | tools/testing/selftests/bpf/verifier/ctx_skb.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tools/testing/selftests/bpf/verifier/ctx_skb.c b/tools/testing/selftests/bpf/verifier/ctx_skb.c index b0fda2877119..d438193804b2 100644 --- a/tools/testing/selftests/bpf/verifier/ctx_skb.c +++ b/tools/testing/selftests/bpf/verifier/ctx_skb.c @@ -975,6 +975,17 @@ .prog_type = BPF_PROG_TYPE_CGROUP_SKB, }, { + "read gso_segs from CGROUP_SKB", + .insns = { + BPF_LDX_MEM(BPF_W, BPF_REG_1, BPF_REG_1, + offsetof(struct __sk_buff, gso_segs)), + BPF_MOV64_IMM(BPF_REG_0, 0), + BPF_EXIT_INSN(), + }, + .result = ACCEPT, + .prog_type = BPF_PROG_TYPE_CGROUP_SKB, +}, +{ "write gso_segs from CGROUP_SKB", .insns = { BPF_MOV64_IMM(BPF_REG_0, 0), |