This addresses Jakub's feedback for the v1 [1]. Outstanding issues are: * Can we use rcu_dereference instead of rcu_dereference_raw? * Is it OK to not take the bucket lock? * Can we teach the verifier that PTR_TO_BTF_ID can be the same as PTR_TO_SOCKET? Changes in v2: - Remove unnecessary sk_fullsock checks (Jakub) - Nits for test output (Jakub) - Increase number of sockets in tests to 64 (Jakub) - Handle ENOENT in tests (Jakub) - Actually test SOCKHASH iteration (myself) - Fix SOCKHASH iterator initialization (myself) 1: https://lore.kernel.org/bpf/20200828094834.23290-1-lmb@xxxxxxxxxxxxxx/ Lorenz Bauer (4): net: sockmap: Remove unnecessary sk_fullsock checks net: Allow iterating sockmap and sockhash selftests: bpf: Add helper to compare socket cookies selftests: bpf: Test copying a sockmap via bpf_iter net/core/sock_map.c | 287 +++++++++++++++++- .../selftests/bpf/prog_tests/sockmap_basic.c | 141 ++++++++- tools/testing/selftests/bpf/progs/bpf_iter.h | 9 + .../selftests/bpf/progs/bpf_iter_sockmap.c | 58 ++++ .../selftests/bpf/progs/bpf_iter_sockmap.h | 3 + 5 files changed, 482 insertions(+), 16 deletions(-) create mode 100644 tools/testing/selftests/bpf/progs/bpf_iter_sockmap.c create mode 100644 tools/testing/selftests/bpf/progs/bpf_iter_sockmap.h -- 2.25.1