1. 13 3月, 2019 5 次提交
    • D
      virtio-balloon: Fix possible guest memory corruption with inflates & deflates · b27b3239
      David Gibson 提交于
      This fixes a balloon bug with a nasty consequence - potentially
      corrupting guest memory - but which is extremely unlikely to be
      triggered in practice.
      
      The balloon always works in 4kiB units, but the host could have a
      larger page size on certain platforms.  Since ed48c598 "virtio-balloon:
      Safely handle BALLOON_PAGE_SIZE < host page size" we've handled this
      by accumulating requests to balloon 4kiB subpages until they formed a
      full host page.  Since f6deb6d9 "virtio-balloon: Remove unnecessary
      MADV_WILLNEED on deflate" we essentially ignore deflate requests.
      
      Suppose we have a host with 8kiB pages, and one host page has subpages
      A & B.  If we get this sequence of events -
      	inflate A
      	deflate A
      	inflate B
      - the current logic will discard the whole host page.  That's
      incorrect because the guest has deflated subpage A, and could have
      written important data to it.
      
      This patch fixes the problem by adjusting our state information about
      partially ballooned host pages when deflate requests are received.
      
      Fixes: ed48c598 "virtio-balloon: Safely handle BALLOON_PAGE_SIZE < host page size"
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Message-Id: <20190306030601.21986-3-david@gibson.dropbear.id.au>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      Acked-by: NDavid Hildenbrand <david@redhat.com>
      b27b3239
    • D
      virtio-balloon: Don't mismatch g_malloc()/free (CID 1399146) · 301cf2a8
      David Gibson 提交于
      ed48c598 "virtio-balloon: Safely handle BALLOON_PAGE_SIZE < host
      page size" introduced a new temporary data structure which tracks 4kiB
      chunks which have been inserted into the balloon by the guest but
      don't yet form a full host page which we can discard.
      
      Unfortunately, I had a thinko and allocated that structure with
      g_malloc0() but freed it with a plain free() rather than g_free().
      This corrects the problem.
      
      Fixes: ed48c598Reported-by: NPeter Maydell <peter.maydell@linaro.org>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Message-Id: <20190306030601.21986-2-david@gibson.dropbear.id.au>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      Reviewed-by: NDavid Hildenbrand <david@redhat.com>
      301cf2a8
    • W
      virtio-balloon: fix a use-after-free case · ae440bd1
      Wei Wang 提交于
      The elem could theorically contain both outbuf and inbufs. We move the
      free operation to the end of this function to avoid using elem->in_sg
      while elem has been freed.
      
      Fixes: c13c4153
      ("virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_HINT")
      Reported-by: NPeter Maydell <peter.maydell@linaro.org>
      Signed-off-by: NWei Wang <wei.w.wang@intel.com>
      CC: Michael S. Tsirkin <mst@redhat.com>
      CC: Dr. David Alan Gilbert <dgilbert@redhat.com>
      CC: Juan Quintela <quintela@redhat.com>
      CC: Peter Xu <peterx@redhat.com>
      Message-Id: <1552383280-4122-1-git-send-email-wei.w.wang@intel.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      ae440bd1
    • P
      Merge remote-tracking branch 'remotes/ehabkost/tags/python-next-pull-request' into staging · 9d867123
      Peter Maydell 提交于
      qmp-shell: fix nested json regression
      
      One small bug fix.
      
      # gpg: Signature made Tue 12 Mar 2019 02:16:24 GMT
      # gpg:                using RSA key 2807936F984DC5A6
      # gpg: Good signature from "Eduardo Habkost <ehabkost@redhat.com>" [full]
      # Primary key fingerprint: 5A32 2FD5 ABC4 D3DB ACCF  D1AA 2807 936F 984D C5A6
      
      * remotes/ehabkost/tags/python-next-pull-request:
        qmp-shell: fix nested json regression
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      9d867123
    • P
      Merge remote-tracking branch 'remotes/kraxel/tags/audio-20190312-pull-request' into staging · cfc3fef6
      Peter Maydell 提交于
      audio: introduce -audiodev
      
      # gpg: Signature made Tue 12 Mar 2019 07:12:19 GMT
      # gpg:                using RSA key 4CB6D8EED3E87138
      # gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>" [full]
      # gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>" [full]
      # gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>" [full]
      # Primary key fingerprint: A032 8CFF B93A 17A7 9901  FE7D 4CB6 D8EE D3E8 7138
      
      * remotes/kraxel/tags/audio-20190312-pull-request:
        audio: -audiodev command line option: cleanup
        wavaudio: port to -audiodev config
        spiceaudio: port to -audiodev config
        sdlaudio: port to -audiodev config
        paaudio: port to -audiodev config
        ossaudio: port to -audiodev config
        noaudio: port to -audiodev config
        dsoundaudio: port to -audiodev config
        coreaudio: port to -audiodev config
        alsaaudio: port to -audiodev config
        audio: -audiodev command line option basic implementation
        audio: -audiodev command line option: documentation
        audio: use qapi AudioFormat instead of audfmt_e
        qapi: qapi for audio backends
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      
      # Conflicts:
      #	qemu-deprecated.texi
      cfc3fef6
  2. 12 3月, 2019 35 次提交