mbox series

[bpf,0/2] tcp_bpf: Fix the sk_mem_uncharge logic in tcp_bpf_sendmsg

Message ID 20241016234838.3167769-1-zijianzhang@bytedance.com (mailing list archive)
Headers show
Series tcp_bpf: Fix the sk_mem_uncharge logic in tcp_bpf_sendmsg | expand

Message

Zijian Zhang Oct. 16, 2024, 11:48 p.m. UTC
From: Zijian Zhang <zijianzhang@bytedance.com>

When apply_bytes are not zero, sk_mem_uncharge for __SK_REDIRECT and
__SK_DROP in tcp_bpf_sendmsg has some problem. Added a selftest to trigger
the memory accounting WARNING, and fixed the sk_mem_uncharge logic in
tcp_bpf_sendmsg

Zijian Zhang (2):
  selftests/bpf: Add apply_bytes test to test_txmsg_redir_wait_sndmem in
    test_sockmap
  tcp_bpf: Fix the sk_mem_uncharge logic in tcp_bpf_sendmsg

 net/ipv4/tcp_bpf.c                         | 11 ++++-------
 tools/testing/selftests/bpf/test_sockmap.c |  6 +++++-
 2 files changed, 9 insertions(+), 8 deletions(-)

Comments

John Fastabend Nov. 21, 2024, 5:49 a.m. UTC | #1
zijianzhang@ wrote:
> From: Zijian Zhang <zijianzhang@bytedance.com>
> 
> When apply_bytes are not zero, sk_mem_uncharge for __SK_REDIRECT and
> __SK_DROP in tcp_bpf_sendmsg has some problem. Added a selftest to trigger
> the memory accounting WARNING, and fixed the sk_mem_uncharge logic in
> tcp_bpf_sendmsg
> 
> Zijian Zhang (2):
>   selftests/bpf: Add apply_bytes test to test_txmsg_redir_wait_sndmem in
>     test_sockmap
>   tcp_bpf: Fix the sk_mem_uncharge logic in tcp_bpf_sendmsg

I would probably prefer the patches with the fix first than the selftest
just to avoid tripping up any bisect.

But patches look good. Thanks and sorry for the delay again I was
travelling and OOO for a bit.

> 
>  net/ipv4/tcp_bpf.c                         | 11 ++++-------
>  tools/testing/selftests/bpf/test_sockmap.c |  6 +++++-
>  2 files changed, 9 insertions(+), 8 deletions(-)
> 
> -- 
> 2.20.1
>