Patch "bpf, sockmap: Remove unhash handler for BPF sockmap usage" has been added to the 5.10-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    bpf, sockmap: Remove unhash handler for BPF sockmap usage

to the 5.10-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     bpf-sockmap-remove-unhash-handler-for-bpf-sockmap-us.patch
and it can be found in the queue-5.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit f1e5813edb8366526f7622980093956808ce91b7
Author: John Fastabend <john.fastabend@xxxxxxxxx>
Date:   Wed Nov 3 13:47:33 2021 -0700

    bpf, sockmap: Remove unhash handler for BPF sockmap usage
    
    [ Upstream commit b8b8315e39ffaca82e79d86dde26e9144addf66b ]
    
    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: 51199405f9672 ("bpf: skb_verdict, support SK_PASS on RX BPF path")
    Signed-off-by: John Fastabend <john.fastabend@xxxxxxxxx>
    Signed-off-by: Daniel Borkmann <daniel@xxxxxxxxxxxxx>
    Tested-by: Jussi Maki <joamaki@xxxxxxxxx>
    Reviewed-by: Jakub Sitnicki <jakub@xxxxxxxxxxxxxx>
    Link: https://lore.kernel.org/bpf/20211103204736.248403-3-john.fastabend@xxxxxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/net/ipv4/tcp_bpf.c b/net/ipv4/tcp_bpf.c
index 9194070c67250..6b745ce4108c8 100644
--- a/net/ipv4/tcp_bpf.c
+++ b/net/ipv4/tcp_bpf.c
@@ -573,7 +573,6 @@ static void tcp_bpf_rebuild_protos(struct proto prot[TCP_BPF_NUM_CFGS],
 				   struct proto *base)
 {
 	prot[TCP_BPF_BASE]			= *base;
-	prot[TCP_BPF_BASE].unhash		= sock_map_unhash;
 	prot[TCP_BPF_BASE].close		= sock_map_close;
 	prot[TCP_BPF_BASE].recvmsg		= tcp_bpf_recvmsg;
 	prot[TCP_BPF_BASE].stream_memory_read	= tcp_bpf_stream_read;



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux