From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) by dpdk.org (Postfix) with ESMTP id E1B931D7; Tue, 5 Dec 2017 15:20:06 +0100 (CET) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 5A9B220E21; Tue, 5 Dec 2017 09:20:06 -0500 (EST) Received: from frontend2 ([10.202.2.161]) by compute1.internal (MEProxy); Tue, 05 Dec 2017 09:20:06 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fridaylinux.org; h=cc:content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=kGVVM1MSxxpdX/Jvvv0npvsScvJOpQ+kVdGedsf4BRI=; b=qzTgVTWs mTNPaRK9nuIT/ZNJE9A9SmsTiTNMVv7Eu8w/Uwnrb4m+8qcGl7XsZXUjh4qdrNYK 2zaLjR5ALTRFbOUD5rNc8g/2foQSNF7cCtbLePxf0eSAMUeS5OKtvY0h7GIMuCtb fZZCwvCjiafbTAZx2YQmMxuIU2D9C+pzFRKSw6dK/p17e+hIVuqcJyFUOWTjPQoz YekRIQwm9c3uTXqEHZArufETOrodGAFeSo96oFmrL/fNFrg94txMEpT91e9lk17G P3FsCMJnwYdMluRCp3KUlc+sNWNAsrMw7u3w+kiI1eQL+32tCEVyRn/FTHpPJ4cy jMvrwTV9sDjvhg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=kGVVM1MSxxpdX/Jvvv0npvsScvJOp Q+kVdGedsf4BRI=; b=bWpkbnumfFosl2dKe/5TBTTAoEgeLoaMmrRRUuugJQNGp H7HK7J/oAohYiZIy8UDhiq5PEe4YxFcFNFjk4abYh0VxROC1VgCxywHLEx5obbxV Powwdn017DaO5b9GqBdgdiTPUZU8gefZ6lG5UdVfmwmh28/iM6ga6NQPC458pOk7 5OwgDoacbBFHxAWazvYq0+gDX/o3rt95XkXIS2pHVGH3IECYwQbESvOvrcpWnq+i QSXyLL9T8ZVdB3Ma71EGsl28QMsZZg+k038K3/CL//VrXaV/hkIShBdJHir99/p6 bvKgx6um1Mje1IkHUAjjDXy1Ig6Jpq8EG1xHWpc3g== X-ME-Sender: Received: from yliu-dev (unknown [180.158.55.119]) by mail.messagingengine.com (Postfix) with ESMTPA id BF0D324BF8; Tue, 5 Dec 2017 09:20:04 -0500 (EST) Date: Tue, 5 Dec 2017 22:19:54 +0800 From: Yuanhan Liu To: Maxime Coquelin Cc: Jianfeng Tan , dev@dpdk.org, stable@dpdk.org, Yi Yang Message-ID: <20171205141954.GF9111@yliu-dev> References: <1510746068-143223-1-git-send-email-jianfeng.tan@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Subject: Re: [dpdk-stable] [PATCH] vhost: fix segfault as handle set_mem_table message X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Dec 2017 14:20:07 -0000 On Tue, Nov 28, 2017 at 01:09:29PM +0100, Maxime Coquelin wrote: > > > On 11/15/2017 12:41 PM, Jianfeng Tan wrote: > >In a running VM, operations (like device attach/detach) will > >trigger the QEMU to resend set_mem_table to vhost-user backend. > > > >DPDK vhost-user handles this message rudely by unmap all existing > >regions and map new ones. This might lead to segfault if there > >is pmd thread just trying to touch those unmapped memory regions. > > > >But for most cases, except VM memory hotplug, QEMU still sends the > >set_mem_table message even the memory regions are not changed as > >QEMU vhost-user filters out those not backed by file (fd > 0). > > > >To fix this case, we add a check in the handler to see if the > >memory regions are really changed; if not, we just keep old memory > >regions. > > > >Fixes: 8f972312b8f4 ("vhost: support vhost-user") > > > >CC: stable@dpdk.org > > > >CC: Yuanhan Liu > >CC: Maxime Coquelin > > > >Reported-by: Yang Zhang > >Reported-by: Xin Long > >Signed-off-by: Yi Yang > >Signed-off-by: Jianfeng Tan > >--- > > lib/librte_vhost/vhost_user.c | 33 +++++++++++++++++++++++++++++++++ > > 1 file changed, 33 insertions(+) > > Reviewed-by: Maxime Coquelin Applied to dpdk-next-virtio. Thanks. --yliu