]> git.proxmox.com Git - mirror_ubuntu-bionic-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)
committerJuerg Haefliger <juergh@canonical.com>
Wed, 24 Jul 2019 01:51:28 +0000 (19:51 -0600)
commit8ed7e6be5529f8f02547ce54667f25db50395208
tree7b88d05c59681e9dda8e84e28391b59261ad6adc
parentcfca31388ca8544f9e8f1bac096222b5e27963cc
bpf: sockmap: write_space events need to be passed to TCP handler

BugLink: https://bugs.launchpad.net/bugs/1836287
[ Upstream commit 9b2e0388bec8ec5427403e23faff3b58dd1c3200 ]

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>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
kernel/bpf/sockmap.c