selftests/bpf: Add a selftest for the tracing bpf_get_socket_cookie
authorFlorent Revest <revest@chromium.org>
Wed, 10 Feb 2021 11:14:06 +0000 (12:14 +0100)
committerAlexei Starovoitov <ast@kernel.org>
Fri, 12 Feb 2021 01:44:41 +0000 (17:44 -0800)
commit6fdd671baaf587cca17603485f9ef4bf7a1f9be1
tree904356219a31ab6feeed959b03fd47be8d28349f
parent6cd4dcc3fb8198fff6e6c2d7c622f78649fa2474
selftests/bpf: Add a selftest for the tracing bpf_get_socket_cookie

This builds up on the existing socket cookie test which checks whether
the bpf_get_socket_cookie helpers provide the same value in
cgroup/connect6 and sockops programs for a socket created by the
userspace part of the test.

Instead of having an update_cookie sockops program tag a socket local
storage with 0xFF, this uses both an update_cookie_sockops program and
an update_cookie_tracing program which succesively tag the socket with
0x0F and then 0xF0.

Signed-off-by: Florent Revest <revest@chromium.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: KP Singh <kpsingh@kernel.org>
Link: https://lore.kernel.org/bpf/20210210111406.785541-5-revest@chromium.org
tools/testing/selftests/bpf/prog_tests/socket_cookie.c
tools/testing/selftests/bpf/progs/socket_cookie_prog.c