]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
bpf: Disable non stream socket for strparser
authorJiayuan Chen <mrpre@163.com>
Wed, 22 Jan 2025 10:09:15 +0000 (18:09 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 27 Feb 2025 12:30:19 +0000 (04:30 -0800)
commitf91716d5fa0b6f91919ac088b4400f7bf18aaef1
treecfe68efbbd3b2a635411526d975e046c12374d3a
parent6798f428d8f82244faa4fd196ab17c6630615eb0
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@163.com>
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Acked-by: Jakub Sitnicki <jakub@cloudflare.com>
Acked-by: John Fastabend <john.fastabend@gmail.com>
Link: https://patch.msgid.link/20250122100917.49845-4-mrpre@163.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/core/sock_map.c