Skip to content

Commit b8b8315

Browse files
jrfastabborkmann
authored andcommitted
bpf, sockmap: Remove unhash handler for BPF sockmap usage
We do not need to handle unhash from BPF side we can simply wait for the close to happen. The original concern was a socket could transition from ESTABLISHED state to a new state while the BPF hook was still attached. But, we convinced ourself this is no longer possible and we also improved BPF sockmap to handle listen sockets so this is no longer a problem. More importantly though there are cases where unhash is called when data is in the receive queue. The BPF unhash logic will flush this data which is wrong. To be correct it should keep the data in the receive queue and allow a receiving application to continue reading the data. This may happen when tcp_abort() is received for example. Instead of complicating the logic in unhash simply moving all this to tcp_close() hook solves this. Fixes: 5119940 ("bpf: skb_verdict, support SK_PASS on RX BPF path") Signed-off-by: John Fastabend <[email protected]> Signed-off-by: Daniel Borkmann <[email protected]> Tested-by: Jussi Maki <[email protected]> Reviewed-by: Jakub Sitnicki <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
1 parent 40a3412 commit b8b8315

File tree

1 file changed

+0
-1
lines changed

1 file changed

+0
-1
lines changed

net/ipv4/tcp_bpf.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,6 @@ static void tcp_bpf_rebuild_protos(struct proto prot[TCP_BPF_NUM_CFGS],
475475
struct proto *base)
476476
{
477477
prot[TCP_BPF_BASE] = *base;
478-
prot[TCP_BPF_BASE].unhash = sock_map_unhash;
479478
prot[TCP_BPF_BASE].close = sock_map_close;
480479
prot[TCP_BPF_BASE].recvmsg = tcp_bpf_recvmsg;
481480
prot[TCP_BPF_BASE].sock_is_readable = sk_msg_is_readable;

0 commit comments

Comments
 (0)