Files
linux-cix/include/linux
Zijian Zhang 343a932a05 tcp_bpf: Add sk_rmem_alloc related logic for tcp_bpf ingress redirection
[ Upstream commit d888b7af7c149c115dd6ac772cc11c375da3e17c ]

When we do sk_psock_verdict_apply->sk_psock_skb_ingress, an sk_msg will
be created out of the skb, and the rmem accounting of the sk_msg will be
handled by the skb.

For skmsgs in __SK_REDIRECT case of tcp_bpf_send_verdict, when redirecting
to the ingress of a socket, although we sk_rmem_schedule and add sk_msg to
the ingress_msg of sk_redir, we do not update sk_rmem_alloc. As a result,
except for the global memory limit, the rmem of sk_redir is nearly
unlimited. Thus, add sk_rmem_alloc related logic to limit the recv buffer.

Since the function sk_msg_recvmsg and __sk_psock_purge_ingress_msg are
used in these two paths. We use "msg->skb" to test whether the sk_msg is
skb backed up. If it's not, we shall do the memory accounting explicitly.

Fixes: 604326b41a ("bpf, sockmap: convert to generic sk_msg interface")
Signed-off-by: Zijian Zhang <zijianzhang@bytedance.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Reviewed-by: John Fastabend <john.fastabend@gmail.com>
Link: https://lore.kernel.org/bpf/20241210012039.1669389-3-zijianzhang@bytedance.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-01-02 10:32:00 +01:00
..
2024-07-25 09:50:47 +02:00
2024-10-04 16:29:59 +02:00
2024-06-12 11:11:38 +02:00
2024-07-05 09:34:04 +02:00
2024-03-26 18:20:13 -04:00
2024-12-14 19:59:58 +01:00
2024-08-29 17:33:31 +02:00
2024-06-16 13:47:41 +02:00
2024-06-12 11:12:52 +02:00
2024-04-03 15:28:29 +02:00
2024-06-12 11:11:56 +02:00
2024-05-17 12:01:59 +02:00
2024-08-29 17:33:23 +02:00
2024-10-17 15:24:23 +02:00
2024-11-08 16:28:26 +01:00