[SRU][F][PATCH 0/1] s390/pci: vfio-pci mmio being disabled erroneously (LP: 1907265)

frank.heimes at canonical.com frank.heimes at canonical.com
Wed Dec 9 07:33:00 UTC 2020


BugLink: https://bugs.launchpad.net/bugs/1907265

SRU Justification:

[Impact]

* The patch abafbc551fdd 'vfio-pci: Invalidate mmaps and block MMIO access on disabled memory'
  that was introducted in kernel 5.8 to fix CVE-2020-12888 accidentally disabled s390/pci: vfio-pci.

* PCI Virtual Functions are prevented from being passed-through via vfio-pci,
  as VFs are not allowed to have the PCI_COMMAND_MEMORY bit enabled per specification.

* As a result, when passing these devices through to a guest via vfio-pci,
  they do not trigger the check added by ebfa440ce38b 'ebfa440ce38b vfio/pci: Fix SR-IOV VF handling with MMIO blocking',
  which led to a blocked MMIO access for the guest because the PCI_COMMAND_MEMORY bit is off.

* Solution is to identify devices beyond traditional linked VFs that vfio must consider memory-enabled.

* In general three fixes are needed to fix this:

* "PCI/IOV: Mark VFs as not implementing PCI_COMMAND_MEMORY"

* "vfio/pci: Decouple PCI_COMMAND_MEMORY bit checks from is_virtfn"

* "s390/pci: Mark all VFs as not implementing PCI_COMMAND_MEMORY"

* But the first two patches are already included in focal, hence only the following missing:

[Fix]

* 08b6e22b850c28b6032da1e4d767a33116e23dfb 08b6e22b850c "s390/pci: Mark all VFs as not implementing PCI_COMMAND_MEMORY"

[Test Case]

* Have a LPAR running with Ubuntu Server 20.04 (or newer) as KVM host with at least one PCI SR-IOV card attached (like RoCE 2.x).

* Pass a PCI Virtual Function to a qemu-kvm guest via vfio-pci and try to make use of it from the KVM VM.

[Regression Potential]

* The problem affects SR-IOV devices on s390x only (since all other common code patches needed are already in).

* Nevertheless, there is always a risk, and here that a broken patch will affect even normal PCI devices on top of SR-IOV.

* But it's very unlikely the modification are very minimal and traceable, virtually adding just one line.

* The changes will not impact other architectures.

* To mitigate potential risks a test kernel was build based on focal master-next and successfully tested.

[Other]

* The fixes are in kernel 5.10, hence will sooner or later land in hirsute.

* And they also landed in groovy via upstream stable.

* And two of the initial three patches already landed in focal via upstream stable.

* Hence this kernel SRU submission is for Focal only and covering only the above single patch.

Matthew Rosato (1):
  s390/pci: Mark all VFs as not implementing PCI_COMMAND_MEMORY

 arch/s390/pci/pci_bus.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

-- 
2.25.1




More information about the kernel-team mailing list