From: Ferruh Yigit <ferruh.yigit@intel.com>
To: stable@dpdk.org
Cc: Ferruh Yigit <ferruh.yigit@intel.com>,
Maxime Coquelin <maxime.coquelin@redhat.com>,
Ilja Van Sprundel <ivansprundel@ioactive.com>,
Xiaolong Ye <xiaolong.ye@intel.com>
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: <20200518131805.716052-2-ferruh.yigit@intel.com> (raw)
In-Reply-To: <20200518131805.716052-1-ferruh.yigit@intel.com>
From: Maxime Coquelin <maxime.coquelin@redhat.com>
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")
Cc: stable@dpdk.org
This issue has been assigned CVE-2020-10722
Reported-by: Ilja Van Sprundel <ivansprundel@ioactive.com>
Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: Xiaolong Ye <xiaolong.ye@intel.com>
Reviewed-by: Ilja Van Sprundel <ivansprundel@ioactive.com>
---
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) {
VHOST_LOG_CONFIG(ERR,
- "log offset %#"PRIx64" exceeds log size %#"PRIx64"\n",
+ "log offset %#"PRIx64" and log size %#"PRIx64" overflow\n",
off, size);
return RTE_VHOST_MSG_RESULT_ERR;
}
--
2.25.2
next prev parent 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:
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=20200518131805.716052-2-ferruh.yigit@intel.com \
--to=ferruh.yigit@intel.com \
--cc=ivansprundel@ioactive.com \
--cc=maxime.coquelin@redhat.com \
--cc=stable@dpdk.org \
--cc=xiaolong.ye@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).