Re: [PATCH v3 2/3] vfio/pci: Tolerate oversized BARs by disallowing mmap

From: Christoph Hellwig
Date: Wed Jun 19 2024 - 03:12:03 EST


On Tue, Jun 18, 2024 at 09:51:34AM -0600, Alex Williamson wrote:
> > - if (!resource_size(res))
> > + if (!resource_size(res) ||
> > + resource_size(res) > (IOREMAP_END + 1 - IOREMAP_START))
> > goto no_mmap;
> >
> > if (resource_size(res) >= PAGE_SIZE) {
> >
>
> A powerpc build reports:
>
> ERROR: modpost: "__kernel_io_end" [drivers/vfio/pci/vfio-pci-core.ko] undefined!
>
> Looks like only __kernel_io_start is exported. Thanks,

And exported code has no business looking at either one.

I think the right thing here is a core PCI quirk to fix the BAR
size of the ISM device instead of this hack in vfio.