From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id A731D4D27; Thu, 30 Aug 2018 08:09:02 +0200 (CEST) X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Aug 2018 23:09:01 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,306,1531810800"; d="scan'208";a="253078203" Received: from fbsd.sh.intel.com ([10.67.104.231]) by orsmga005.jf.intel.com with ESMTP; 29 Aug 2018 23:09:00 -0700 Date: Thu, 30 Aug 2018 14:06:43 +0800 From: Tiwei Bie To: Ilya Maximets Cc: dev@dpdk.org, Maxime Coquelin , Zhihong Wang , stable@dpdk.org Message-ID: <20180830060642.GA7890@fbsd.sh.intel.com> References: <20180817113354.16140-1-i.maximets@samsung.com> <20180829135924eucas1p284d5711018eeba8b0ec3aaa6c84cef10~PX6Xgs7eA2716827168eucas1p22@eucas1p2.samsung.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20180829135924eucas1p284d5711018eeba8b0ec3aaa6c84cef10~PX6Xgs7eA2716827168eucas1p22@eucas1p2.samsung.com> User-Agent: Mutt/1.10.1 (2018-07-13) Subject: Re: [dpdk-dev] [PATCH] vhost: fix crash if set vring num handling failed X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Aug 2018 06:09:03 -0000 On Wed, Aug 29, 2018 at 05:00:47PM +0300, Ilya Maximets wrote: > Any thoughts on this? Hi Ilya, Currently, the errors happened during messages handling aren't handled properly. E.g. in vhost_user_set_mem_table(), similar issues [1] may happen too. We might want to find a way to fix this once and for all. [1] https://github.com/DPDK/dpdk/blob/3605968c2fa7/lib/librte_vhost/vhost_user.c#L826 https://github.com/DPDK/dpdk/blob/3605968c2fa7/lib/librte_vhost/vhost_user.c#L837 https://github.com/DPDK/dpdk/blob/3605968c2fa7/lib/librte_vhost/vhost_user.c#L887 Thanks > > Best regards, Ilya Maximets. > > On 17.08.2018 14:33, Ilya Maximets wrote: > > Allocation failures of shadow used ring and batched copy array > > are not recoverable and leads to the segmentation faults like > > this on the receiving/transmission path: > > > > Program received signal SIGSEGV, Segmentation fault. > > [Switching to Thread 0x7f913fecf0 (LWP 43625)] > > in copy_desc_to_mbuf () at /lib/librte_vhost/virtio_net.c:760 > > 760 batch_copy[vq->batch_copy_nb_elems].dst = > > > > This could be easily reproduced in case of low memory or big > > number of vhost-user ports. Fix that by propagating error to > > the upper layer which will end up with disconnection. > > > > Fixes: f689586bc060 ("vhost: shadow used ring update") > > Cc: stable@dpdk.org > > > > Signed-off-by: Ilya Maximets > > --- > > lib/librte_vhost/vhost_user.c | 4 +++- > > 1 file changed, 3 insertions(+), 1 deletion(-) > > > > diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c > > index 9aa1ce118..4c7fd57fb 100644 > > --- a/lib/librte_vhost/vhost_user.c > > +++ b/lib/librte_vhost/vhost_user.c > > @@ -1693,7 +1693,9 @@ vhost_user_msg_handler(int vid, int fd) > > break; > > > > case VHOST_USER_SET_VRING_NUM: > > - vhost_user_set_vring_num(dev, &msg); > > + ret = vhost_user_set_vring_num(dev, &msg); > > + if (ret) > > + return -1; > > break; > > case VHOST_USER_SET_VRING_ADDR: > > vhost_user_set_vring_addr(&dev, &msg); > >