From: wangyufen <wangyufen@huawei.com>
To: Cong Wang <xiyou.wangcong@gmail.com>
Cc: <john.fastabend@gmail.com>, <daniel@iogearbox.net>,
<jakub@cloudflare.com>, <lmb@cloudflare.com>,
<davem@davemloft.net>, <edumazet@google.com>,
<yoshfuji@linux-ipv6.org>, <dsahern@kernel.org>,
<kuba@kernel.org>, <ast@kernel.org>, <andrii@kernel.org>,
<kafai@fb.com>, <songliubraving@fb.com>, <yhs@fb.com>,
<kpsingh@kernel.org>, <netdev@vger.kernel.org>,
<bpf@vger.kernel.org>
Subject: Re: [PATCH bpf-next v2 3/4] bpf, sockmap: Fix more uncharged while msg has more_data
Date: Fri, 4 Mar 2022 15:08:35 +0800 [thread overview]
Message-ID: <43486167-1d02-c053-96f4-55a2683f3da8@huawei.com> (raw)
In-Reply-To: <YiBczo/gN8w9Hl+L@pop-os.localdomain>
在 2022/3/3 14:14, Cong Wang 写道:
> On Wed, Mar 02, 2022 at 10:27:54AM +0800, Wang Yufen wrote:
>> In tcp_bpf_send_verdict(), if msg has more data after
>> tcp_bpf_sendmsg_redir():
>>
>> tcp_bpf_send_verdict()
>> tosend = msg->sg.size //msg->sg.size = 22220
>> case __SK_REDIRECT:
>> sk_msg_return() //uncharged msg->sg.size(22220) sk->sk_forward_alloc
>> tcp_bpf_sendmsg_redir() //after tcp_bpf_sendmsg_redir, msg->sg.size=11000
>> goto more_data;
>> tosend = msg->sg.size //msg->sg.size = 11000
>> case __SK_REDIRECT:
>> sk_msg_return() //uncharged msg->sg.size(11000) to sk->sk_forward_alloc
>>
>> The msg->sg.size(11000) has been uncharged twice, to fix we can charge the
>> remaining msg->sg.size before goto more data.
> It looks like bpf_exec_tx_verdict() has the same issue.
>
> .
In bpf_exec_tx_verdict(), case __SK_REDIRECT, msg_redir is used and
msg->sg.size is deducted in advance.
Therefore, this issue (more uncharged) does not exist.
However, I think that if msg_redir processing cannot be completed , that
is msg_redir has more data,
and there is no subsequent processing, maybe that is another problem.
Thanks.
next prev parent reply other threads:[~2022-03-04 7:14 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-02 2:27 [PATCH bpf-next v2 0/4] bpf, sockmap: Fix memleaks and issues of mem charge/uncharge Wang Yufen
2022-03-02 2:27 ` [PATCH bpf-next v2 1/4] bpf, sockmap: Fix memleak in sk_psock_queue_msg Wang Yufen
2022-03-03 0:41 ` Cong Wang
2022-03-04 6:45 ` wangyufen
2022-03-02 2:27 ` [PATCH bpf-next v2 2/4] bpf, sockmap: Fix memleak in tcp_bpf_sendmsg while sk msg is full Wang Yufen
2022-03-03 0:48 ` Cong Wang
2022-03-04 6:51 ` wangyufen
2022-03-02 2:27 ` [PATCH bpf-next v2 3/4] bpf, sockmap: Fix more uncharged while msg has more_data Wang Yufen
2022-03-03 6:14 ` Cong Wang
2022-03-04 7:08 ` wangyufen [this message]
2022-03-02 2:27 ` [PATCH bpf-next v2 4/4] bpf, sockmap: Fix double uncharge the mem of sk_msg Wang Yufen
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=43486167-1d02-c053-96f4-55a2683f3da8@huawei.com \
--to=wangyufen@huawei.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=jakub@cloudflare.com \
--cc=john.fastabend@gmail.com \
--cc=kafai@fb.com \
--cc=kpsingh@kernel.org \
--cc=kuba@kernel.org \
--cc=lmb@cloudflare.com \
--cc=netdev@vger.kernel.org \
--cc=songliubraving@fb.com \
--cc=xiyou.wangcong@gmail.com \
--cc=yhs@fb.com \
--cc=yoshfuji@linux-ipv6.org \
/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