All of lore.kernel.org
 help / color / mirror / Atom feed
From: Linhaifeng <haifeng.lin-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
To: "Qiu,
	Michael" <michael.qiu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	"Xie,
	Huawei" <huawei.xie-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Cc: "dev-VfR2kkLFssw@public.gmane.org" <dev-VfR2kkLFssw@public.gmane.org>
Subject: Re: [PATCH] vhost: Fix Segmentation fault of NULL address
Date: Thu, 26 Mar 2015 16:29:04 +0800	[thread overview]
Message-ID: <5513C350.9090609@huawei.com> (raw)
In-Reply-To: <533710CFB86FA344BFBF2D6802E60286D18871-0J0gbvR4kThpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>



On 2015/3/26 15:58, Qiu, Michael wrote:
> On 3/26/2015 3:52 PM, Xie, Huawei wrote:
>> On 3/26/2015 3:05 PM, Qiu, Michael wrote:
>>> Function gpa_to_vva() could return zero, while this will lead
>>> a Segmentation fault.
>>>
>>> This patch is to fix this issue.
>>>
>>> Signed-off-by: Michael Qiu <michael.qiu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
>>> ---
>>>  lib/librte_vhost/vhost_rxtx.c | 3 +++
>>>  1 file changed, 3 insertions(+)
>>>
>>> diff --git a/lib/librte_vhost/vhost_rxtx.c b/lib/librte_vhost/vhost_rxtx.c
>>> index 535c7a1..23c8acb 100644
>>> --- a/lib/librte_vhost/vhost_rxtx.c
>>> +++ b/lib/librte_vhost/vhost_rxtx.c
>>> @@ -587,6 +587,9 @@ rte_vhost_dequeue_burst(struct virtio_net *dev, uint16_t queue_id,
>>>  
>>>  		/* Buffer address translation. */
>>>  		vb_addr = gpa_to_vva(dev, desc->addr);
>>> +		if (!vb_addr)
>>> +			return entry_success;
>>> +
>> Firstly we should add check for all gpa_to_vva translation, and do
>> reporting and cleanup on error. We should avoid the case that some buggy
>> or malicious guest virtio driver gives us an invalid GPA(for example,
>> GPA for some MMIO space) and crash our vhost process.
> 
> Yes, agree, I will do this for next version.
> 
>> As we discuss, you meet segfault here, but our virtio PMD shouldn't give
>> us the GPA that has no translation, so we should root cause first and
> 
> Yes, root cause is very important, but it will spend lots time, and I
> think we could be possible to apply this first(All check version).
> 

How to deal with invalid address but not NULL?

> Thanks,
> Michael
>> fix the problem, and then submit the patch checking all gpa_to_vva
>> translation.
>>
>> -Huawei
>>>  		/* Prefetch buffer address. */
>>>  		rte_prefetch0((void *)(uintptr_t)vb_addr);
>>>  
>>
> 
> 
> 

  parent reply	other threads:[~2015-03-26  8:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-26  7:04 [PATCH] vhost: Fix Segmentation fault of NULL address Michael Qiu
2015-03-26  7:52 ` Xie, Huawei
2015-03-26  7:58   ` Qiu, Michael
     [not found]     ` <533710CFB86FA344BFBF2D6802E60286D18871-0J0gbvR4kThpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-03-26  8:29       ` Linhaifeng [this message]
2015-03-27  8:45         ` Qiu, Michael

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=5513C350.9090609@huawei.com \
    --to=haifeng.lin-hv44wf8li93qt0dzr+alfa@public.gmane.org \
    --cc=dev-VfR2kkLFssw@public.gmane.org \
    --cc=huawei.xie-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=michael.qiu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.