From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rahul Lakkireddy Subject: Re: [PATCH] vfio: Fix overflow while assigning vfio BAR region offset and size Date: Thu, 18 Jun 2015 19:53:12 +0530 Message-ID: <20150618142310.GA3406@scalar.blr.asicdesigners.com> References: <61d1c9174f7f9159d4005dd2cea16c7719cec964.1434462470.git.rahul.lakkireddy@chelsio.com> <1931055.A5YAhvXmAm@xps13> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: dev@dpdk.org, Felix Marti , Nirranjan Kirubaharan , Kumar Sanghvi To: Thomas Monjalon Return-path: Received: from stargate3.asicdesigners.com (stargate.chelsio.com [67.207.112.58]) by dpdk.org (Postfix) with ESMTP id 1734BC6EC for ; Thu, 18 Jun 2015 16:24:09 +0200 (CEST) Content-Disposition: inline In-Reply-To: <1931055.A5YAhvXmAm@xps13> 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" Hi Thomas, On Wed, Jun 17, 2015 at 14:09:35 +0200, Thomas Monjalon wrote: > Hi Rahul, > > 2015-06-16 19:46, Rahul Lakkireddy: > > After the commit-id 90a1633b2 (eal/linux: allow to map BARs with MSI-X tables), > > Please show this information before the Signed-off-by lines: > Fixes: 90a1633b2347 ("eal/linux: allow to map BARs with MSI-X tables") > generated with this git alias: > fixline = log -1 --abbrev=12 --format='Fixes: %h (\"%s\")' > Ok. I'll add it in v2. > > VFIO stopped working. On further debug, found that although BAR region > > I suppose the whole VFIO didn't stopped working. > Please precise the conditions of the failures (large offset, etc). When using vfio, the probe fails over Chelsio T5 after commit-id 90a1633b2 (eal/linux: allow to map BARs with MSI-X tables). While debugging further, found that the region offset for BAR 2 returned by VFIO is too large to fit in uint32_t. Also, before the above commit, the region offset was passed to mmap as it is and so VFIO is working fine before the above commit. > > > offset and size from vfio are read as u64, they are truncated when assigned to > > uint32_t variables resulting in wrong offset being passed for mmap. > > > > The fix is to use uint64_t for offset and size. > > Unfortunately, it doesn't build for 32-bit target. I tried on RHEL-6.0 32-bit with T=i686-native-linuxapp-gcc and it built fine. So, am I missing something here or some option may be? I will also try out on newer distro like ubuntu 32-bit and confirm. Thanks, Rahul.