All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net 1/2] bpf, sockmap: Do not ignore orig_len parameter
@ 2022-03-02 16:17 Eric Dumazet
  2022-03-02 16:17 ` [PATCH net 2/2] tcp: make tcp_read_sock() more robust Eric Dumazet
  2022-03-03  7:00 ` [PATCH net 1/2] bpf, sockmap: Do not ignore orig_len parameter patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Eric Dumazet @ 2022-03-02 16:17 UTC (permalink / raw)
  To: David S . Miller, Jakub Kicinski, Alexei Starovoitov,
	Daniel Borkmann, John Fastabend
  Cc: netdev, bpf, Jakub Sitnicki, Andrii Nakryiko, Martin KaFai Lau,
	Song Liu, Yonghong Song, KP Singh, Eric Dumazet, Neal Cardwell,
	Eric Dumazet, syzbot

From: Eric Dumazet <edumazet@google.com>

Currently, sk_psock_verdict_recv() returns skb->len

This is problematic because tcp_read_sock() might have
passed orig_len < skb->len, due to the presence of TCP urgent data.

This causes an infinite loop from tcp_read_sock()

Followup patch will make tcp_read_sock() more robust vs bad actors.

Fixes: ef5659280eb1 ("bpf, sockmap: Allow skipping sk_skb parser program")
Reported-by: syzbot <syzkaller@googlegroups.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Acked-by: John Fastabend <john.fastabend@gmail.com>
Acked-by: Jakub Sitnicki <jakub@cloudflare.com>
Tested-by: Jakub Sitnicki <jakub@cloudflare.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
---
 net/core/skmsg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/core/skmsg.c b/net/core/skmsg.c
index 8eb671c827f90f1f3d2514163fc82998c9906cb6..929a2b096b04e01b85bff0a69209413abe86102d 100644
--- a/net/core/skmsg.c
+++ b/net/core/skmsg.c
@@ -1153,7 +1153,7 @@ static int sk_psock_verdict_recv(read_descriptor_t *desc, struct sk_buff *skb,
 	struct sk_psock *psock;
 	struct bpf_prog *prog;
 	int ret = __SK_DROP;
-	int len = skb->len;
+	int len = orig_len;
 
 	/* clone here so sk_eat_skb() in tcp_read_sock does not drop our data */
 	skb = skb_clone(skb, GFP_ATOMIC);
-- 
2.35.1.574.g5d30c73bfb-goog


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-03-03  7:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-02 16:17 [PATCH net 1/2] bpf, sockmap: Do not ignore orig_len parameter Eric Dumazet
2022-03-02 16:17 ` [PATCH net 2/2] tcp: make tcp_read_sock() more robust Eric Dumazet
2022-03-03  7:00 ` [PATCH net 1/2] bpf, sockmap: Do not ignore orig_len parameter patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.