patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Ferruh Yigit <>
Cc: Ferruh Yigit <>,
	Maxime Coquelin <>,
	Ilja Van Sprundel <>,
	Xiaolong Ye <>
Subject: [dpdk-stable] [PATCH v20.02 1/6] vhost: check log mmap offset and size overflow
Date: Mon, 18 May 2020 14:18:00 +0100	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

From: Maxime Coquelin <>

vhost_user_set_log_base() is a message handler that is
called to handle the VHOST_USER_SET_LOG_BASE message.
Its payload contains a 64 bit size and offset. Both are
added up and used as a size when calling mmap().

There is no integer overflow check. If an integer overflow
occurs a smaller memory map would be created than
requested. Since the returned mapping is mapped as writable
and used for logging, a memory corruption could occur.

Fixes: fbc4d248b198 ("vhost: fix offset while mmaping log base address")

This issue has been assigned CVE-2020-10722

Reported-by: Ilja Van Sprundel <>
Signed-off-by: Maxime Coquelin <>
Reviewed-by: Xiaolong Ye <>
Reviewed-by: Ilja Van Sprundel <>
 lib/librte_vhost/vhost_user.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c
index bd1be01040..1eea371fc8 100644
--- a/lib/librte_vhost/vhost_user.c
+++ b/lib/librte_vhost/vhost_user.c
@@ -2059,10 +2059,10 @@ vhost_user_set_log_base(struct virtio_net **pdev, struct VhostUserMsg *msg,
 	size = msg->payload.log.mmap_size;
 	off  = msg->payload.log.mmap_offset;
-	/* Don't allow mmap_offset to point outside the mmap region */
-	if (off > size) {
+	/* Check for mmap size and offset overflow. */
+	if (off >= -size) {
-			"log offset %#"PRIx64" exceeds log size %#"PRIx64"\n",
+			"log offset %#"PRIx64" and log size %#"PRIx64" overflow\n",
 			off, size);

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

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-18 13:17 [dpdk-stable] [PATCH v20.02 0/6] Fix vhost security issues Ferruh Yigit
2020-05-18 13:18 ` Ferruh Yigit [this message]
2020-05-18 13:18 ` [dpdk-stable] [PATCH v20.02 2/6] vhost: fix vring index check Ferruh Yigit
2020-05-18 13:18 ` [dpdk-stable] [PATCH v20.02 3/6] vhost/crypto: validate keys lengths Ferruh Yigit
2020-05-18 13:18 ` [dpdk-stable] [PATCH v20.02 4/6] vhost: fix translated address not checked Ferruh Yigit
2020-05-18 13:18 ` [dpdk-stable] [PATCH v20.02 5/6] vhost: fix potential memory space leak Ferruh Yigit
2020-05-18 13:18 ` [dpdk-stable] [PATCH v20.02 6/6] vhost: fix potential fd leak Ferruh Yigit

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:

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

  git send-email \ \ \ \ \ \ \

* 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).