Skip to contentSkip to conversation

PVRDMA queue

GIT PULL Applied Marcel Apfelbaum 2 participants 5 messages Jul 4, 2021 – Jul 5, 2021

lore
Share & tools
lore
#0 lore raw

The following changes since commit 9c2647f75004c4f7d64c9c0ec55f8c6f0739a8b1:

Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging (2021-07-02 11:46:32 +0100)

are available in the Git repository at:

https://github.com/marcel-apf/qemu tags/pvrdma-04-07-2021-v2

for you to fetch changes up to 66ae37d8cc313f89272e711174a846a229bcdbd3:

pvrdma: Fix the ring init error flow (CVE-2021-3608) (2021-07-04 22:47:51 +0300)

----------------------------------------------------------------
PVRDMA queue

Several CVE fixes for the PVRDMA device.

----------------------------------------------------------------

Marcel Apfelbaum (3):
hw/rdma: Fix possible mremap overflow in the pvrdma device

    (CVE-2021-3582)

pvrdma: Ensure correct input on ring init (CVE-2021-3607)
pvrdma: Fix the ring init error flow (CVE-2021-3608)

 hw/rdma/vmw/pvrdma_cmd.c      | 7 +++++++
 hw/rdma/vmw/pvrdma_dev_ring.c | 2 +-
 hw/rdma/vmw/pvrdma_main.c     | 5 +++++
 3 files changed, 13 insertions(+), 1 deletion(-)
Signature · 1 line
2.17.2
#1 lore raw

[PULL V2 1/3] hw/rdma: Fix possible mremap overflow in the pvrdma device (CVE-2021-3582)

From: Marcel Apfelbaum <[email protected]>

Ensure mremap boundaries not trusting the guest kernel to pass the correct buffer length.

Message-Id: <[email protected]>

---
v1 -> v2: Fix compilation issue on 32-bit hosts

 hw/rdma/vmw/pvrdma_cmd.c | 7 +++++++
 1 file changed, 7 insertions(+)
hw/rdma/vmw/pvrdma_cmd.c +7 -0
index f59879e257..da7ddfa548 100644
@@ -38,6 +38,13 @@ static void *pvrdma_map_to_pdir(PCIDevice *pdev, uint64_t pdir_dma,
         return NULL;
     }
 
+    length = ROUND_UP(length, TARGET_PAGE_SIZE);
+    if (nchunks * TARGET_PAGE_SIZE != length) {
+        rdma_error_report("Invalid nchunks/length (%u, %lu)", nchunks,
+                          (unsigned long)length);
+        return NULL;
+    }
+
     dir = rdma_pci_dma_map(pdev, pdir_dma, TARGET_PAGE_SIZE);
     if (!dir) {
         rdma_error_report("Failed to map to page directory");
Signature · 1 line
2.17.2
#2 lore raw

[PULL V2 2/3] pvrdma: Ensure correct input on ring init (CVE-2021-3607)

In reply to Marcel Apfelbaum

Check the guest passed a non zero page count
for pvrdma device ring buffers.

Message-Id: <[email protected]>

---
 hw/rdma/vmw/pvrdma_main.c | 5 +++++
 1 file changed, 5 insertions(+)
hw/rdma/vmw/pvrdma_main.c +5 -0
index 84ae8024fc..7c0c3551a8 100644
@@ -92,6 +92,11 @@ static int init_dev_ring(PvrdmaRing *ring, PvrdmaRingState **ring_state,
     uint64_t *dir, *tbl;
     int rc = 0;
 
+    if (!num_pages) {
+        rdma_error_report("Ring pages count must be strictly positive");
+        return -EINVAL;
+    }
+
     dir = rdma_pci_dma_map(pci_dev, dir_addr, TARGET_PAGE_SIZE);
     if (!dir) {
         rdma_error_report("Failed to map to page directory (ring %s)", name);
Signature · 1 line
2.17.2
#3 lore raw

[PULL V2 3/3] pvrdma: Fix the ring init error flow (CVE-2021-3608)

In reply to Marcel Apfelbaum

Do not unmap uninitialized dma addresses.

Message-Id: <[email protected]>

---
 hw/rdma/vmw/pvrdma_dev_ring.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/rdma/vmw/pvrdma_dev_ring.c +1 -1
index 074ac59b84..42130667a7 100644
@@ -41,7 +41,7 @@ int pvrdma_ring_init(PvrdmaRing *ring, const char *name, PCIDevice *dev,
     qatomic_set(&ring->ring_state->cons_head, 0);
     */
     ring->npages = npages;
-    ring->pages = g_malloc(npages * sizeof(void *));
+    ring->pages = g_malloc0(npages * sizeof(void *));
 
     for (i = 0; i < npages; i++) {
         if (!tbl[i]) {
Signature · 1 line
2.17.2
#4 lore raw
In reply to Marcel Apfelbaum
Quoted 9 lines · Marcel Apfelbaum

The following changes since commit 9c2647f75004c4f7d64c9c0ec55f8c6f0739a8b1:

Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging (2021-07-02 11:46:32 +0100)

are available in the Git repository at:

https://github.com/marcel-apf/qemu tags/pvrdma-04-07-2021-v2

Quoted 9 lines

for you to fetch changes up to 66ae37d8cc313f89272e711174a846a229bcdbd3:

pvrdma: Fix the ring init error flow (CVE-2021-3608) (2021-07-04 22:47:51 +0300)

----------------------------------------------------------------
PVRDMA queue

Several CVE fixes for the PVRDMA device.

Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/6.1
for any user-visible changes.

-- PMM