DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ferruh Yigit <ferruh.yigit@intel.com>
To: dev@dpdk.org
Cc: Ferruh Yigit <ferruh.yigit@intel.com>,
	Marvin Liu <yong.liu@intel.com>,
	stable@dpdk.org, Maxime Coquelin <maxime.coquelin@redhat.com>
Subject: [dpdk-dev] [PATCH 4/6] vhost: fix translated address not checked
Date: Mon, 18 May 2020 14:17:02 +0100	[thread overview]
Message-ID: <20200518131704.715877-5-ferruh.yigit@intel.com> (raw)
In-Reply-To: <20200518131704.715877-1-ferruh.yigit@intel.com>

From: Marvin Liu <yong.liu@intel.com>

Malicious guest can construct desc with invalid address and zero buffer
length. That will request vhost to check both translated address and
translated data length. This patch will add missed address check.

CVE-2020-10725
Fixes: 75ed51697820 ("vhost: add packed ring batch dequeue")
Fixes: ef861692c398 ("vhost: add packed ring batch enqueue")
Cc: stable@dpdk.org

Signed-off-by: Marvin Liu <yong.liu@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---
 lib/librte_vhost/virtio_net.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c
index 1fc30c6819..8504897e7a 100644
--- a/lib/librte_vhost/virtio_net.c
+++ b/lib/librte_vhost/virtio_net.c
@@ -1072,6 +1072,8 @@ virtio_dev_rx_batch_packed(struct virtio_net *dev,
 						  VHOST_ACCESS_RW);
 
 	vhost_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE) {
+		if (unlikely(!desc_addrs[i]))
+			return -1;
 		if (unlikely(lens[i] != descs[avail_idx + i].len))
 			return -1;
 	}
@@ -1827,6 +1829,8 @@ vhost_reserve_avail_batch_packed(struct virtio_net *dev,
 	}
 
 	vhost_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE) {
+		if (unlikely(!desc_addrs[i]))
+			return -1;
 		if (unlikely((lens[i] != descs[avail_idx + i].len)))
 			return -1;
 	}
-- 
2.25.2


  parent reply	other threads:[~2020-05-18 13:17 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-18 13:16 [dpdk-dev] [PATCH 0/6] Fix vhost security issues Ferruh Yigit
2020-05-18 13:16 ` [dpdk-dev] [PATCH 1/6] vhost: check log mmap offset and size overflow Ferruh Yigit
2020-05-18 13:17 ` [dpdk-dev] [PATCH 2/6] vhost: fix vring index check Ferruh Yigit
2020-05-18 13:17 ` [dpdk-dev] [PATCH 3/6] vhost/crypto: validate keys lengths Ferruh Yigit
2020-05-18 13:17 ` Ferruh Yigit [this message]
2020-05-18 13:17 ` [dpdk-dev] [PATCH 5/6] vhost: fix potential memory space leak Ferruh Yigit
2020-05-18 13:17 ` [dpdk-dev] [PATCH 6/6] vhost: fix potential fd leak Ferruh Yigit
2020-05-18 14:18 ` [dpdk-dev] [PATCH 0/6] Fix vhost security issues David Marchand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200518131704.715877-5-ferruh.yigit@intel.com \
    --to=ferruh.yigit@intel.com \
    --cc=dev@dpdk.org \
    --cc=maxime.coquelin@redhat.com \
    --cc=stable@dpdk.org \
    --cc=yong.liu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).