From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 355DBD47A; Wed, 29 Mar 2017 17:19:18 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=intel.com; i=@intel.com; q=dns/txt; s=intel; t=1490800759; x=1522336759; h=subject:to:references:cc:from:message-id:date: mime-version:in-reply-to:content-transfer-encoding; bh=2KZPC+RTxW48AsK0WRREgKckHYv0zRjVVKnDKU6Y5JY=; b=SXasdT6K4oDaGrkNLjecLuLXgMpHU8JnI/Zq07X1X5lcETu8q6IlGWu5 atTFOybEiPoCI4yC/Ipp1egaVj3CSw==; Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Mar 2017 08:19:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,241,1486454400"; d="scan'208";a="71610922" Received: from smonroyx-mobl.ger.corp.intel.com (HELO [10.237.221.23]) ([10.237.221.23]) by orsmga004.jf.intel.com with ESMTP; 29 Mar 2017 08:19:16 -0700 To: Jianfeng Tan , dev@dpdk.org References: <1489681724-22114-1-git-send-email-jianfeng.tan@intel.com> Cc: benjamin.walker@intel.com, stable@dpdk.org From: Sergio Gonzalez Monroy Message-ID: <7c01afcd-20a7-f2a0-f230-04e5b04fb3c9@intel.com> Date: Wed, 29 Mar 2017 16:19:15 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: <1489681724-22114-1-git-send-email-jianfeng.tan@intel.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-stable] [PATCH] eal/linux: fix multi-process cannot work 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: Wed, 29 Mar 2017 15:19:19 -0000 On 16/03/2017 16:28, Jianfeng Tan wrote: > When binding with vfio-pci, secondary process cannot be started with > an error message: > > cannot find TAILQ entry for PCI device. > > It's due to: struct rte_pci_addr is padded with 1 byte for alignment > by compiler. Then below comparison in commit 2f4adfad0a69 > ("vfio: add multiprocess support") will fail if the last byte is not > initialized. > > memcmp(&vfio_res->pci_addr, &dev->addr, sizeof(dev->addr) > > And commit cdc242f260e7 ("eal/linux: support running as unprivileged user") > just triggers this bug by using a stack un-initialized variable. > > The fix is to use rte_eal_compare_pci_addr() for pci addr comparison. > > Fixes: 2f4adfad0a69 ("vfio: add multiprocess support") > Fixes: cdc242f260e7 ("eal/linux: support running as unprivileged user") > CC: stable@dpdk.org > > Reported-by: Rutkowski, Pawel > Signed-off-by: Jianfeng Tan > --- > lib/librte_eal/linuxapp/eal/eal_pci_vfio.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c b/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c > index 5f478c5..7d8b9fb 100644 > --- a/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c > +++ b/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c > @@ -355,7 +355,8 @@ pci_vfio_map_resource(struct rte_pci_device *dev) > } else { > /* if we're in a secondary process, just find our tailq entry */ > TAILQ_FOREACH(vfio_res, vfio_res_list, next) { > - if (memcmp(&vfio_res->pci_addr, &dev->addr, sizeof(dev->addr))) > + if (rte_eal_compare_pci_addr(&vfio_res->pci_addr, > + &dev->addr)) > continue; > break; > } Acked-by: Sergio Gonzalez Monroy