[dpdk-dev] [PATCH] vfio: Fix overflow while assigning vfio BAR region offset and size

Rahul Lakkireddy rahul.lakkireddy at chelsio.com
Thu Jun 18 16:23:12 CEST 2015


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.


More information about the dev mailing list