Zijian Zhang
323bab15ff
tcp_bpf: Add sk_rmem_alloc related logic for tcp_bpf ingress redirection
...
[ Upstream commit d888b7af7c ]
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-09 13:28:37 +01:00
..
2024-06-16 13:39:38 +02:00
2024-10-22 15:40:40 +02:00
2024-01-25 14:52:51 -08:00
2024-10-22 15:40:46 +02:00
2024-04-10 16:19:08 +02:00
2024-10-17 15:10:36 +02:00
2024-06-16 13:39:57 +02:00
2024-02-23 08:55:14 +01:00
2024-04-10 16:18:40 +02:00
2023-12-13 18:36:33 +01:00
2024-01-05 15:13:37 +01:00
2024-08-19 05:45:22 +02:00
2024-01-05 15:13:38 +01:00
2024-12-14 19:51:21 +01:00
2024-11-01 01:52:35 +01:00
2024-10-17 15:10:44 +02:00
2024-03-01 13:21:58 +01:00
2024-12-14 19:51:46 +01:00
2024-02-23 08:54:25 +01:00
2024-09-04 13:23:17 +02:00
2024-12-14 19:51:20 +01:00
2024-04-27 17:05:23 +02:00
2024-05-17 11:50:47 +02:00
2024-10-17 15:10:41 +02:00
2024-03-01 13:21:52 +01:00
2024-08-19 05:45:45 +02:00
2024-07-05 09:14:13 +02:00
2024-07-05 09:14:50 +02:00
2024-07-18 13:07:26 +02:00
2024-12-19 18:07:22 +01:00
2024-04-10 16:18:48 +02:00
2023-12-13 18:36:31 +01:00
2024-09-04 13:23:16 +02:00
2023-12-20 15:17:37 +01:00
2024-06-16 13:39:27 +02:00
2024-12-14 19:50:59 +01:00
2024-05-17 11:51:02 +02:00
2024-04-10 16:18:47 +02:00
2024-04-10 16:18:47 +02:00
2024-02-23 08:54:56 +01:00
2024-04-10 16:18:54 +02:00
2024-12-14 19:51:42 +01:00
2024-07-05 09:14:51 +02:00
2024-05-02 16:24:49 +02:00
2024-12-14 19:51:34 +01:00
2024-04-27 17:05:23 +02:00
2024-10-17 15:11:05 +02:00
2024-04-10 16:19:07 +02:00
2024-02-23 08:55:13 +01:00
2024-10-17 15:11:42 +02:00
2024-07-05 09:14:42 +02:00
2024-11-14 13:13:40 +01:00
2024-09-12 11:07:41 +02:00
2024-07-18 13:07:33 +02:00
2024-10-17 15:11:33 +02:00
2024-04-10 16:19:37 +02:00
2024-02-23 08:55:00 +01:00
2024-08-19 05:45:10 +02:00
2024-09-12 11:07:41 +02:00
2025-01-09 13:28:34 +01:00
2024-10-17 15:11:43 +02:00
2024-10-17 15:11:43 +02:00
2023-12-20 15:17:35 +01:00
2024-03-26 18:21:23 -04:00
2024-03-26 18:21:11 -04:00
2024-07-05 09:14:17 +02:00
2024-04-10 16:18:47 +02:00
2024-02-23 08:54:39 +01:00
2024-08-19 05:45:34 +02:00
2024-08-19 05:45:30 +02:00
2024-04-17 11:15:16 +02:00
2024-08-19 05:45:14 +02:00
2024-12-14 19:50:45 +01:00
2023-12-13 18:36:45 +01:00
2023-12-23 10:42:00 +01:00
2024-07-05 09:14:34 +02:00
2024-01-05 15:13:30 +01:00
2023-12-13 18:36:42 +01:00
2024-04-10 16:18:55 +02:00
2024-12-14 19:51:41 +01:00
2024-04-10 16:18:49 +02:00
2024-12-14 19:51:14 +01:00
2024-07-18 13:07:34 +02:00
2024-07-05 09:14:40 +02:00
2023-12-20 15:17:33 +01:00
2024-07-27 10:46:15 +02:00
2023-12-20 15:17:33 +01:00
2024-12-14 19:50:38 +01:00
2024-07-18 13:07:36 +02:00
2024-07-05 09:14:37 +02:00
2024-04-10 16:18:55 +02:00
2024-03-26 18:21:31 -04:00
2024-03-26 18:21:23 -04:00
2024-07-18 13:07:26 +02:00
2023-12-23 10:41:55 +01:00
2024-03-06 14:38:46 +00:00
2024-12-14 19:50:59 +01:00
2024-04-10 16:19:24 +02:00
2024-10-17 15:11:53 +02:00
2024-11-14 13:13:36 +01:00
2024-04-10 16:19:26 +02:00
2024-04-10 16:19:00 +02:00
2024-07-05 09:14:44 +02:00
2024-08-19 05:44:56 +02:00
2024-01-25 14:52:33 -08:00
2024-07-27 10:46:14 +02:00
2024-10-17 15:11:50 +02:00
2024-12-14 19:51:42 +01:00
2024-08-19 05:45:19 +02:00
2024-02-23 08:54:33 +01:00
2024-09-04 13:23:39 +02:00
2024-09-04 13:23:39 +02:00
2024-03-26 18:21:15 -04:00
2024-06-16 13:39:27 +02:00
2024-08-19 05:45:39 +02:00
2024-10-17 15:11:43 +02:00
2024-12-19 18:07:20 +01:00
2024-04-13 13:01:48 +02:00
2024-12-14 19:50:46 +01:00
2024-03-26 18:21:36 -04:00
2024-03-15 10:48:23 -04:00
2024-04-10 16:18:41 +02:00
2024-03-01 13:21:53 +01:00
2024-04-10 16:19:43 +02:00
2024-07-18 13:07:34 +02:00
2024-12-14 19:50:46 +01:00
2024-05-02 16:24:50 +02:00
2024-10-17 15:10:41 +02:00
2025-01-09 13:28:37 +01:00
2024-03-01 13:21:59 +01:00
2024-03-26 18:21:23 -04:00
2024-12-19 18:07:23 +01:00
2023-12-13 18:36:35 +01:00
2024-07-05 09:14:50 +02:00
2023-12-03 07:31:24 +01:00
2024-08-19 05:45:13 +02:00
2024-11-14 13:13:39 +01:00
2024-04-10 16:18:33 +02:00
2024-08-19 05:45:42 +02:00
2024-04-17 11:15:14 +02:00
2024-09-12 11:07:53 +02:00
2024-12-14 19:51:23 +01:00
2024-10-17 15:11:06 +02:00
2024-04-10 16:19:30 +02:00
2024-10-17 15:10:34 +02:00
2025-01-09 13:28:36 +01:00
2025-01-09 13:28:36 +01:00
2023-12-08 08:48:03 +01:00