]> git.ipfire.org Git - thirdparty/qemu.git/commit
hw/virtio/virtio-balloon: zero-initialize the virtio_balloon_config struct
authorPeter Maydell <peter.maydell@linaro.org>
Fri, 18 Jan 2019 18:36:03 +0000 (18:36 +0000)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Tue, 30 Jul 2019 17:31:44 +0000 (12:31 -0500)
commitf0a334345ba5a9102fd55c523d75caa1fd618e06
tree3e1c9f13dd05d060aefc144869d646c170e1c0f2
parentfc6c2bce38ac60ca3da1db97dbb6f0a1c01cbda4
hw/virtio/virtio-balloon: zero-initialize the virtio_balloon_config struct

In virtio_balloon_get_config() we initialize a struct virtio_balloon_config
which we then copy to guest memory. However, the local variable is not
zero initialized. This works OK at the moment because we initialize
all the fields in it; however an upcoming kernel header change will
add some new fields. If we don't zero out the whole struct then we
will start leaking a small amount of the contents of QEMU's stack
to the guest as soon as we update linux-headers/ to a set of headers
that includes the new fields.

Cc: qemu-stable@nongnu.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-id: 20190118183603.24757-1-peter.maydell@linaro.org
(cherry picked from commit 5385a5988c8a55bebdc878c05b96648579b5d6e0)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
hw/virtio/virtio-balloon.c