From mboxrd@z Thu Jan 1 00:00:00 1970 From: Maxime Coquelin Subject: Re: [PATCH v2] vhost: Add indirect descriptors support to the TX path Date: Fri, 23 Sep 2016 09:33:01 +0200 Message-ID: <769e962c-75f2-a283-54eb-72410565151a@redhat.com> References: <1474615009-26626-1-git-send-email-maxime.coquelin@redhat.com> <20160923072915.GW23158@yliu-dev.sh.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Cc: huawei.xie@intel.com, dev@dpdk.org, vkaplans@redhat.com, mst@redhat.com, stephen@networkplumber.org To: Yuanhan Liu Return-path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id 15B5447D2 for ; Fri, 23 Sep 2016 09:33:05 +0200 (CEST) In-Reply-To: <20160923072915.GW23158@yliu-dev.sh.intel.com> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 09/23/2016 09:29 AM, Yuanhan Liu wrote: > On Fri, Sep 23, 2016 at 09:16:49AM +0200, Maxime Coquelin wrote: >> + if (vq->desc[desc_indexes[i]].flags & VRING_DESC_F_INDIRECT) { >> + if (unlikely(!(dev->features & >> + (1ULL << VIRTIO_RING_F_INDIRECT_DESC)))) { >> + RTE_LOG(ERR, VHOST_DATA, >> + "Indirect desc but feature not negotiated.\n"); >> + break; >> + } > > I thought the alignment we got before was to follow linux kernel: check > nested indirect only? Right... I did the opposite.. Fixing this right now. > >> + >> + desc = (struct vring_desc *)gpa_to_vva(dev, >> + vq->desc[desc_indexes[i]].addr); > > I think we should check the desc addr here. Otherwise we may crash here > if a malicious guest fills some bad addresses. Good point! Thanks, Maxime > > --yliu >