]> git.baikalelectronics.ru Git - kernel.git/commit
selftests/bpf: Add cgroup_skb/egress test for load_bytes_relative
authorYiFei Zhu <zhuyifei1999@gmail.com>
Wed, 10 Jun 2020 18:41:40 +0000 (13:41 -0500)
committerDaniel Borkmann <daniel@iogearbox.net>
Thu, 11 Jun 2020 14:05:56 +0000 (16:05 +0200)
commit44294c20abf4e481f1f936ce5e03063b5a020ed8
treef2cec2a7c3a8a2ef84b143e61225c440d12e1259
parent3187407113bde666e41b55303fb651e5d9cdab08
selftests/bpf: Add cgroup_skb/egress test for load_bytes_relative

When cgroup_skb/egress triggers the MAC header is not set. Added a
test that asserts reading MAC header is a -EFAULT but NET header
succeeds. The test result from within the eBPF program is stored in
an 1-element array map that the userspace then reads and asserts on.

Another assertion is added that reading from a large offset, past
the end of packet, returns -EFAULT.

Signed-off-by: YiFei Zhu <zhuyifei@google.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Reviewed-by: Stanislav Fomichev <sdf@google.com>
Link: https://lore.kernel.org/bpf/9028ccbea4385a620e69c0a104f469ffd655c01e.1591812755.git.zhuyifei@google.com
tools/testing/selftests/bpf/prog_tests/load_bytes_relative.c [new file with mode: 0644]
tools/testing/selftests/bpf/progs/load_bytes_relative.c [new file with mode: 0644]