qemu-kvm/kvm-tcp_emu-Fix-oob-access.patch
Miroslav Rezanina 4508bb8a0c * Tue Jan 21 2020 Miroslav Rezanina <mrezanin@redhat.com> - 4.2.0-7.el8
- kvm-tcp_emu-Fix-oob-access.patch [bz#1791568]
- kvm-slirp-use-correct-size-while-emulating-IRC-commands.patch [bz#1791568]
- kvm-slirp-use-correct-size-while-emulating-commands.patch [bz#1791568]
- kvm-RHEL-hw-i386-disable-nested-PERF_GLOBAL_CTRL-MSR-sup.patch [bz#1559846]
- Resolves: bz#1559846
  (Nested KVM: limit VMX features according to CPU models - Fast Train)
- Resolves: bz#1791568
  (CVE-2020-7039 qemu-kvm: QEMU: slirp: OOB buffer access while emulating tcp protocols in tcp_emu() [rhel-av-8.2.0])
2020-01-21 15:37:11 +01:00

60 lines
2.2 KiB
Diff

From 5c2c5496083fa549e1dff903413bb6136fc19d8d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= <marcandre.lureau@redhat.com>
Date: Fri, 17 Jan 2020 12:07:56 +0100
Subject: [PATCH 1/4] tcp_emu: Fix oob access
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
RH-Author: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-id: <20200117120758.1076549-2-marcandre.lureau@redhat.com>
Patchwork-id: 93399
O-Subject: [RHEL-AV-8.1.0 qemu-kvm + RHEL-AV-8.2.0 qemu-kvm PATCH 1/3] tcp_emu: Fix oob access
Bugzilla: 1791568
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
From: Samuel Thibault <samuel.thibault@ens-lyon.org>
The main loop only checks for one available byte, while we sometimes
need two bytes.
[ MA - minor conflict, CHANGELOG.md absent ]
(cherry picked from libslirp commit 2655fffed7a9e765bcb4701dd876e9dab975f289)
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
---
slirp/src/tcp_subr.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/slirp/src/tcp_subr.c b/slirp/src/tcp_subr.c
index d6dd133..cbecd64 100644
--- a/slirp/src/tcp_subr.c
+++ b/slirp/src/tcp_subr.c
@@ -886,6 +886,9 @@ int tcp_emu(struct socket *so, struct mbuf *m)
break;
case 5:
+ if (bptr == m->m_data + m->m_len - 1)
+ return 1; /* We need two bytes */
+
/*
* The difference between versions 1.0 and
* 2.0 is here. For future versions of
@@ -901,6 +904,10 @@ int tcp_emu(struct socket *so, struct mbuf *m)
/* This is the field containing the port
* number that RA-player is listening to.
*/
+
+ if (bptr == m->m_data + m->m_len - 1)
+ return 1; /* We need two bytes */
+
lport = (((uint8_t *)bptr)[0] << 8) + ((uint8_t *)bptr)[1];
if (lport < 6970)
lport += 256; /* don't know why */
--
1.8.3.1