Patch "bpf: Disable non stream socket for strparser" has been added to the 6.12-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: Disable non stream socket for strparser

to the 6.12-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-disable-non-stream-socket-for-strparser.patch
and it can be found in the queue-6.12 subdirectory.

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



commit f3d582176a26ddee65dba1f755ded505130f55fd
Author: Jiayuan Chen <mrpre@xxxxxxx>
Date:   Wed Jan 22 18:09:15 2025 +0800

    bpf: Disable non stream socket for strparser
    
    [ Upstream commit 5459cce6bf49e72ee29be21865869c2ac42419f5 ]
    
    Currently, only TCP supports strparser, but sockmap doesn't intercept
    non-TCP connections to attach strparser. For example, with UDP, although
    the read/write handlers are replaced, strparser is not executed due to
    the lack of a read_sock operation.
    
    Furthermore, in udp_bpf_recvmsg(), it checks whether the psock has data,
    and if not, it falls back to the native UDP read interface, making
    UDP + strparser appear to read correctly. According to its commit history,
    this behavior is unexpected.
    
    Moreover, since UDP lacks the concept of streams, we intercept it directly.
    
    Fixes: 1fa1fe8ff161 ("bpf, sockmap: Test shutdown() correctly exits epoll and recv()=0")
    Signed-off-by: Jiayuan Chen <mrpre@xxxxxxx>
    Signed-off-by: Martin KaFai Lau <martin.lau@xxxxxxxxxx>
    Acked-by: Jakub Sitnicki <jakub@xxxxxxxxxxxxxx>
    Acked-by: John Fastabend <john.fastabend@xxxxxxxxx>
    Link: https://patch.msgid.link/20250122100917.49845-4-mrpre@xxxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/net/core/sock_map.c b/net/core/sock_map.c
index 2f1be9baad057..82a14f131d00c 100644
--- a/net/core/sock_map.c
+++ b/net/core/sock_map.c
@@ -303,7 +303,10 @@ static int sock_map_link(struct bpf_map *map, struct sock *sk)
 
 	write_lock_bh(&sk->sk_callback_lock);
 	if (stream_parser && stream_verdict && !psock->saved_data_ready) {
-		ret = sk_psock_init_strp(sk, psock);
+		if (sk_is_tcp(sk))
+			ret = sk_psock_init_strp(sk, psock);
+		else
+			ret = -EOPNOTSUPP;
 		if (ret) {
 			write_unlock_bh(&sk->sk_callback_lock);
 			sk_psock_put(sk, psock);




[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