]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: sockmap: write_space events need to be passed to TCP handler
authorJohn Fastabend <john.fastabend@gmail.com>
Wed, 22 Aug 2018 15:37:37 +0000 (08:37 -0700)
committerDaniel Borkmann <daniel@iogearbox.net>
Wed, 22 Aug 2018 19:58:20 +0000 (21:58 +0200)
commit4cf21553573b265aee4d0444394df59f94dcef0b
tree50e2bd5b873f58bbad195a597eef38db199d663b
parentbe5f782ec00af780d4cb84f41983f0ac241b77ee
bpf: sockmap: write_space events need to be passed to TCP handler

When sockmap code is using the stream parser it also handles the write
space events in order to handle the case where (a) verdict redirects
skb to another socket and (b) the sockmap then sends the skb but due
to memory constraints (or other EAGAIN errors) needs to do a retry.

But the initial code missed a third case where the
skb_send_sock_locked() triggers an sk_wait_event(). A typically case
would be when sndbuf size is exceeded. If this happens because we
do not pass the write_space event to the lower layers we never wake
up the event and it will wait for sndtimeo. Which as noted in ktls
fix may be rather large and look like a hang to the user.

To reproduce the best test is to reduce the sndbuf size and send
1B data chunks to stress the memory handling. To fix this pass the
event from the upper layer to the lower layer.

Signed-off-by: John Fastabend <john.fastabend@gmail.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
kernel/bpf/sockmap.c