netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: John Fastabend <john.fastabend@gmail.com>
To: Jiayuan Chen <jiayuan.chen@linux.dev>
Cc: bpf@vger.kernel.org, mrpre@163.com,
	Boris Pismenny <borisp@nvidia.com>,
	Jakub Kicinski <kuba@kernel.org>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>,
	Andrii Nakryiko <andrii@kernel.org>,
	Eduard Zingerman <eddyz87@gmail.com>,
	Mykola Lysenko <mykolal@fb.com>,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Martin KaFai Lau <martin.lau@linux.dev>,
	Song Liu <song@kernel.org>,
	Yonghong Song <yonghong.song@linux.dev>,
	KP Singh <kpsingh@kernel.org>,
	Stanislav Fomichev <sdf@fomichev.me>, Hao Luo <haoluo@google.com>,
	Jiri Olsa <jolsa@kernel.org>, Shuah Khan <shuah@kernel.org>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-kselftest@vger.kernel.org
Subject: Re: [PATCH bpf-next v1 0/2] ktls, sockmap: Fix missing uncharge operation and add selfttest
Date: Thu, 1 May 2025 22:26:48 -0700	[thread overview]
Message-ID: <20250502052648.4tcxptx6xbcnpoyt@gmail.com> (raw)
In-Reply-To: <20250425060015.6968-1-jiayuan.chen@linux.dev>

On 2025-04-25 13:59:56, Jiayuan Chen wrote:
> Cong reported a warning when running ./test_sockmp:
> https://lore.kernel.org/bpf/aAmIi0vlycHtbXeb@pop-os.localdomain/T/#t
> 
> ------------[ cut here ]------------
> WARNING: CPU: 1 PID: 40 at net/ipv4/af_inet.c inet_sock_destruct+0x173/0x1d5
> Tainted: [W]=WARN
> Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.15.0-1 04/01/2014
> Workqueue: events sk_psock_destroy
> RIP: 0010:inet_sock_destruct+0x173/0x1d5
> RSP: 0018:ffff8880085cfc18 EFLAGS: 00010202
> RAX: 1ffff11003dbfc00 RBX: ffff88801edfe3e8 RCX: ffffffff822f5af4
> RDX: 0000000000000007 RSI: dffffc0000000000 RDI: ffff88801edfe16c
> RBP: ffff88801edfe184 R08: ffffed1003dbfc31 R09: 0000000000000000
> R10: ffffffff822f5ab7 R11: ffff88801edfe187 R12: ffff88801edfdec0
> R13: ffff888020376ac0 R14: ffff888020376ac0 R15: ffff888020376a60
> CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> CR2: 0000556365155830 CR3: 000000001d6aa000 CR4: 0000000000350ef0
> Call Trace:
>  <TASK>
>  __sk_destruct+0x46/0x222
>  sk_psock_destroy+0x22f/0x242
>  process_one_work+0x504/0x8a8
>  ? process_one_work+0x39d/0x8a8
>  ? __pfx_process_one_work+0x10/0x10
>  ? worker_thread+0x44/0x2ae
>  ? __list_add_valid_or_report+0x83/0xea
>  ? srso_return_thunk+0x5/0x5f
>  ? __list_add+0x45/0x52
>  process_scheduled_works+0x73/0x82
>  worker_thread+0x1ce/0x2ae
> 
> 
> When we specify apply_bytes, we divide the msg into multiple segments,
> each with a length of 'send', and every time we send this part of the data
> using tcp_bpf_sendmsg_redir(), we use sk_msg_return_zero() to uncharge the
> memory of the specified 'send' size.
> 
> However, if the first segment of data fails to send, for example, the
> peer's buffer is full, we need to release all of the msg. When releasing
> the msg, we haven't uncharged the memory of the subsequent segments.
> 
> This modification does not make significant logical changes, but only
> fills in the missing uncharge places.
> 
> This issue has existed all along, until it was exposed after we added the
> apply test in test_sockmap:
> 
> commit 3448ad23b34e ("selftests/bpf: Add apply_bytes test to test_txmsg_redir_wait_sndmem in test_sockmap")
> 
> 
> Jiayuan Chen (2):
>   ktls, sockmap: Fix missing uncharge operation
>   selftests/bpf: Add test to cover sockmap with ktls

For the series thanks Jiayuan for poking into the kTLS side. I doubt
anyone has used kTLS+apply_bytes yet. Thanks.

For me.

Acked-by: John Fastabend <john.fastabend@gmail.com>

      parent reply	other threads:[~2025-05-02  5:27 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-25  5:59 [PATCH bpf-next v1 0/2] ktls, sockmap: Fix missing uncharge operation and add selfttest Jiayuan Chen
2025-04-25  5:59 ` [PATCH bpf-next v1 1/2] ktls, sockmap: Fix missing uncharge operation Jiayuan Chen
2025-04-29  0:14   ` Cong Wang
2025-04-29  1:55     ` Jiayuan Chen
2025-05-04 20:19   ` Cong Wang
2025-04-25  5:59 ` [PATCH bpf-next v1 2/2] selftests/bpf: Add test to cover sockmap with ktls Jiayuan Chen
2025-05-02  5:26 ` John Fastabend [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250502052648.4tcxptx6xbcnpoyt@gmail.com \
    --to=john.fastabend@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=borisp@nvidia.com \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=eddyz87@gmail.com \
    --cc=edumazet@google.com \
    --cc=haoluo@google.com \
    --cc=horms@kernel.org \
    --cc=jiayuan.chen@linux.dev \
    --cc=jolsa@kernel.org \
    --cc=kpsingh@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=mrpre@163.com \
    --cc=mykolal@fb.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sdf@fomichev.me \
    --cc=shuah@kernel.org \
    --cc=song@kernel.org \
    --cc=yonghong.song@linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).