bpf: Fix verifier assumptions about socket->sk
The verifier assumes that 'sk' field in 'struct socket' is valid and non-NULL when 'socket' pointer itself is trusted and non-NULL. That may not be the case when socket was just created and passed to LSM socket_accept hook. Fix this verifier assumption and adjust tests. Reported-by:Liam Wisehart <liamwisehart@meta.com> Acked-by:
Kumar Kartikeya Dwivedi <memxor@gmail.com> Fixes: 6fcd486b ("bpf: Refactor RCU enforcement in the verifier.") Signed-off-by:
Alexei Starovoitov <ast@kernel.org> Link: https://lore.kernel.org/r/20240427002544.68803-1-alexei.starovoitov@gmail.com Signed-off-by:
Martin KaFai Lau <martin.lau@kernel.org>
Showing
- kernel/bpf/verifier.c 18 additions, 5 deletionskernel/bpf/verifier.c
- tools/testing/selftests/bpf/progs/bench_local_storage_create.c 3 additions, 2 deletions.../testing/selftests/bpf/progs/bench_local_storage_create.c
- tools/testing/selftests/bpf/progs/local_storage.c 11 additions, 9 deletionstools/testing/selftests/bpf/progs/local_storage.c
- tools/testing/selftests/bpf/progs/lsm_cgroup.c 6 additions, 2 deletionstools/testing/selftests/bpf/progs/lsm_cgroup.c
Please register or sign in to comment