All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: "Daniel P. Berrange" <berrange@redhat.com>,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>
Cc: mdroth@linux.vnet.ibm.com, armbru@redhat.com,
	qemu-devel@nongnu.org, anderson@redhat.com, pbonzini@redhat.com,
	lersek@redhat.com
Subject: Re: [Qemu-devel] [PATCH 17/21] virtio-channel: parse qga stream for VMDUMP_INFO event
Date: Wed, 5 Apr 2017 12:06:56 -0500	[thread overview]
Message-ID: <2f015621-19aa-d70b-6103-fef6514fcd7e@redhat.com> (raw)
In-Reply-To: <20170405161256.GA25291@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1332 bytes --]

On 04/05/2017 11:12 AM, Daniel P. Berrange wrote:
> On Sat, Mar 11, 2017 at 05:22:52PM +0400, Marc-André Lureau wrote:
>> On virtio channel "org.qemu.guest_agent.0", parse the json stream until
>> the VMDUMP_INFO is received and retrieve the dump details.
>>

> 
> so we just continually feed data into the json parser until we see the
> event we care about....
> 
> What kind of denial of service protection does our JSON parser have. Now
> that QEMU is directly parsing JSON from QEMU guest agent, it is exposed
> to malicious attack by the guest agent.

Our JSON parser rejects input that exceeds various limits:

json-lexer.c:
#define MAX_TOKEN_SIZE (64ULL << 20)

json-streamer.c:
#define MAX_TOKEN_SIZE (64ULL << 20)
#define MAX_TOKEN_COUNT (2ULL << 20)
#define MAX_NESTING (1ULL << 10)

> 
> eg what happens if the 'vmcoreinfo' string in the JSON doc received from
> the guest ends up being 10GB in size ? Is that going to cause our JSON
> parser to allocate QString which is 10GB in size which we'll further
> try to strdup just below too...

The parser will have rejected the guest data long before the 10GB mark.
But our error recovery from that rejection may not be ideal...


-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

  parent reply	other threads:[~2017-04-05 17:07 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-11 13:22 [Qemu-devel] [PATCH 00/21] WIP: dump: add kaslr support (for after 2.9) Marc-André Lureau
2017-03-11 13:22 ` [Qemu-devel] [PATCH 01/21] qapi: add info comment for generated types Marc-André Lureau
2017-03-13  7:01   ` Markus Armbruster
2017-03-11 13:22 ` [Qemu-devel] [PATCH 02/21] pci-host: use more specific type names Marc-André Lureau
2017-03-11 13:22 ` [Qemu-devel] [PATCH 03/21] object: fix potential leak in getters Marc-André Lureau
2017-03-21 14:43   ` Eric Blake
2017-04-23 17:16   ` Michael Tokarev
2017-03-11 13:22 ` [Qemu-devel] [PATCH 04/21] qobject: add quint type Marc-André Lureau
2017-03-11 20:17   ` Eric Blake
2017-03-13  7:15     ` Markus Armbruster
2017-03-13 13:21       ` Eric Blake
2017-03-13 13:28         ` Marc-André Lureau
2017-03-21 12:41           ` Marc-André Lureau
2017-03-21 16:49             ` Markus Armbruster
2017-03-21 17:06               ` Eric Blake
2017-03-21 17:46                 ` Marc-André Lureau
2017-03-11 13:22 ` [Qemu-devel] [PATCH 05/21] qapi: update the qobject visitor to use QUInt Marc-André Lureau
2017-03-11 13:22 ` [Qemu-devel] [PATCH 06/21] json: learn to parse uint64 numbers Marc-André Lureau
2017-03-11 13:22 ` [Qemu-devel] [PATCH 07/21] object: add uint property setter/getter Marc-André Lureau
2017-03-11 13:22 ` [Qemu-devel] [PATCH 08/21] qdev: use int and uint properties Marc-André Lureau
2017-03-11 13:22 ` [Qemu-devel] [PATCH 09/21] qdev: use appropriate type Marc-André Lureau
2017-03-11 13:22 ` [Qemu-devel] [PATCH 10/21] Use uint property getter/setter where appropriate Marc-André Lureau
2017-03-11 13:22 ` [Qemu-devel] [PATCH 11/21] qdict: learn to lookup quint Marc-André Lureau
2017-03-11 13:22 ` [Qemu-devel] [PATCH 12/21] test-qga: drop everything until guest-sync Marc-André Lureau
2017-03-11 20:07   ` Eric Blake
2017-03-11 13:22 ` [Qemu-devel] [PATCH 13/21] qga: report error on keyfile dump error Marc-André Lureau
2017-03-11 13:22 ` [Qemu-devel] [PATCH 14/21] qga: add and populate VMDumpInfo Marc-André Lureau
2017-03-11 13:22 ` [Qemu-devel] [PATCH 15/21] qga: register event emit function Marc-André Lureau
2017-03-11 13:22 ` [Qemu-devel] [PATCH 16/21] qga: emit VMDUMP_INFO event Marc-André Lureau
2017-03-11 13:22 ` [Qemu-devel] [PATCH 17/21] virtio-channel: parse qga stream for " Marc-André Lureau
2017-04-05 16:12   ` Daniel P. Berrange
     [not found]     ` <CAJ+F1C+2x=0pZxMz8FgxbkQD59zM2pngHKv7AT-hv-KA6xjN+Q@mail.gmail.com>
2017-04-05 16:38       ` Marc-André Lureau
2017-04-05 17:06     ` Eric Blake [this message]
2017-04-05 17:39       ` Daniel P. Berrange
2017-03-11 13:22 ` [Qemu-devel] [PATCH 18/21] dump: use qga VMDUMP_INFO for ELF dump Marc-André Lureau
2017-03-11 13:22 ` [Qemu-devel] [PATCH 19/21] kdump: write vmcoreinfo in header Marc-André Lureau
2017-03-11 13:22 ` [Qemu-devel] [PATCH 20/21] scripts/dump-guest-memory.py: fix int128_get64 on recent gcc Marc-André Lureau
2017-03-11 13:22 ` [Qemu-devel] [PATCH 21/21] scripts/dump-guest-memory.py: add VMCOREINFO Marc-André Lureau
2017-03-11 13:47 ` [Qemu-devel] [PATCH 00/21] WIP: dump: add kaslr support (for after 2.9) no-reply
2017-03-11 14:31 ` Dave Anderson
2017-04-05 16:01   ` Paolo Bonzini

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=2f015621-19aa-d70b-6103-fef6514fcd7e@redhat.com \
    --to=eblake@redhat.com \
    --cc=anderson@redhat.com \
    --cc=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=lersek@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=mdroth@linux.vnet.ibm.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.