qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: slirp@lists.freedesktop.org
Cc: "Philippe Mathieu-Daudé" <philmd@redhat.com>,
	qemu-stable@nongnu.org, "Petr Matousek" <pmatouse@redhat.com>,
	qemu-devel@nongnu.org, "Prasad J Pandit" <ppandit@redhat.com>
Subject: [Qemu-devel] [RFC PATCH 2/2] Delay crash when mbufs are corrupted
Date: Thu, 22 Aug 2019 16:41:34 +0200	[thread overview]
Message-ID: <20190822144134.23521-3-philmd@redhat.com> (raw)
In-Reply-To: <20190822144134.23521-1-philmd@redhat.com>

If the mbufs linked list is corrupted, give the application
a chance to properly shutdown itself without causing dataloss.

For now, this means slowly leaking the heap.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 src/ip_input.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/ip_input.c b/src/ip_input.c
index ee52085..36962b5 100644
--- a/src/ip_input.c
+++ b/src/ip_input.c
@@ -185,6 +185,15 @@ void ip_input(struct mbuf *m)
             if (ip == NULL)
                 return;
             m = dtom(slirp, ip);
+            if (m == NULL) {
+                /* The mbufs linked list is corrupted, we
+                 * should properly shutdown the application.
+                 * We prefer to leak a mbuf on the heap
+                 * rather than allowing null dereference
+                 * and eventual crash (data corruption).
+                 */
+                return; /* TODO warn the library consumer! */
+            }
         } else if (fp)
             ip_freef(slirp, fp);
 
-- 
2.20.1



      parent reply	other threads:[~2019-08-22 14:43 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-22 14:41 [Qemu-devel] [PATCH 0/2] slirp: Fix heap buffer overflow during packet reassembly (CVE-2019-14378) Philippe Mathieu-Daudé
2019-08-22 14:41 ` [Qemu-devel] [PATCH 1/2] Do not reassemble fragments pointing outside of the original payload Philippe Mathieu-Daudé
2019-08-22 18:33   ` [Qemu-devel] [Slirp] " Samuel Thibault
2019-08-23 15:15     ` Philippe Mathieu-Daudé
2019-08-25 22:54       ` Samuel Thibault
2019-08-29 11:13         ` P J P
2019-08-29 15:43         ` Philippe Mathieu-Daudé
2019-08-29 15:53           ` Philippe Mathieu-Daudé
2019-08-29 16:00             ` Philippe Mathieu-Daudé
2019-08-22 14:41 ` Philippe Mathieu-Daudé [this message]

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=20190822144134.23521-3-philmd@redhat.com \
    --to=philmd@redhat.com \
    --cc=pmatouse@redhat.com \
    --cc=ppandit@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-stable@nongnu.org \
    --cc=slirp@lists.freedesktop.org \
    /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).