Skip to contentSkip to conversation

hw/pvrdma: Protect against buggy or malicious guest driver

PATCH Applied Yuval Shaia 6 participants 10 messages Apr 3, 2022 – May 15, 2023 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 hw/pvrdma: Protect against buggy or malicious guest driver

Guest driver might execute HW commands when shared buffers are not yet allocated.
This could happen on purpose (malicious guest) or because of some other guest/host address mapping error.
We need to protect againts such case.

Fixes CVE-2022-1050

---
v1 -> v2:
* Commit message changes
v2 -> v3:
* Exclude cosmetic changes

---
 hw/rdma/vmw/pvrdma_cmd.c | 6 ++++++
 1 file changed, 6 insertions(+)
hw/rdma/vmw/pvrdma_cmd.c +6 -0
index da7ddfa548..89db963c46 100644
@@ -796,6 +796,12 @@ int pvrdma_exec_cmd(PVRDMADev *dev)
 
     dsr_info = &dev->dsr_info;
 
+    if (!dsr_info->dsr) {
+            /* Buggy or malicious guest driver */
+            rdma_error_report("Exec command without dsr, req or rsp buffers");
+            goto out;
+    }
+
     if (dsr_info->req->hdr.cmd >= sizeof(cmd_handlers) /
                       sizeof(struct cmd_handler)) {
         rdma_error_report("Unsupported command");
Signature · 1 line
2.20.1
#1 lore raw

Hi Yuval,
Thank you for the changes.

Quoted 38 lines · Yuval Shaia

Guest driver might execute HW commands when shared buffers are not yet allocated.
This could happen on purpose (malicious guest) or because of some other guest/host address mapping error.
We need to protect againts such case.

Fixes CVE-2022-1050

---
v1 -> v2:
* Commit message changes
v2 -> v3:
* Exclude cosmetic changes

---
 hw/rdma/vmw/pvrdma_cmd.c | 6 ++++++
 1 file changed, 6 insertions(+)
hw/rdma/vmw/pvrdma_cmd.c +6 -1
index da7ddfa548..89db963c46 100644
@@ -796,6 +796,12 @@ int pvrdma_exec_cmd(PVRDMADev *dev)
 
     dsr_info = &dev->dsr_info;
 
+    if (!dsr_info->dsr) {
+            /* Buggy or malicious guest driver */
+            rdma_error_report("Exec command without dsr, req or rsp buffers");
+            goto out;
+    }
+
     if (dsr_info->req->hdr.cmd >= sizeof(cmd_handlers) /
                       sizeof(struct cmd_handler)) {
         rdma_error_report("Unsupported command");
--
Quoted 2 lines

2.20.1

cc-ing Peter and Philippe for a question:
Do we have a "Security Fixes" or a "Misc" subtree? Otherwise it will have to wait a week or so.

Reviewed by: Marcel Apfelbaum <[email protected]> Thanks,
Marcel

#2 lore raw
Quoted 49 lines · Marcel Apfelbaum

Hi Yuval,
Thank you for the changes.

Quoted 38 lines · Yuval Shaia

Guest driver might execute HW commands when shared buffers are not yet allocated.
This could happen on purpose (malicious guest) or because of some other guest/host address mapping error.
We need to protect againts such case.

Fixes CVE-2022-1050

---
v1 -> v2:
* Commit message changes
v2 -> v3:
* Exclude cosmetic changes

---
 hw/rdma/vmw/pvrdma_cmd.c | 6 ++++++
 1 file changed, 6 insertions(+)
hw/rdma/vmw/pvrdma_cmd.c +6 -1
index da7ddfa548..89db963c46 100644
@@ -796,6 +796,12 @@ int pvrdma_exec_cmd(PVRDMADev *dev)
 
     dsr_info = &dev->dsr_info;
 
+    if (!dsr_info->dsr) {
+            /* Buggy or malicious guest driver */
+            rdma_error_report("Exec command without dsr, req or rsp buffers");
+            goto out;
+    }
+
     if (dsr_info->req->hdr.cmd >= sizeof(cmd_handlers) /
                       sizeof(struct cmd_handler)) {
         rdma_error_report("Unsupported command");
--
Quoted 2 lines

2.20.1

cc-ing Peter and Philippe for a question:
Do we have a "Security Fixes" or a "Misc" subtree? Otherwise it will have to wait a week or so.

Quoted 4 lines

Reviewed by: Marcel Apfelbaum <[email protected]> Thanks,
Marcel

Hi all,

patch is reviewed, anything holding back the inclusion of this security fix?

Thanks,

Claudio

#3 lore raw

Can anyone else pick this one?

Thanks,
Yuval

Quoted 66 lines · Claudio Fontana
Quoted 4 lines · Marcel Apfelbaum

Hi Yuval,
Thank you for the changes.

On Sun, Apr 3, 2022 at 11:54 AM Yuval Shaia <[email protected]>

Quoted 26 lines · wrote:
Quoted 26 lines

Guest driver might execute HW commands when shared buffers are not yet allocated.
This could happen on purpose (malicious guest) or because of some other guest/host address mapping error.
We need to protect againts such case.

Fixes CVE-2022-1050

---
v1 -> v2:
* Commit message changes
v2 -> v3:
* Exclude cosmetic changes

---
 hw/rdma/vmw/pvrdma_cmd.c | 6 ++++++
 1 file changed, 6 insertions(+)
hw/rdma/vmw/pvrdma_cmd.c +0 -0
index da7ddfa548..89db963c46 100644
@@ -796,6 +796,12 @@ int pvrdma_exec_cmd(PVRDMADev *dev)
 
Quoted 5 lines

hw/rdma/vmw/pvrdma_cmd.c int pvrdma_exec_cmd(PVRDMADev *dev)

Quoted 5 lines
hw/rdma/vmw/pvrdma_cmd.c +3 -0
     dsr_info = &dev->dsr_info;
 
+    if (!dsr_info->dsr) {
+            /* Buggy or malicious guest driver */
+            rdma_error_report("Exec command without dsr, req or rsp

buffers");

Quoted 10 lines
Quoted 9 lines
hw/rdma/vmw/pvrdma_cmd.c +3 -1
+            goto out;
+    }
+
     if (dsr_info->req->hdr.cmd >= sizeof(cmd_handlers) /
                       sizeof(struct cmd_handler)) {
         rdma_error_report("Unsupported command");
--

2.20.1

Quoted 8 lines

cc-ing Peter and Philippe for a question:
Do we have a "Security Fixes" or a "Misc" subtree? Otherwise it will have to wait a week or so.

Reviewed by: Marcel Apfelbaum <[email protected]> Thanks,
Marcel

Hi all,

patch is reviewed, anything holding back the inclusion of this security fix?

Thanks,

Claudio

#4 lore raw
Quoted 2 lines · Yuval Shaia

Can anyone else pick this one?

Adding Thomas,

I dropped the ball with this one, I am sorry about that, maybe it doesn't worth a Pull Request only for it.

Maybe it can go through the Misc tree?

Thank you,
Marcel

Quoted 68 lines

Thanks,
Yuval

Quoted 63 lines · Claudio Fontana
Quoted 49 lines · Marcel Apfelbaum

Hi Yuval,
Thank you for the changes.

Quoted 38 lines · Yuval Shaia

Guest driver might execute HW commands when shared buffers are not yet allocated.
This could happen on purpose (malicious guest) or because of some other guest/host address mapping error.
We need to protect againts such case.

Fixes CVE-2022-1050

---
v1 -> v2:
* Commit message changes
v2 -> v3:
* Exclude cosmetic changes

---
 hw/rdma/vmw/pvrdma_cmd.c | 6 ++++++
 1 file changed, 6 insertions(+)
hw/rdma/vmw/pvrdma_cmd.c +6 -1
index da7ddfa548..89db963c46 100644
@@ -796,6 +796,12 @@ int pvrdma_exec_cmd(PVRDMADev *dev)
 
     dsr_info = &dev->dsr_info;
 
+    if (!dsr_info->dsr) {
+            /* Buggy or malicious guest driver */
+            rdma_error_report("Exec command without dsr, req or rsp buffers");
+            goto out;
+    }
+
     if (dsr_info->req->hdr.cmd >= sizeof(cmd_handlers) /
                       sizeof(struct cmd_handler)) {
         rdma_error_report("Unsupported command");
--
Quoted 2 lines

2.20.1

cc-ing Peter and Philippe for a question:
Do we have a "Security Fixes" or a "Misc" subtree? Otherwise it will have to wait a week or so.

Quoted 4 lines

Reviewed by: Marcel Apfelbaum <[email protected]> Thanks,
Marcel

Hi all,

patch is reviewed, anything holding back the inclusion of this security fix?

Thanks,

Claudio

#5 lore raw
Quoted 8 lines · Marcel Apfelbaum
Quoted 2 lines · Yuval Shaia

Can anyone else pick this one?

Adding Thomas,

I dropped the ball with this one, I am sorry about that, maybe it doesn't worth a Pull Request only for it.

Why not? Pull request for single patches aren't that uncommon.

Quoted 1 line

Maybe it can go through the Misc tree?

hw/rdma/ is really not my turf, but since the patch is small, it sounds like a good candidate for qemu-trivial, I think.

Thomas

Quoted 65 lines
Quoted 64 lines · Claudio Fontana
Quoted 63 lines · Marcel Apfelbaum
Quoted 49 lines

Hi Yuval,
Thank you for the changes.

Quoted 38 lines · Yuval Shaia

Guest driver might execute HW commands when shared buffers are not yet allocated.
This could happen on purpose (malicious guest) or because of some other guest/host address mapping error.
We need to protect againts such case.

Fixes CVE-2022-1050

---
v1 -> v2:
* Commit message changes
v2 -> v3:
* Exclude cosmetic changes

---
  hw/rdma/vmw/pvrdma_cmd.c | 6 ++++++
  1 file changed, 6 insertions(+)
hw/rdma/vmw/pvrdma_cmd.c +6 -1
index da7ddfa548..89db963c46 100644
@@ -796,6 +796,12 @@ int pvrdma_exec_cmd(PVRDMADev *dev)
 
      dsr_info = &dev->dsr_info;
 
+    if (!dsr_info->dsr) {
+            /* Buggy or malicious guest driver */
+            rdma_error_report("Exec command without dsr, req or rsp buffers");
+            goto out;
+    }
+
      if (dsr_info->req->hdr.cmd >= sizeof(cmd_handlers) /
                        sizeof(struct cmd_handler)) {
          rdma_error_report("Unsupported command");
--
Quoted 2 lines

2.20.1

cc-ing Peter and Philippe for a question:
Do we have a "Security Fixes" or a "Misc" subtree? Otherwise it will have to wait a week or so.

Quoted 4 lines

Reviewed by: Marcel Apfelbaum <[email protected]> Thanks,
Marcel

Hi all,

patch is reviewed, anything holding back the inclusion of this security fix?

Thanks,

Claudio

#6 lore raw

Le 28/12/2022 à 20:32, Thomas Huth a écrit :

Quoted 7 lines · Marcel Apfelbaum
Quoted 6 lines · Yuval Shaia
Quoted 2 lines

Can anyone else pick this one?

Adding Thomas,

Quoted 8 lines
Quoted 2 lines

I dropped the ball with this one, I am sorry about that, maybe it doesn't worth a Pull Request only for it.

Why not? Pull request for single patches aren't that uncommon.

Quoted 1 line

Maybe it can go through the Misc tree?

hw/rdma/ is really not my turf, but since the patch is small, it sounds like a good candidate for qemu-trivial, I think.

Applied to my trivial-patches branch.

Thanks,
Laurent

Quoted 71 lines

 Thomas

Quoted 65 lines
Quoted 64 lines · Claudio Fontana
Quoted 63 lines · Marcel Apfelbaum
Quoted 49 lines

Hi Yuval,
Thank you for the changes.

Quoted 34 lines · Yuval Shaia

Guest driver might execute HW commands when shared buffers are not yet allocated.
This could happen on purpose (malicious guest) or because of some other guest/host address mapping error.
We need to protect againts such case.

Fixes CVE-2022-1050

---
v1 -> v2:
         * Commit message changes
v2 -> v3:
         * Exclude cosmetic changes
---
  hw/rdma/vmw/pvrdma_cmd.c | 6 ++++++

  1 file changed, 6 insertions(+)
hw/rdma/vmw/pvrdma_cmd.c +6 -0
index da7ddfa548..89db963c46 100644
@@ -796,6 +796,12 @@ int pvrdma_exec_cmd(PVRDMADev *dev)
 
       dsr_info = &dev->dsr_info;
 
+    if (!dsr_info->dsr) {
+            /* Buggy or malicious guest driver */
+            rdma_error_report("Exec command without dsr, req or rsp buffers");
+            goto out;
+    }
+
Quoted 6 lines

      if (dsr_info->req->hdr.cmd >= sizeof(cmd_handlers) / sizeof(struct cmd_handler)) { rdma_error_report("Unsupported command");

Signature · 1 line
2.20.1

cc-ing Peter and Philippe for a question:
Do we have a "Security Fixes" or a "Misc" subtree? Otherwise it will have to wait a week or so.

Quoted 4 lines

Reviewed by: Marcel Apfelbaum <[email protected]> Thanks,
Marcel

Hi all,

patch is reviewed, anything holding back the inclusion of this security fix?

Thanks,

Claudio

#7 lore raw
Quoted 11 lines · Laurent Vivier

Le 28/12/2022 à 20:32, Thomas Huth a écrit :

Quoted 10 lines · Marcel Apfelbaum
Quoted 8 lines · Yuval Shaia
Quoted 2 lines

Can anyone else pick this one?

Adding Thomas,

I dropped the ball with this one, I am sorry about that, maybe it doesn't worth a Pull Request only for it.

Quoted 7 lines
Quoted 5 lines

Why not? Pull request for single patches aren't that uncommon.

Quoted 1 line

Maybe it can go through the Misc tree?

hw/rdma/ is really not my turf, but since the patch is small, it sounds like a good candidate for qemu-trivial, I think.

Applied to my trivial-patches branch.

Has it been forgotten again? :)

/mjt

A message that is not in the archive (sent off-list or not yet received): [email protected]

#9 lore raw

15.05.2023 19:08, Michael Tokarev пишет:

Quoted 14 lines
Quoted 13 lines · Laurent Vivier

Le 28/12/2022 à 20:32, Thomas Huth a écrit :

Quoted 12 lines · Marcel Apfelbaum
Quoted 8 lines · Yuval Shaia
Quoted 2 lines

Can anyone else pick this one?

Adding Thomas,

I dropped the ball with this one, I am sorry about that, maybe it doesn't worth a Pull Request only for it.

Why not? Pull request for single patches aren't that uncommon.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Maybe it can go through the Misc tree?

hw/rdma/ is really not my turf, but since the patch is small, it sounds like a good candidate for qemu-trivial, I think.

Applied to my trivial-patches branch.

Has it been forgotten again? :)

Ah nope. There are 2 patches with the same subject, always confusing. This one is applied.

/mjt

#10 lore raw
In reply to Yuval Shaia

Ping? This is from April this year, half a year ago. Can this be applied or?

Marcel said it should wait a week or two, I think that's been done already.. ;)

Thanks,

/mjt

Quoted 36 lines · Yuval Shaia

Guest driver might execute HW commands when shared buffers are not yet allocated.
This could happen on purpose (malicious guest) or because of some other guest/host address mapping error.
We need to protect againts such case.

Fixes CVE-2022-1050

---
v1 -> v2:
* Commit message changes
v2 -> v3:
* Exclude cosmetic changes

---
  hw/rdma/vmw/pvrdma_cmd.c | 6 ++++++
  1 file changed, 6 insertions(+)
hw/rdma/vmw/pvrdma_cmd.c +6 -0
index da7ddfa548..89db963c46 100644
@@ -796,6 +796,12 @@ int pvrdma_exec_cmd(PVRDMADev *dev)
 
      dsr_info = &dev->dsr_info;
 
+    if (!dsr_info->dsr) {
+            /* Buggy or malicious guest driver */
+            rdma_error_report("Exec command without dsr, req or rsp buffers");
+            goto out;
+    }
+
      if (dsr_info->req->hdr.cmd >= sizeof(cmd_handlers) /
                        sizeof(struct cmd_handler)) {
          rdma_error_report("Unsupported command");