Hi Gaoxiang,

Please reply in plain text next time.

> From: Gaoxiang Liu <gaoxiangl...@163.com> 
> Sent: Saturday, July 2, 2022 11:00 AM
> To: Xia, Chenbo <chenbo....@intel.com>
> Cc: maxime.coque...@redhat.com; dev@dpdk.org; liugaoxi...@huawei.com; 
> sta...@dpdk.org
> Subject: Re: [PATCH v2] vhost: fix avail idx update error when desc copy 
> failed
>
> Hi,Chenbo
>
> If vhost driver receives a mbuf list,the mbuf list has two mbuf,
> and the pkt_len of the first mbuf in the mbuf list is the sum of data_len of 
> all mbuf,and the pkt_len of the second mbuf is 0.
> When desc_to_mbuf failed,i added 1 and last_avail_idx added i.
> It may cause the first mbuf to be dropped and the second mbuf to be received.
> It is abnormal,because the received mbuf is not
> complete due to lack of the first mbuf,and its pkt_len is 0.
> Because the sender sends a normal mbuf-list packet,the vhost app receives the 
> mbuf and considers it should be a normal pkt.
> The pkt_len is used ,but is not checked,when the vhost app calculates the 
> checksum of the pkt.
> The pkt_len minus the length of the UDP header is a large value because of 
> the negative number reverse.
> It results in segment fault when the vhost app uses the large value to 
> traverse the mbuf ,if the address of the mbuf is largest in all mbuf,because 
> the vhost app may access invalid memory .

First, one element of the mbuf array is for one packet, and it could be
chained mbuf. So if you are talking about chained mbuf, desc_to_mbuf should
fail for the first packet (in your case, this pkt is chained), so return 0,
and APP should check the return value, and knows that no pkt is received.
So I can't understand, if the second mbuf you mean is the second mbuf of
the chained mbuf, why will APP check that? It should never check based
on return value. Anything I missed?

Thanks,
Chenbo

>
> Thanks.
> Gaoxiang



---- Replied Message ----
From
mailto:chenbo....@intel.com
Date
07/01/2022 21:05
To
mailto:gaoxiangl...@163.com,
mailto:maxime.coque...@redhat.com
Cc
mailto:dev@dpdk.org,
mailto:liugaoxi...@huawei.com,
mailto:sta...@dpdk.org
Subject
RE: [PATCH v2] vhost: fix avail idx update error when desc copy failed
> -----Original Message----- 
> From: Gaoxiang Liu <mailto:gaoxiangl...@163.com> 
> Sent: Wednesday, June 22, 2022 9:20 AM 
> To: mailto:maxime.coque...@redhat.com; Xia, Chenbo 
> <mailto:chenbo....@intel.com> 
> Cc: mailto:dev@dpdk.org; mailto:liugaoxi...@huawei.com; Gaoxiang Liu 
> <mailto:gaoxiangl...@163.com>; mailto:sta...@dpdk.org 
> Subject: [PATCH v2] vhost: fix avail idx update error when desc copy 
> failed 
> 
> When copy_desc_to_mbuf function failed, i added 1. 

Function name now is desc_to_mbuf 

> And last_avail_idx added i, other than i - 1. 
> It may cause that the first mbuf in mbuf-list is dropped, 
> the second mbuf in mbuf-list is received in the following 
> rx procedure. 
> And The pkt_len of the second mbuf is zero, resulting in 
> segment fault when parsing the mbuf. 

Could you help elaborate more? Do you mean first mbuf len is zero 
as it's dropped? And where does the segfault happen? APP? Please 
describe more to help understand the issue. 
 

Reply via email to