]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: sockmap only allow ESTABLISHED sock state
authorJohn Fastabend <john.fastabend@gmail.com>
Tue, 18 Sep 2018 16:01:44 +0000 (09:01 -0700)
committerDaniel Borkmann <daniel@iogearbox.net>
Sat, 22 Sep 2018 00:46:41 +0000 (02:46 +0200)
commitf4dd6b4f9501c0c8cb09c9374bdc62b6656c95bb
treebe7338b7007ecd330061ccbe9b00e339575c6f60
parent7e6a1965d640abba04efd0be4de4458f28605805
bpf: sockmap only allow ESTABLISHED sock state

After this patch we only allow socks that are in ESTABLISHED state or
are being added via a sock_ops event that is transitioning into an
ESTABLISHED state. By allowing sock_ops events we allow users to
manage sockmaps directly from sock ops programs. The two supported
sock_ops ops are BPF_SOCK_OPS_PASSIVE_ESTABLISHED_CB and
BPF_SOCK_OPS_ACTIVE_ESTABLISHED_CB.

Similar to TLS ULP this ensures sk_user_data is correct.

Reported-by: Eric Dumazet <edumazet@google.com>
Fixes: ef42e83a88b1 ("bpf: sockmap, add sock close() hook to remove socks")
Signed-off-by: John Fastabend <john.fastabend@gmail.com>
Acked-by: Yonghong Song <yhs@fb.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
kernel/bpf/sockmap.c