twx-linux/include
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: 604326b41a6f ("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
..
acpi ACPI: CPPC: Make rmw_lock a raw_spin_lock 2024-11-08 16:28:20 +01:00
asm-generic Rename .data.once to .data..once to fix resetting WARN*_ONCE 2024-12-09 10:32:59 +01:00
clocksource
crypto crypto: simd - Do not call crypto_alloc_tfm during registration 2024-10-10 11:57:26 +02:00
drm drm/dp_mst: Fix resetting msg rx state after topology removal 2024-12-14 19:59:55 +01:00
dt-bindings dt-bindings: clock: qcom: Add GPLL9 support on gcc-sc8180x 2024-10-10 11:58:04 +02:00
keys
kunit
kvm
linux tcp_bpf: Add sk_rmem_alloc related logic for tcp_bpf ingress redirection 2025-01-02 10:32:00 +01:00
math-emu
media media: v4l2-core: v4l2-dv-timings: check cvt/gtf result 2024-12-09 10:32:51 +01:00
memory
misc
net tcp_bpf: Charge receive socket buffer in bpf_tcp_ingress() 2025-01-02 10:32:00 +01:00
pcmcia
ras
rdma
rv
scsi scsi: Remove scsi device no_start_on_resume flag 2024-10-17 15:24:11 +02:00
soc net: mscc: ocelot: be resilient to loss of PTP packets during transmission 2024-12-19 18:11:29 +01:00
sound ALSA: usb-audio: Update UMP group attributes for GTB blocks, too 2024-12-14 20:00:23 +01:00
target
trace sched: Remove vruntime from trace_sched_stat_runtime() 2024-12-14 20:00:19 +01:00
uapi sched/headers: Move 'struct sched_param' out of uapi, to work around glibc/musl breakage 2024-12-14 20:00:19 +01:00
ufs scsi: ufs: core: Make DMA mask configuration more flexible 2024-12-14 20:00:11 +01:00
vdso
video
xen