]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commit - kernel/bpf/verifier.c
bpf: sockmap: Enable map_update_elem from bpf_iter
authorLorenz Bauer <lmb@cloudflare.com>
Mon, 28 Sep 2020 09:08:02 +0000 (10:08 +0100)
committerAlexei Starovoitov <ast@kernel.org>
Mon, 28 Sep 2020 23:40:46 +0000 (16:40 -0700)
commit6550f2dddfab02a5b948369eeeaedfbc4ae3cc16
tree30313e28f6393c2d0d7a65ceca78c9f6a1a81dc3
parentefa90b50934c93647e41da23d87e5d8b670014d4
bpf: sockmap: Enable map_update_elem from bpf_iter

Allow passing a pointer to a BTF struct sock_common* when updating
a sockmap or sockhash. Since BTF pointers can fault and therefore be
NULL at runtime we need to add an additional !sk check to
sock_map_update_elem. Since we may be passed a request or timewait
socket we also need to check sk_fullsock. Doing this allows calling
map_update_elem on sockmap from bpf_iter context, which uses
BTF pointers.

Signed-off-by: Lorenz Bauer <lmb@cloudflare.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20200928090805.23343-2-lmb@cloudflare.com
kernel/bpf/verifier.c
net/core/sock_map.c