qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Luiz Capitulino <lcapitulino@redhat.com>
Cc: mkletzan@redhat.com, qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH] virtio-balloon: fix integer overflow in BALLOON_CHANGE QMP event
Date: Thu, 18 Apr 2013 13:11:23 -0600	[thread overview]
Message-ID: <5170455B.4050703@redhat.com> (raw)
In-Reply-To: <20130418130552.2d319e91@redhat.com>

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

On 04/18/2013 11:05 AM, Luiz Capitulino wrote:
> Because dev->actual is uint32_t, the expression 'dev->actual <<
> VIRTIO_BALLOON_PFN_SHIFT' is truncated to 32 bits. This overflows when
> dev->actual >= 1048576.
> 
> To reproduce:
> 
>  1. Start a VM with a QMP socket and 5G of RAM
>  2. Connect to the QMP socket, negotiate capabilities and issue:
> 
>    { "execute":"balloon", "arguments": { "value": 1073741824 } }
> 
>  3. What the BALLOON_CHANGE QMP event, the last one will incorretly be:
> 
>    { "timestamp": { "seconds": 1366228965, "microseconds": 245466 },
>      "event": "BALLOON_CHANGE", "data": { "actual": 5368709120 } }
> 
> To fix it this commit casts it to ram_addr_t, which is ram_size's type.
> 
> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
> ---
>  hw/virtio/virtio-balloon.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Eric Blake <eblake@redhat.com>

-- 
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: 621 bytes --]

      reply	other threads:[~2013-04-18 19:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-18 17:05 [Qemu-devel] [PATCH] virtio-balloon: fix integer overflow in BALLOON_CHANGE QMP event Luiz Capitulino
2013-04-18 19:11 ` Eric Blake [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=5170455B.4050703@redhat.com \
    --to=eblake@redhat.com \
    --cc=lcapitulino@redhat.com \
    --cc=mkletzan@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 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).