Skip to contentSkip to conversation

bus/pci: fix VF bus error for memory access

PATCH Superseded Haiyue Wang 5 participants 16 messages Jun 21, 2020 – Jun 26, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bus/pci: fix VF bus error for memory access

To fix CVE-2020-12888, the linux vfio-pci module will invalidate mmaps and block MMIO access on disabled memory, it will send a SIGBUS to the application.

In fact, vfio-pci will enable the memory command when openning the PCI device, but according to the PCIe specification, this enablement by real PCI write command doesn't have effect, it still has 0 value:

Table 9-13 Command Register Changes

Bit Location | PF and VF Register Differences | PF         | VF
             | From Base                      | Attributes | Attributes
-------------+--------------------------------+------------+-----------
             | Memory Space Enable - Does not |            |
             | apply to VFs. Must be hardwired|  Base      |  0b
     1       | to 0b for VFs. VF Memory Space |            |
             | is controlled by the VF MSE bit|            |
             | in the VF Control register.    |            |

-------------+--------------------------------+------------+-----------

So that when the vfio-pci initializes its own PCI configuration space data called 'vconfig' by reading the VF's real configuration space, it will have the memory command with 0b value, then, the vfio-pci finds the BAR memory is disabled by checking the its vconfig space, and the SIGBUS will be triggerred.

So it needs to enable PCI bus memory command explicitly to avoid access on disabled memory, which will call vfio-pci ioctl to change the memory command in vconfig space to 1b.

Fixes 33604c31354a ("vfio: refactor PCI BAR mapping")

---
Put the long link here, since the patch doesn't support to add so long line.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=abafbc551fddede3e0a08dee1dcde08fc0eb8476

---
 drivers/bus/pci/linux/pci_vfio.c | 37 ++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)
drivers/bus/pci/linux/pci_vfio.c +37 -0
index 64cd84a68..9b6e45da5 100644
@@ -149,6 +149,38 @@ pci_vfio_get_msix_bar(int fd, struct pci_msix_table *msix_table)
 	return 0;
 }
 
+/* enable PCI bus memory command */
+static int
+pci_vfio_enable_bus_memory(int dev_fd)
+{
+	uint16_t cmd;
+	int ret;
+
+	ret = pread64(dev_fd, &cmd, sizeof(cmd),
+		      VFIO_GET_REGION_ADDR(VFIO_PCI_CONFIG_REGION_INDEX) +
+		      PCI_COMMAND);
+
+	if (ret != sizeof(cmd)) {
+		RTE_LOG(ERR, EAL, "Cannot read command from PCI config space!\n");
+		return -1;
+	}
+
+	if (cmd & PCI_COMMAND_MEMORY)
+		return 0;
+
+	cmd |= PCI_COMMAND_MEMORY;
+	ret = pwrite64(dev_fd, &cmd, sizeof(cmd),
+		       VFIO_GET_REGION_ADDR(VFIO_PCI_CONFIG_REGION_INDEX) +
+		       PCI_COMMAND);
+
+	if (ret != sizeof(cmd)) {
+		RTE_LOG(ERR, EAL, "Cannot write command to PCI config space!\n");
+		return -1;
+	}
+
+	return 0;
+}
+
 /* set PCI bus mastering */
 static int
 pci_vfio_set_bus_master(int dev_fd, bool op)
@@ -427,6 +459,11 @@ pci_rte_vfio_setup_device(struct rte_pci_device *dev, int vfio_dev_fd)
 		return -1;
 	}
 
+	if (pci_vfio_enable_bus_memory(vfio_dev_fd)) {
+		RTE_LOG(ERR, EAL, "Cannot enable bus memory command!\n");
+		return -1;
+	}
+
 	/* set bus mastering for the device */
 	if (pci_vfio_set_bus_master(vfio_dev_fd, true)) {
 		RTE_LOG(ERR, EAL, "Cannot set up bus mastering!\n");
Signature · 1 line
2.27.0
#1 lore raw

PATCH v2 1/1 bus/pci: fix VF bus error for memory access

To fix CVE-2020-12888, the linux vfio-pci module will invalidate mmaps and block MMIO access on disabled memory, it will send a SIGBUS to the application:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=abafbc551fddede3e0a08dee1dcde08fc0eb8476

When the application opens the vfio PCI device, the vfio-pci module will enable the memory bus command through PCI read/write access. According to the PCIe specification, for VF, the 'Memory Space Enable' is always zero:

Table 9-13 Command Register Changes

Bit Location | PF and VF Register Differences | PF         | VF
             | From Base                      | Attributes | Attributes
-------------+--------------------------------+------------+-----------
             | Memory Space Enable - Does not |            |
             | apply to VFs. Must be hardwired|  Base      |  0b
     1       | to 0b for VFs. VF Memory Space |            |
             | is controlled by the VF MSE bit|            |
             | in the VF Control register.    |            |

-------------+--------------------------------+------------+-----------

Then the vfio-pci module initializes its own virtual PCI config space data ('vconfig') by reading the VF's physical PCI config space, so the 'Memory Space Enable' bit in vconfig will also have 0b value. This will make the vfio-pci find that the BAR memory is disabled, and the SIGBUS will be triggerred if access these BARs.

So it needs to enable PCI bus memory command explicitly to avoid access on disabled memory, which will call vfio-pci virtual PCI read/write API to set the 'Memory Space Enable' in vconfig space to 1b.

Fixes 33604c31354a ("vfio: refactor PCI BAR mapping")

---
v2: Rewrite the commit log, and put the link into it even it is long.

---
 drivers/bus/pci/linux/pci_vfio.c | 37 ++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)
drivers/bus/pci/linux/pci_vfio.c +37 -0
index 64cd84a68..9b6e45da5 100644
@@ -149,6 +149,38 @@ pci_vfio_get_msix_bar(int fd, struct pci_msix_table *msix_table)
 	return 0;
 }
 
+/* enable PCI bus memory command */
+static int
+pci_vfio_enable_bus_memory(int dev_fd)
+{
+	uint16_t cmd;
+	int ret;
+
+	ret = pread64(dev_fd, &cmd, sizeof(cmd),
+		      VFIO_GET_REGION_ADDR(VFIO_PCI_CONFIG_REGION_INDEX) +
+		      PCI_COMMAND);
+
+	if (ret != sizeof(cmd)) {
+		RTE_LOG(ERR, EAL, "Cannot read command from PCI config space!\n");
+		return -1;
+	}
+
+	if (cmd & PCI_COMMAND_MEMORY)
+		return 0;
+
+	cmd |= PCI_COMMAND_MEMORY;
+	ret = pwrite64(dev_fd, &cmd, sizeof(cmd),
+		       VFIO_GET_REGION_ADDR(VFIO_PCI_CONFIG_REGION_INDEX) +
+		       PCI_COMMAND);
+
+	if (ret != sizeof(cmd)) {
+		RTE_LOG(ERR, EAL, "Cannot write command to PCI config space!\n");
+		return -1;
+	}
+
+	return 0;
+}
+
 /* set PCI bus mastering */
 static int
 pci_vfio_set_bus_master(int dev_fd, bool op)
@@ -427,6 +459,11 @@ pci_rte_vfio_setup_device(struct rte_pci_device *dev, int vfio_dev_fd)
 		return -1;
 	}
 
+	if (pci_vfio_enable_bus_memory(vfio_dev_fd)) {
+		RTE_LOG(ERR, EAL, "Cannot enable bus memory command!\n");
+		return -1;
+	}
+
 	/* set bus mastering for the device */
 	if (pci_vfio_set_bus_master(vfio_dev_fd, true)) {
 		RTE_LOG(ERR, EAL, "Cannot set up bus mastering!\n");
Signature · 1 line
2.27.0
#2 lore raw
Quoted 28 lines · Haiyue Wang

To fix CVE-2020-12888, the linux vfio-pci module will invalidate mmaps and block MMIO access on disabled memory, it will send a SIGBUS to the application:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=abafbc551fddede3e0a08dee1dcde08fc0eb8476

When the application opens the vfio PCI device, the vfio-pci module will enable the memory bus command through PCI read/write access. According to the PCIe specification, for VF, the 'Memory Space Enable' is always zero:

Table 9-13 Command Register Changes

Bit Location | PF and VF Register Differences | PF | VF
| From Base | Attributes | Attributes
-------------+--------------------------------+------------+-----------

              | Memory Space Enable - Does not |            |
              | apply to VFs. Must be hardwired|  Base      |  0b
      1       | to 0b for VFs. VF Memory Space |            |
              | is controlled by the VF MSE bit|            |
              | in the VF Control register.    |            |

-------------+--------------------------------+------------+-----------

Then the vfio-pci module initializes its own virtual PCI config space data ('vconfig') by reading the VF's physical PCI config space, so the 'Memory Space Enable' bit in vconfig will also have 0b value. This will make the vfio-pci find that the BAR memory is disabled, and the SIGBUS will be triggerred if access these BARs.

Quoted 8 lines

So it needs to enable PCI bus memory command explicitly to avoid access on disabled memory, which will call vfio-pci virtual PCI read/write API to set the 'Memory Space Enable' in vconfig space to 1b.

Fixes 33604c31354a ("vfio: refactor PCI BAR mapping")

The patch itself looks good, but i wonder how far back do these go, and do we need workarounds for older kernels. IIRC v17.11 is still a supported release, and its kernel support might go back all the way to v3.6 when VFIO was first introduced.

Quoted 50 lines

---
v2: Rewrite the commit log, and put the link into it even it is long.

---
  drivers/bus/pci/linux/pci_vfio.c | 37 ++++++++++++++++++++++++++++++++
  1 file changed, 37 insertions(+)
drivers/bus/pci/linux/pci_vfio.c +32 -0
index 64cd84a68..9b6e45da5 100644
@@ -149,6 +149,38 @@ pci_vfio_get_msix_bar(int fd, struct pci_msix_table *msix_table)
  	return 0;
  }
 
+/* enable PCI bus memory command */
+static int
+pci_vfio_enable_bus_memory(int dev_fd)
+{
+	uint16_t cmd;
+	int ret;
+
+	ret = pread64(dev_fd, &cmd, sizeof(cmd),
+		      VFIO_GET_REGION_ADDR(VFIO_PCI_CONFIG_REGION_INDEX) +
+		      PCI_COMMAND);
+
+	if (ret != sizeof(cmd)) {
+		RTE_LOG(ERR, EAL, "Cannot read command from PCI config space!\n");
+		return -1;
+	}
+
+	if (cmd & PCI_COMMAND_MEMORY)
+		return 0;
+
+	cmd |= PCI_COMMAND_MEMORY;
+	ret = pwrite64(dev_fd, &cmd, sizeof(cmd),
+		       VFIO_GET_REGION_ADDR(VFIO_PCI_CONFIG_REGION_INDEX) +
+		       PCI_COMMAND);
+
+	if (ret != sizeof(cmd)) {
+		RTE_LOG(ERR, EAL, "Cannot write command to PCI config space!\n");
+		return -1;
+	}
+
+	return 0;
+}
+
  /* set PCI bus mastering */
  static int
  pci_vfio_set_bus_master(int dev_fd, bool op)

drivers/bus/pci/linux/pci_vfio.c pci_rte_vfio_setup_device(struct rte_pci_device *dev, int vfio_dev_fd) · line 463

Quoted 5 lines
drivers/bus/pci/linux/pci_vfio.c +2 -0
@@ -427,6 +459,11 @@ pci_rte_vfio_setup_device(struct rte_pci_device *dev, int vfio_dev_fd)
  		return -1;
  	}
 
+	if (pci_vfio_enable_bus_memory(vfio_dev_fd)) {
+		RTE_LOG(ERR, EAL, "Cannot enable bus memory command!\n");

Nitpick, but i think the word "command" is unneeded here :)

Quoted 7 lines
drivers/bus/pci/linux/pci_vfio.c +3 -0
+		return -1;
+	}
+
  	/* set bus mastering for the device */
  	if (pci_vfio_set_bus_master(vfio_dev_fd, true)) {
  		RTE_LOG(ERR, EAL, "Cannot set up bus mastering!\n");
Signature · 2 lines
Thanks,
Anatoly
#3 lore raw
Quoted 45 lines

-----Original Message-----
From: Burakov, Anatoly <[email protected]>
Sent: Monday, June 22, 2020 16:53
To: Wang, Haiyue <[email protected]>; [email protected]
Cc: [email protected]
Subject: Re: [PATCH v2] bus/pci: fix VF bus error for memory access

Quoted 4 lines · Haiyue Wang

To fix CVE-2020-12888, the linux vfio-pci module will invalidate mmaps and block MMIO access on disabled memory, it will send a SIGBUS to the application:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=abafbc551fddede3e0a08dee
1dcde08fc0eb8476

Quoted 31 lines

When the application opens the vfio PCI device, the vfio-pci module will enable the memory bus command through PCI read/write access. According to the PCIe specification, for VF, the 'Memory Space Enable' is always zero:

Table 9-13 Command Register Changes

Bit Location | PF and VF Register Differences | PF | VF
| From Base | Attributes | Attributes
-------------+--------------------------------+------------+-----------

              | Memory Space Enable - Does not |            |
              | apply to VFs. Must be hardwired|  Base      |  0b
      1       | to 0b for VFs. VF Memory Space |            |
              | is controlled by the VF MSE bit|            |
              | in the VF Control register.    |            |

-------------+--------------------------------+------------+-----------

Then the vfio-pci module initializes its own virtual PCI config space data ('vconfig') by reading the VF's physical PCI config space, so the 'Memory Space Enable' bit in vconfig will also have 0b value. This will make the vfio-pci find that the BAR memory is disabled, and the SIGBUS will be triggerred if access these BARs.

So it needs to enable PCI bus memory command explicitly to avoid access on disabled memory, which will call vfio-pci virtual PCI read/write API to set the 'Memory Space Enable' in vconfig space to 1b.

Fixes 33604c31354a ("vfio: refactor PCI BAR mapping")
Quoted 7 lines
Quoted 1 line

The patch itself looks good, but i wonder how far back do these go, and do we need workarounds for older kernels. IIRC v17.11 is still a supported release, and its kernel support might go back all the way to v3.6 when VFIO was first introduced.

Seems not a workaround, since I found the VF in qemu has 1 for memory space, please see the v3 commit log for detail. I added more investigation in it.

Quoted 53 lines
Quoted 53 lines

---
v2: Rewrite the commit log, and put the link into it even it is long.

---
  drivers/bus/pci/linux/pci_vfio.c | 37 ++++++++++++++++++++++++++++++++
  1 file changed, 37 insertions(+)
drivers/bus/pci/linux/pci_vfio.c +32 -0
index 64cd84a68..9b6e45da5 100644
@@ -149,6 +149,38 @@ pci_vfio_get_msix_bar(int fd, struct pci_msix_table *msix_table)
  	return 0;
  }
 
+/* enable PCI bus memory command */
+static int
+pci_vfio_enable_bus_memory(int dev_fd)
+{
+	uint16_t cmd;
+	int ret;
+
+	ret = pread64(dev_fd, &cmd, sizeof(cmd),
+		      VFIO_GET_REGION_ADDR(VFIO_PCI_CONFIG_REGION_INDEX) +
+		      PCI_COMMAND);
+
+	if (ret != sizeof(cmd)) {
+		RTE_LOG(ERR, EAL, "Cannot read command from PCI config space!\n");
+		return -1;
+	}
+
+	if (cmd & PCI_COMMAND_MEMORY)
+		return 0;
+
+	cmd |= PCI_COMMAND_MEMORY;
+	ret = pwrite64(dev_fd, &cmd, sizeof(cmd),
+		       VFIO_GET_REGION_ADDR(VFIO_PCI_CONFIG_REGION_INDEX) +
+		       PCI_COMMAND);
+
+	if (ret != sizeof(cmd)) {
+		RTE_LOG(ERR, EAL, "Cannot write command to PCI config space!\n");
+		return -1;
+	}
+
+	return 0;
+}
+
  /* set PCI bus mastering */
  static int
  pci_vfio_set_bus_master(int dev_fd, bool op)
@@ -427,6 +459,11 @@ pci_rte_vfio_setup_device(struct rte_pci_device *dev, int vfio_dev_fd)
  		return -1;
  	}
 
Quoted 5 lines

drivers/bus/pci/linux/pci_vfio.c pci_rte_vfio_setup_device(struct rte_pci_device *dev, int vfio_dev_fd) · line 463

Quoted 2 lines
drivers/bus/pci/linux/pci_vfio.c +2 -0
+	if (pci_vfio_enable_bus_memory(vfio_dev_fd)) {
+		RTE_LOG(ERR, EAL, "Cannot enable bus memory command!\n");

Nitpick, but i think the word "command" is unneeded here :)

Fixed in v3.

Quoted 12 lines

drivers/bus/pci/linux/pci_vfio.c pci_rte_vfio_setup_device(struct rte_pci_device *dev, int vfio_dev_fd) · line 469

Quoted 7 lines
drivers/bus/pci/linux/pci_vfio.c +3 -0
+		return -1;
+	}
+
  	/* set bus mastering for the device */
  	if (pci_vfio_set_bus_master(vfio_dev_fd, true)) {
  		RTE_LOG(ERR, EAL, "Cannot set up bus mastering!\n");

--
Thanks,
Anatoly

#4 lore raw

PATCH v3 1/1 bus/pci: fix VF bus error for memory access

In reply to Haiyue Wang

To fix CVE-2020-12888, the linux vfio-pci module will invalidate mmaps and block MMIO access on disabled memory, it will send a SIGBUS to the application:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=abafbc551fddede3e0a08dee1dcde08fc0eb8476

When the application opens the vfio PCI device, the vfio-pci module will enable the bus memory space through PCI read/write access. According to the PCIe specification, the 'Memory Space Enable' is always zero for VF:

Table 9-13 Command Register Changes

Bit Location | PF and VF Register Differences | PF         | VF
             | From Base                      | Attributes | Attributes
-------------+--------------------------------+------------+-----------
             | Memory Space Enable - Does not |            |
             | apply to VFs. Must be hardwired|  Base      |  0b
     1       | to 0b for VFs. VF Memory Space |            |
             | is controlled by the VF MSE bit|            |
             | in the VF Control register.    |            |

-------------+--------------------------------+------------+-----------

Afterwards the vfio-pci will initialize its own virtual PCI config space data ('vconfig') by reading the VF's physical PCI config space, then the 'Memory Space Enable' bit in vconfig will always be 0b value. This will make the vfio-pci treat the BAR memory space as disabled, and the SIGBUS will be triggerred if access these BARs.

By investigation, the VF PCI device *passthrough* into the Guest OS by QEMU has the 'Memory Space Enable' with 1b value. That's because every PCI driver will start to enable the memory space, and this action will be hooked by vfio-pci virtual PCI read/write to set the 'Memory Space Enable' in vconfig space to 1b. So VF runs in guest OS has 'Mem+', but VF runs in host OS has 'Mem-'.

Align with PCI working mode in Guest/QEMU/Host, in DPDK, enable the PCI bus memory space explicitly to avoid access on disabled memory.

Fixes 33604c31354a ("vfio: refactor PCI BAR mapping")

---
v3: update the commit log, and fix one debug log with redundant description.
v2: Rewrite the commit log, and put the link into it even it is long.

---
 drivers/bus/pci/linux/pci_vfio.c | 37 ++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)
drivers/bus/pci/linux/pci_vfio.c +37 -0
index 64cd84a68..ba60e7ce9 100644
@@ -149,6 +149,38 @@ pci_vfio_get_msix_bar(int fd, struct pci_msix_table *msix_table)
 	return 0;
 }
 
+/* enable PCI bus memory space */
+static int
+pci_vfio_enable_bus_memory(int dev_fd)
+{
+	uint16_t cmd;
+	int ret;
+
+	ret = pread64(dev_fd, &cmd, sizeof(cmd),
+		      VFIO_GET_REGION_ADDR(VFIO_PCI_CONFIG_REGION_INDEX) +
+		      PCI_COMMAND);
+
+	if (ret != sizeof(cmd)) {
+		RTE_LOG(ERR, EAL, "Cannot read command from PCI config space!\n");
+		return -1;
+	}
+
+	if (cmd & PCI_COMMAND_MEMORY)
+		return 0;
+
+	cmd |= PCI_COMMAND_MEMORY;
+	ret = pwrite64(dev_fd, &cmd, sizeof(cmd),
+		       VFIO_GET_REGION_ADDR(VFIO_PCI_CONFIG_REGION_INDEX) +
+		       PCI_COMMAND);
+
+	if (ret != sizeof(cmd)) {
+		RTE_LOG(ERR, EAL, "Cannot write command to PCI config space!\n");
+		return -1;
+	}
+
+	return 0;
+}
+
 /* set PCI bus mastering */
 static int
 pci_vfio_set_bus_master(int dev_fd, bool op)
@@ -427,6 +459,11 @@ pci_rte_vfio_setup_device(struct rte_pci_device *dev, int vfio_dev_fd)
 		return -1;
 	}
 
+	if (pci_vfio_enable_bus_memory(vfio_dev_fd)) {
+		RTE_LOG(ERR, EAL, "Cannot enable bus memory!\n");
+		return -1;
+	}
+
 	/* set bus mastering for the device */
 	if (pci_vfio_set_bus_master(vfio_dev_fd, true)) {
 		RTE_LOG(ERR, EAL, "Cannot set up bus mastering!\n");
Signature · 1 line
2.27.0
Acked-by on v3 1/1
#5 lore raw
Quoted 40 lines · Haiyue Wang

To fix CVE-2020-12888, the linux vfio-pci module will invalidate mmaps and block MMIO access on disabled memory, it will send a SIGBUS to the application:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=abafbc551fddede3e0a08dee1dcde08fc0eb8476

When the application opens the vfio PCI device, the vfio-pci module will enable the bus memory space through PCI read/write access. According to the PCIe specification, the 'Memory Space Enable' is always zero for VF:

Table 9-13 Command Register Changes

Bit Location | PF and VF Register Differences | PF | VF
| From Base | Attributes | Attributes
-------------+--------------------------------+------------+-----------

              | Memory Space Enable - Does not |            |
              | apply to VFs. Must be hardwired|  Base      |  0b
      1       | to 0b for VFs. VF Memory Space |            |
              | is controlled by the VF MSE bit|            |
              | in the VF Control register.    |            |

-------------+--------------------------------+------------+-----------

Afterwards the vfio-pci will initialize its own virtual PCI config space data ('vconfig') by reading the VF's physical PCI config space, then the 'Memory Space Enable' bit in vconfig will always be 0b value. This will make the vfio-pci treat the BAR memory space as disabled, and the SIGBUS will be triggerred if access these BARs.

By investigation, the VF PCI device *passthrough* into the Guest OS by QEMU has the 'Memory Space Enable' with 1b value. That's because every PCI driver will start to enable the memory space, and this action will be hooked by vfio-pci virtual PCI read/write to set the 'Memory Space Enable' in vconfig space to 1b. So VF runs in guest OS has 'Mem+', but VF runs in host OS has 'Mem-'.

Align with PCI working mode in Guest/QEMU/Host, in DPDK, enable the PCI bus memory space explicitly to avoid access on disabled memory.

Fixes 33604c31354a ("vfio: refactor PCI BAR mapping")
Quoted 6 lines

---
v3: update the commit log, and fix one debug log with redundant description.
v2: Rewrite the commit log, and put the link into it even it is long.
---

Signature · 2 lines
Thanks,
Anatoly
Tested-by on v3 1/1
#6 lore raw
In reply to Haiyue Wang
Quoted 34 lines · Haiyue Wang

To fix CVE-2020-12888, the linux vfio-pci module will invalidate mmaps and block MMIO access on disabled memory, it will send a SIGBUS to the application:
https://urldefense.proofpoint.com/v2/url?u=https-3A__git.kernel.org_pub_scm_linux_kernel_git_torvalds_linux.git_commit_-3Fid-3Dabafbc551fddede3e0a08dee1dcde08fc0eb8476&d=DwIDAg&c=nKjWec2b6R0mOyPaz7xtfQ&r=5ESHPj7V-7JdkxT_Z_SU6RrS37ys4UXudBQ_rrS5LRo&m=L4wvNYSLDBSsweJGHfGSw3cDNDi0ioJdsQbH2-pEVqE&s=9v3r9tYw6p5Paet2O3Nc2IPdOL1-o77RjYJx5H8G0vc&e=

When the application opens the vfio PCI device, the vfio-pci module will enable the bus memory space through PCI read/write access. According to the PCIe specification, the 'Memory Space Enable' is always zero for VF:

Table 9-13 Command Register Changes

Bit Location | PF and VF Register Differences | PF         | VF
             | From Base                      | Attributes | Attributes
-------------+--------------------------------+------------+-----------
             | Memory Space Enable - Does not |            |
             | apply to VFs. Must be hardwired|  Base      |  0b
     1       | to 0b for VFs. VF Memory Space |            |
             | is controlled by the VF MSE bit|            |
             | in the VF Control register.    |            |

-------------+--------------------------------+------------+-----------

Afterwards the vfio-pci will initialize its own virtual PCI config space data ('vconfig') by reading the VF's physical PCI config space, then the 'Memory Space Enable' bit in vconfig will always be 0b value. This will make the vfio-pci treat the BAR memory space as disabled, and the SIGBUS will be triggerred if access these BARs.

By investigation, the VF PCI device *passthrough* into the Guest OS by QEMU has the 'Memory Space Enable' with 1b value. That's because every PCI driver will start to enable the memory space, and this action will be hooked by vfio-pci virtual PCI read/write to set the 'Memory Space Enable' in vconfig space to 1b. So VF runs in guest OS has 'Mem+', but VF runs in host OS has 'Mem-'.

Quoted 7 lines

Align with PCI working mode in Guest/QEMU/Host, in DPDK, enable the PCI bus memory space explicitly to avoid access on disabled memory.

Fixes 33604c31354a ("vfio: refactor PCI BAR mapping")
Quoted 66 lines

---
v3: update the commit log, and fix one debug log with redundant description.
v2: Rewrite the commit log, and put the link into it even it is long.

---
 drivers/bus/pci/linux/pci_vfio.c | 37 ++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)
drivers/bus/pci/linux/pci_vfio.c +37 -0
index 64cd84a68..ba60e7ce9 100644
@@ -149,6 +149,38 @@ pci_vfio_get_msix_bar(int fd, struct pci_msix_table *msix_table)
 	return 0;
 }
 
+/* enable PCI bus memory space */
+static int
+pci_vfio_enable_bus_memory(int dev_fd)
+{
+	uint16_t cmd;
+	int ret;
+
+	ret = pread64(dev_fd, &cmd, sizeof(cmd),
+		      VFIO_GET_REGION_ADDR(VFIO_PCI_CONFIG_REGION_INDEX) +
+		      PCI_COMMAND);
+
+	if (ret != sizeof(cmd)) {
+		RTE_LOG(ERR, EAL, "Cannot read command from PCI config space!\n");
+		return -1;
+	}
+
+	if (cmd & PCI_COMMAND_MEMORY)
+		return 0;
+
+	cmd |= PCI_COMMAND_MEMORY;
+	ret = pwrite64(dev_fd, &cmd, sizeof(cmd),
+		       VFIO_GET_REGION_ADDR(VFIO_PCI_CONFIG_REGION_INDEX) +
+		       PCI_COMMAND);
+
+	if (ret != sizeof(cmd)) {
+		RTE_LOG(ERR, EAL, "Cannot write command to PCI config space!\n");
+		return -1;
+	}
+
+	return 0;
+}
+
 /* set PCI bus mastering */
 static int
 pci_vfio_set_bus_master(int dev_fd, bool op)
@@ -427,6 +459,11 @@ pci_rte_vfio_setup_device(struct rte_pci_device *dev, int vfio_dev_fd)
 		return -1;
 	}
 
+	if (pci_vfio_enable_bus_memory(vfio_dev_fd)) {
+		RTE_LOG(ERR, EAL, "Cannot enable bus memory!\n");
+		return -1;
+	}
+
 	/* set bus mastering for the device */
 	if (pci_vfio_set_bus_master(vfio_dev_fd, true)) {
 		RTE_LOG(ERR, EAL, "Cannot set up bus mastering!\n");
Signature · 1 line
2.27.0
Tested-by on v3 1/1
#7 lore raw
In reply to Haiyue Wang
Quoted 20 lines · Haiyue Wang

To fix CVE-2020-12888, the linux vfio-pci module will invalidate mmaps and block MMIO access on disabled memory, it will send a SIGBUS to the application:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=abafbc551fddede3e0a08dee1dcde08fc0eb8476

When the application opens the vfio PCI device, the vfio-pci module will enable the bus memory space through PCI read/write access. According to the PCIe specification, the 'Memory Space Enable' is always zero for VF:

Table 9-13 Command Register Changes

Bit Location | PF and VF Register Differences | PF         | VF
             | From Base                      | Attributes | Attributes
-------------+--------------------------------+------------+-----------
             | Memory Space Enable - Does not |            |
             | apply to VFs. Must be hardwired|  Base      |  0b
     1       | to 0b for VFs. VF Memory Space |            |
             | is controlled by the VF MSE bit|            |
             | in the VF Control register.    |            |
Quoted 7 lines

-------------+--------------------------------+------------+-----------

Afterwards the vfio-pci will initialize its own virtual PCI config space data ('vconfig') by reading the VF's physical PCI config space, then the 'Memory Space Enable' bit in vconfig will always be 0b value. This will make the vfio-pci treat the BAR memory space as disabled, and the SIGBUS will be triggerred if access these BARs.

triggered

Quoted 8 lines

By investigation, the VF PCI device *passthrough* into the Guest OS by QEMU has the 'Memory Space Enable' with 1b value. That's because every PCI driver will start to enable the memory space, and this action will be hooked by vfio-pci virtual PCI read/write to set the 'Memory Space Enable' in vconfig space to 1b. So VF runs in guest OS has 'Mem+', but VF runs in host OS has 'Mem-'.

Quoted 7 lines

Align with PCI working mode in Guest/QEMU/Host, in DPDK, enable the PCI bus memory space explicitly to avoid access on disabled memory.

Fixes 33604c31354a ("vfio: refactor PCI BAR mapping")

Ouch, we just hit it.
Thanks for fixing!

Signature · 1 line
David Marchand
#8 lore raw
Quoted 33 lines

-----Original Message-----
From: David Marchand <[email protected]>
Sent: Thursday, June 25, 2020 04:01
To: Wang, Haiyue <[email protected]>
Cc: dev <[email protected]>; Burakov, Anatoly <[email protected]>; dpdk stable <[email protected]>; Maxime Coquelin <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v3] bus/pci: fix VF bus error for memory access

Quoted 5 lines · Haiyue Wang

To fix CVE-2020-12888, the linux vfio-pci module will invalidate mmaps and block MMIO access on disabled memory, it will send a SIGBUS to the application:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=abafbc551fddede3e0a08dee
1dcde08fc0eb8476

Quoted 17 lines

When the application opens the vfio PCI device, the vfio-pci module will enable the bus memory space through PCI read/write access. According to the PCIe specification, the 'Memory Space Enable' is always zero for VF:

Table 9-13 Command Register Changes

Bit Location | PF and VF Register Differences | PF         | VF
             | From Base                      | Attributes | Attributes
-------------+--------------------------------+------------+-----------
             | Memory Space Enable - Does not |            |
             | apply to VFs. Must be hardwired|  Base      |  0b
     1       | to 0b for VFs. VF Memory Space |            |
             | is controlled by the VF MSE bit|            |
             | in the VF Control register.    |            |

-------------+--------------------------------+------------+-----------

Quoted 8 lines
Quoted 5 lines

Afterwards the vfio-pci will initialize its own virtual PCI config space data ('vconfig') by reading the VF's physical PCI config space, then the 'Memory Space Enable' bit in vconfig will always be 0b value. This will make the vfio-pci treat the BAR memory space as disabled, and the SIGBUS will be triggerred if access these BARs.

triggered

Fixed in v4.

Quoted 24 lines
Quoted 8 lines

By investigation, the VF PCI device *passthrough* into the Guest OS by QEMU has the 'Memory Space Enable' with 1b value. That's because every PCI driver will start to enable the memory space, and this action will be hooked by vfio-pci virtual PCI read/write to set the 'Memory Space Enable' in vconfig space to 1b. So VF runs in guest OS has 'Mem+', but VF runs in host OS has 'Mem-'.

Quoted 7 lines

Align with PCI working mode in Guest/QEMU/Host, in DPDK, enable the PCI bus memory space explicitly to avoid access on disabled memory.

Fixes 33604c31354a ("vfio: refactor PCI BAR mapping")

Ouch, we just hit it.
Thanks for fixing!

--
David Marchand

#9 lore raw

PATCH v4 1/1 bus/pci: fix VF bus error for memory access

In reply to Haiyue Wang

To fix CVE-2020-12888, the linux vfio-pci module will invalidate mmaps and block MMIO access on disabled memory, it will send a SIGBUS to the application:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=abafbc551fddede3e0a08dee1dcde08fc0eb8476

When the application opens the vfio PCI device, the vfio-pci module will enable the bus memory space through PCI read/write access. According to the PCIe specification, the 'Memory Space Enable' is always zero for VF:

Table 9-13 Command Register Changes

Bit Location | PF and VF Register Differences | PF         | VF
             | From Base                      | Attributes | Attributes
-------------+--------------------------------+------------+-----------
             | Memory Space Enable - Does not |            |
             | apply to VFs. Must be hardwired|  Base      |  0b
     1       | to 0b for VFs. VF Memory Space |            |
             | is controlled by the VF MSE bit|            |
             | in the VF Control register.    |            |

-------------+--------------------------------+------------+-----------

Afterwards the vfio-pci will initialize its own virtual PCI config space data ('vconfig') by reading the VF's physical PCI config space, then the 'Memory Space Enable' bit in vconfig will always be 0b value. This will make the vfio-pci treat the BAR memory space as disabled, and the SIGBUS will be triggered if access these BARs.

By investigation, the VF PCI device *passthrough* into the Guest OS by QEMU has the 'Memory Space Enable' with 1b value. That's because every PCI driver will start to enable the memory space, and this action will be hooked by vfio-pci virtual PCI read/write to set the 'Memory Space Enable' in vconfig space to 1b. So VF runs in guest OS has 'Mem+', but VF runs in host OS has 'Mem-'.

Align with PCI working mode in Guest/QEMU/Host, in DPDK, enable the PCI bus memory space explicitly to avoid access on disabled memory.

Fixes 33604c31354a ("vfio: refactor PCI BAR mapping")

---
v4: Fix commit message typo.
v3: Update the commit log, and fix one debug log with redundant description.
v2: Rewrite the commit log, and put the link into it even it is long.

---
 drivers/bus/pci/linux/pci_vfio.c | 37 ++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)
drivers/bus/pci/linux/pci_vfio.c +37 -0
index 64cd84a68..ba60e7ce9 100644
@@ -149,6 +149,38 @@ pci_vfio_get_msix_bar(int fd, struct pci_msix_table *msix_table)
 	return 0;
 }
 
+/* enable PCI bus memory space */
+static int
+pci_vfio_enable_bus_memory(int dev_fd)
+{
+	uint16_t cmd;
+	int ret;
+
+	ret = pread64(dev_fd, &cmd, sizeof(cmd),
+		      VFIO_GET_REGION_ADDR(VFIO_PCI_CONFIG_REGION_INDEX) +
+		      PCI_COMMAND);
+
+	if (ret != sizeof(cmd)) {
+		RTE_LOG(ERR, EAL, "Cannot read command from PCI config space!\n");
+		return -1;
+	}
+
+	if (cmd & PCI_COMMAND_MEMORY)
+		return 0;
+
+	cmd |= PCI_COMMAND_MEMORY;
+	ret = pwrite64(dev_fd, &cmd, sizeof(cmd),
+		       VFIO_GET_REGION_ADDR(VFIO_PCI_CONFIG_REGION_INDEX) +
+		       PCI_COMMAND);
+
+	if (ret != sizeof(cmd)) {
+		RTE_LOG(ERR, EAL, "Cannot write command to PCI config space!\n");
+		return -1;
+	}
+
+	return 0;
+}
+
 /* set PCI bus mastering */
 static int
 pci_vfio_set_bus_master(int dev_fd, bool op)
@@ -427,6 +459,11 @@ pci_rte_vfio_setup_device(struct rte_pci_device *dev, int vfio_dev_fd)
 		return -1;
 	}
 
+	if (pci_vfio_enable_bus_memory(vfio_dev_fd)) {
+		RTE_LOG(ERR, EAL, "Cannot enable bus memory!\n");
+		return -1;
+	}
+
 	/* set bus mastering for the device */
 	if (pci_vfio_set_bus_master(vfio_dev_fd, true)) {
 		RTE_LOG(ERR, EAL, "Cannot set up bus mastering!\n");
Signature · 1 line
2.27.0
Tested-by Thierry Martin on v4 1/1 Applied
#10 lore raw
Quoted 38 lines · Haiyue Wang

To fix CVE-2020-12888, the linux vfio-pci module will invalidate mmaps and block MMIO access on disabled memory, it will send a SIGBUS to the application:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=abafbc551fddede3e0a08dee1dcde08fc0eb8476

When the application opens the vfio PCI device, the vfio-pci module will enable the bus memory space through PCI read/write access. According to the PCIe specification, the 'Memory Space Enable' is always zero for VF:

Table 9-13 Command Register Changes

Bit Location | PF and VF Register Differences | PF         | VF
             | From Base                      | Attributes | Attributes
-------------+--------------------------------+------------+-----------
             | Memory Space Enable - Does not |            |
             | apply to VFs. Must be hardwired|  Base      |  0b
     1       | to 0b for VFs. VF Memory Space |            |
             | is controlled by the VF MSE bit|            |
             | in the VF Control register.    |            |

-------------+--------------------------------+------------+-----------

Afterwards the vfio-pci will initialize its own virtual PCI config space data ('vconfig') by reading the VF's physical PCI config space, then the 'Memory Space Enable' bit in vconfig will always be 0b value. This will make the vfio-pci treat the BAR memory space as disabled, and the SIGBUS will be triggered if access these BARs.

By investigation, the VF PCI device *passthrough* into the Guest OS by QEMU has the 'Memory Space Enable' with 1b value. That's because every PCI driver will start to enable the memory space, and this action will be hooked by vfio-pci virtual PCI read/write to set the 'Memory Space Enable' in vconfig space to 1b. So VF runs in guest OS has 'Mem+', but VF runs in host OS has 'Mem-'.

Align with PCI working mode in Guest/QEMU/Host, in DPDK, enable the PCI bus memory space explicitly to avoid access on disabled memory.

Quoted 7 lines
Fixes 33604c31354a ("vfio: refactor PCI BAR mapping")

Applied, thanks again Haiyue.

Kevin, Luca,

I can see that some distros have already started backporting the fix in kernel (fc31, fc32 and rhel7 at least for what I saw). 18.11 and 19.11 will need this fix at some point.
I'll let you decide on the proper timing.

Signature · 1 line
David Marchand
#11 lore raw
Quoted 51 lines · David Marchand
Quoted 38 lines · Haiyue Wang

To fix CVE-2020-12888, the linux vfio-pci module will invalidate mmaps and block MMIO access on disabled memory, it will send a SIGBUS to the application:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=abafbc551fddede3e0a08dee1dcde08fc0eb8476

When the application opens the vfio PCI device, the vfio-pci module will enable the bus memory space through PCI read/write access. According to the PCIe specification, the 'Memory Space Enable' is always zero for VF:

Table 9-13 Command Register Changes

Bit Location | PF and VF Register Differences | PF         | VF
             | From Base                      | Attributes | Attributes
-------------+--------------------------------+------------+-----------
             | Memory Space Enable - Does not |            |
             | apply to VFs. Must be hardwired|  Base      |  0b
     1       | to 0b for VFs. VF Memory Space |            |
             | is controlled by the VF MSE bit|            |
             | in the VF Control register.    |            |

-------------+--------------------------------+------------+-----------

Afterwards the vfio-pci will initialize its own virtual PCI config space data ('vconfig') by reading the VF's physical PCI config space, then the 'Memory Space Enable' bit in vconfig will always be 0b value. This will make the vfio-pci treat the BAR memory space as disabled, and the SIGBUS will be triggered if access these BARs.

By investigation, the VF PCI device *passthrough* into the Guest OS by QEMU has the 'Memory Space Enable' with 1b value. That's because every PCI driver will start to enable the memory space, and this action will be hooked by vfio-pci virtual PCI read/write to set the 'Memory Space Enable' in vconfig space to 1b. So VF runs in guest OS has 'Mem+', but VF runs in host OS has 'Mem-'.

Align with PCI working mode in Guest/QEMU/Host, in DPDK, enable the PCI bus memory space explicitly to avoid access on disabled memory.

Quoted 7 lines
Fixes 33604c31354a ("vfio: refactor PCI BAR mapping")

Applied, thanks again Haiyue.

Quoted 8 lines

Kevin, Luca,

I can see that some distros have already started backporting the fix in kernel (fc31, fc32 and rhel7 at least for what I saw). 18.11 and 19.11 will need this fix at some point.
I'll let you decide on the proper timing.

It looks an important fix. I think it's worth having in 18.11.9. I will apply and create an 18.11.9-rc2 tomorrow, so if anyone hasn't started validation already, they can validate with it in.

#12 lore raw
Quoted 72 lines

-----Original Message-----
From: Kevin Traynor <[email protected]>
Sent: Friday, June 26, 2020 00:46
To: David Marchand <[email protected]>; Wang, Haiyue <[email protected]>; Luca Boccassi <[email protected]>
Cc: dev <[email protected]>; Burakov, Anatoly <[email protected]>; dpdk stable <[email protected]>; Harman Kalra <[email protected]>
Subject: Re: [PATCH v4] bus/pci: fix VF bus error for memory access

Quoted 6 lines · David Marchand
Quoted 5 lines · Haiyue Wang

To fix CVE-2020-12888, the linux vfio-pci module will invalidate mmaps and block MMIO access on disabled memory, it will send a SIGBUS to the application:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=abafbc551fddede3e0a08dee
1dcde08fc0eb8476

Quoted 45 lines
Quoted 33 lines

When the application opens the vfio PCI device, the vfio-pci module will enable the bus memory space through PCI read/write access. According to the PCIe specification, the 'Memory Space Enable' is always zero for VF:

Table 9-13 Command Register Changes

Bit Location | PF and VF Register Differences | PF         | VF
             | From Base                      | Attributes | Attributes
-------------+--------------------------------+------------+-----------
             | Memory Space Enable - Does not |            |
             | apply to VFs. Must be hardwired|  Base      |  0b
     1       | to 0b for VFs. VF Memory Space |            |
             | is controlled by the VF MSE bit|            |
             | in the VF Control register.    |            |

-------------+--------------------------------+------------+-----------

Afterwards the vfio-pci will initialize its own virtual PCI config space data ('vconfig') by reading the VF's physical PCI config space, then the 'Memory Space Enable' bit in vconfig will always be 0b value. This will make the vfio-pci treat the BAR memory space as disabled, and the SIGBUS will be triggered if access these BARs.

By investigation, the VF PCI device *passthrough* into the Guest OS by QEMU has the 'Memory Space Enable' with 1b value. That's because every PCI driver will start to enable the memory space, and this action will be hooked by vfio-pci virtual PCI read/write to set the 'Memory Space Enable' in vconfig space to 1b. So VF runs in guest OS has 'Mem+', but VF runs in host OS has 'Mem-'.

Align with PCI working mode in Guest/QEMU/Host, in DPDK, enable the PCI bus memory space explicitly to avoid access on disabled memory.

Quoted 7 lines
Fixes 33604c31354a ("vfio: refactor PCI BAR mapping")

Applied, thanks again Haiyue.

Quoted 8 lines

Kevin, Luca,

I can see that some distros have already started backporting the fix in kernel (fc31, fc32 and rhel7 at least for what I saw). 18.11 and 19.11 will need this fix at some point.
I'll let you decide on the proper timing.

Quoted 3 lines

It looks an important fix. I think it's worth having in 18.11.9. I will apply and create an 18.11.9-rc2 tomorrow, so if anyone hasn't started validation already, they can validate with it in.

Alex post a fix in kernel just now. So looks like the DPDK patch is nice to have, not a MUST. ;-)

https://lore.kernel.org/kvm/[email protected]/T/#u

#13 lore raw
Quoted 72 lines · Haiyue
Quoted 72 lines

-----Original Message-----
From: Kevin Traynor <[email protected]>
Sent: Friday, June 26, 2020 00:46
To: David Marchand <[email protected]>; Wang, Haiyue <[email protected]>; Luca Boccassi <[email protected]>
Cc: dev <[email protected]>; Burakov, Anatoly <[email protected]>; dpdk stable <[email protected]>; Harman Kalra <[email protected]>
Subject: Re: [PATCH v4] bus/pci: fix VF bus error for memory access

Quoted 6 lines · David Marchand
Quoted 5 lines · Haiyue Wang

To fix CVE-2020-12888, the linux vfio-pci module will invalidate mmaps and block MMIO access on disabled memory, it will send a SIGBUS to the application:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=abafbc551fddede3e0a08dee
1dcde08fc0eb8476

Quoted 53 lines
Quoted 33 lines

When the application opens the vfio PCI device, the vfio-pci module will enable the bus memory space through PCI read/write access. According to the PCIe specification, the 'Memory Space Enable' is always zero for VF:

Table 9-13 Command Register Changes

Bit Location | PF and VF Register Differences | PF         | VF
             | From Base                      | Attributes | Attributes
-------------+--------------------------------+------------+-----------
             | Memory Space Enable - Does not |            |
             | apply to VFs. Must be hardwired|  Base      |  0b
     1       | to 0b for VFs. VF Memory Space |            |
             | is controlled by the VF MSE bit|            |
             | in the VF Control register.    |            |

-------------+--------------------------------+------------+-----------

Afterwards the vfio-pci will initialize its own virtual PCI config space data ('vconfig') by reading the VF's physical PCI config space, then the 'Memory Space Enable' bit in vconfig will always be 0b value. This will make the vfio-pci treat the BAR memory space as disabled, and the SIGBUS will be triggered if access these BARs.

By investigation, the VF PCI device *passthrough* into the Guest OS by QEMU has the 'Memory Space Enable' with 1b value. That's because every PCI driver will start to enable the memory space, and this action will be hooked by vfio-pci virtual PCI read/write to set the 'Memory Space Enable' in vconfig space to 1b. So VF runs in guest OS has 'Mem+', but VF runs in host OS has 'Mem-'.

Align with PCI working mode in Guest/QEMU/Host, in DPDK, enable the PCI bus memory space explicitly to avoid access on disabled memory.

Quoted 7 lines
Fixes 33604c31354a ("vfio: refactor PCI BAR mapping")

Applied, thanks again Haiyue.

Kevin, Luca,

I can see that some distros have already started backporting the fix in kernel (fc31, fc32 and rhel7 at least for what I saw). 18.11 and 19.11 will need this fix at some point.
I'll let you decide on the proper timing.

Quoted 7 lines
Quoted 3 lines

It looks an important fix. I think it's worth having in 18.11.9. I will apply and create an 18.11.9-rc2 tomorrow, so if anyone hasn't started validation already, they can validate with it in.

Alex post a fix in kernel just now. So looks like the DPDK patch is nice to have, not a MUST. ;-)

Thanks for the update Haiyue. That may be true in the future, but not at the moment. The patch is just submitted yesterday, so I don't know how long it will take to filter through to all the distro kernels (and users to update).

I think it's still worth to take this patch now in 18.11. I will wait until this afternoon in case anyone has reasons not to.

thanks,
Kevin.

Quoted 2 lines

https://lore.kernel.org/kvm/[email protected]/T/#u

#14 lore raw
In reply to Wang, Haiyue
Quoted 7 lines · Haiyue
Quoted 7 lines
Quoted 6 lines

I can see that some distros have already started backporting the fix in kernel (fc31, fc32 and rhel7 at least for what I saw). 18.11 and 19.11 will need this fix at some point.
I'll let you decide on the proper timing.

Quoted 8 lines
Quoted 3 lines

It looks an important fix. I think it's worth having in 18.11.9. I will apply and create an 18.11.9-rc2 tomorrow, so if anyone hasn't started validation already, they can validate with it in.

Alex post a fix in kernel just now. So looks like the DPDK patch is nice to have, not a MUST. ;-)

https://lore.kernel.org/kvm/[email protected]/T/#u

Yes, this has been discussed offlist and Alex proposed an adjustment on the CVE fix.
But we still have to live with the situation where people will have only the first part of the fix.
I am still for backporting this change to stable branches.

Signature · 1 line
David Marchand
#15 lore raw
Quoted 23 lines

-----Original Message-----
From: David Marchand <[email protected]>
Sent: Friday, June 26, 2020 17:17
To: Wang, Haiyue <[email protected]>
Cc: Kevin Traynor <[email protected]>; Luca Boccassi <[email protected]>; dev <[email protected]>; Burakov, Anatoly <[email protected]>; dpdk stable <[email protected]>; Harman Kalra <[email protected]>
Subject: Re: [PATCH v4] bus/pci: fix VF bus error for memory access

Quoted 14 lines · Haiyue
Quoted 10 lines
Quoted 6 lines

I can see that some distros have already started backporting the fix in kernel (fc31, fc32 and rhel7 at least for what I saw). 18.11 and 19.11 will need this fix at some point.
I'll let you decide on the proper timing.

It looks an important fix. I think it's worth having in 18.11.9. I will apply and create an 18.11.9-rc2 tomorrow, so if anyone hasn't started validation already, they can validate with it in.

Alex post a fix in kernel just now. So looks like the DPDK patch is nice to have, not a MUST. ;-)

Quoted 8 lines
Quoted 1 line

https://lore.kernel.org/kvm/[email protected]/T/#u

Yes, this has been discussed offlist and Alex proposed an adjustment on the CVE fix.
But we still have to live with the situation where people will have only the first part of the fix.
I am still for backporting this change to stable branches.

Got it, thanks for sharing.

Quoted 3 lines

--
David Marchand