|
|
902636 |
From a33ea192428d9c9307f1140f3e25631a6ef7657c Mon Sep 17 00:00:00 2001
|
|
|
902636 |
From: Jon Maloy <jmaloy@redhat.com>
|
|
|
902636 |
Date: Sat, 20 Jun 2020 15:02:59 -0400
|
|
|
902636 |
Subject: [PATCH 12/12] Fix use-afte-free in ip_reass() (CVE-2020-1983)
|
|
|
902636 |
MIME-Version: 1.0
|
|
|
902636 |
Content-Type: text/plain; charset=UTF-8
|
|
|
902636 |
Content-Transfer-Encoding: 8bit
|
|
|
902636 |
|
|
|
902636 |
RH-Author: Jon Maloy <jmaloy@redhat.com>
|
|
|
902636 |
Message-id: <20200620150259.3352467-2-jmaloy@redhat.com>
|
|
|
902636 |
Patchwork-id: 97678
|
|
|
902636 |
O-Subject: [RHEL-8.3.0 qemu-kvm PATCH 1/1] Fix use-afte-free in ip_reass() (CVE-2020-1983)
|
|
|
902636 |
Bugzilla: 1838070
|
|
|
902636 |
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
902636 |
|
|
|
902636 |
From: Marc-André Lureau <marcandre.lureau@redhat.com>
|
|
|
902636 |
|
|
|
902636 |
The q pointer is updated when the mbuf data is moved from m_dat to
|
|
|
902636 |
m_ext.
|
|
|
902636 |
|
|
|
902636 |
m_ext buffer may also be realloc()'ed and moved during m_cat():
|
|
|
902636 |
q should also be updated in this case.
|
|
|
902636 |
|
|
|
902636 |
Reported-by: Aviv Sasson <asasson@paloaltonetworks.com>
|
|
|
902636 |
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
|
|
|
902636 |
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
|
|
|
902636 |
|
|
|
902636 |
(cherry picked from libslirp commit 9bd6c5913271eabcb7768a58197ed3301fe19f2d)
|
|
|
902636 |
Signed-off-by: Jon Maloy <jmaloy@redhat.com>
|
|
|
902636 |
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
|
|
902636 |
---
|
|
|
902636 |
slirp/src/ip_input.c | 5 ++---
|
|
|
902636 |
1 file changed, 2 insertions(+), 3 deletions(-)
|
|
|
902636 |
|
|
|
902636 |
diff --git a/slirp/src/ip_input.c b/slirp/src/ip_input.c
|
|
|
902636 |
index df1c846ade..0f5d522ec1 100644
|
|
|
902636 |
--- a/slirp/src/ip_input.c
|
|
|
902636 |
+++ b/slirp/src/ip_input.c
|
|
|
902636 |
@@ -329,7 +329,7 @@ insert:
|
|
|
902636 |
q = fp->frag_link.next;
|
|
|
902636 |
m = dtom(slirp, q);
|
|
|
902636 |
|
|
|
902636 |
- int was_ext = m->m_flags & M_EXT;
|
|
|
902636 |
+ int delta = (char *)q - (m->m_flags & M_EXT ? m->m_ext : m->m_dat);
|
|
|
902636 |
|
|
|
902636 |
q = (struct ipasfrag *)q->ipf_next;
|
|
|
902636 |
while (q != (struct ipasfrag *)&fp->frag_link) {
|
|
|
902636 |
@@ -353,8 +353,7 @@ insert:
|
|
|
902636 |
* the old buffer (in the mbuf), so we must point ip
|
|
|
902636 |
* into the new buffer.
|
|
|
902636 |
*/
|
|
|
902636 |
- if (!was_ext && m->m_flags & M_EXT) {
|
|
|
902636 |
- int delta = (char *)q - m->m_dat;
|
|
|
902636 |
+ if (m->m_flags & M_EXT) {
|
|
|
902636 |
q = (struct ipasfrag *)(m->m_ext + delta);
|
|
|
902636 |
}
|
|
|
902636 |
|
|
|
902636 |
--
|
|
|
902636 |
2.27.0
|
|
|
902636 |
|