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

Burakov, Anatoly anatoly.burakov at intel.com
Wed Jul 1 12:00:13 CEST 2015


Hi all,

> The last patch from Rahul does not solve the problem. For those cases where the MSI-X table is in one of the BARs to map, the memreg array is still in use.

Rahul's initial patch was pretty much what you have submitted, it just didn't build on a 32-bit system.

> My fix was using unsigned long instead of uint32_t for the memreg array as this is used as  a parameter for mmap system call which expects such a type for the offset (and size).

Maybe use off_t? That would at least be guaranteed to compile on any system...

> In a 32-bit system mmap system call and VFIO mmap implementation will get an unsigned long offset, as it does the struct vma_area_struct for vm_pgoff.
> VFIO will not be able to map the right BAR except for BAR 0.
> 
> So, basically, VFIO kernel code does not work for 32 bit systems.
> 
> I think we should define memreg as unsigned long and to report this problem to the VFIO kernel maintainer.

If that's the case, this should indeed be taken up with the kernel maintainers. I don't have a 32-bit system handy to test it, unfortunately.

Thanks,
Anatoly


More information about the dev mailing list