]> git.baikalelectronics.ru Git - kernel.git/commit
selftests/bpf: Use vmlinux.h in socket_cookie_prog.c
authorFlorent Revest <revest@chromium.org>
Wed, 10 Feb 2021 11:14:05 +0000 (12:14 +0100)
committerAlexei Starovoitov <ast@kernel.org>
Fri, 12 Feb 2021 01:44:41 +0000 (17:44 -0800)
commitfc932070cb73a3bd1931c39104795a5ea2b9a034
tree90e01695280e38a54a9f8dd9ddc0d37e6de3fcdf
parente3f22565ecf3678ccce0bfbf52610143630bf6db
selftests/bpf: Use vmlinux.h in socket_cookie_prog.c

When migrating from the bpf.h's to the vmlinux.h's definition of struct
bps_sock, an interesting LLVM behavior happened. LLVM started producing
two fetches of ctx->sk in the sockops program this means that the
verifier could not keep track of the NULL-check on ctx->sk. Therefore,
we need to extract ctx->sk in a variable before checking and
dereferencing it.

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