1. 03 11月, 2016 14 次提交
    • F
      iothread: Stop threads before main() quits · 316c2c94
      Fam Zheng 提交于
      Right after main_loop ends, we release various things but keep iothread
      alive. The latter is not prepared to the sudden change of resources.
      
      Specifically, after bdrv_close_all(), virtio-scsi dataplane get a
      surprise at the empty BlockBackend:
      
      (gdb) bt
          at /usr/src/debug/qemu-2.6.0/hw/scsi/virtio-scsi.c:543
          at /usr/src/debug/qemu-2.6.0/hw/scsi/virtio-scsi.c:577
      
      It is because the d->conf.blk->root is set to NULL, then
      blk_get_aio_context() returns qemu_aio_context, whereas s->ctx is still
      pointing to the iothread:
      
          hw/scsi/virtio-scsi.c:543:
      
          if (s->dataplane_started) {
              assert(blk_get_aio_context(d->conf.blk) == s->ctx);
          }
      
      To fix this, let's stop iothreads before doing bdrv_close_all().
      
      Cc: qemu-stable@nongnu.org
      Signed-off-by: NFam Zheng <famz@redhat.com>
      Reviewed-by: NPaolo Bonzini <pbonzini@redhat.com>
      Message-id: 1473326931-9699-1-git-send-email-famz@redhat.com
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      (cherry picked from commit dce8921b)
      Signed-off-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      316c2c94
    • D
      crypto: ensure XTS is only used with ciphers with 16 byte blocks · 98b4465f
      Daniel P. Berrange 提交于
      The XTS cipher mode needs to be used with a cipher which has
      a block size of 16 bytes. If a mis-matching block size is used,
      the code will either corrupt memory beyond the IV array, or
      not fully encrypt/decrypt the IV.
      
      This fixes a memory corruption crash when attempting to use
      cast5-128 with xts, since the former has an 8 byte block size.
      
      A test case is added to ensure the cipher creation fails with
      such an invalid combination.
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      (cherry picked from commit a5d2f44d)
      Signed-off-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      98b4465f
    • P
      scsi: mptconfig: fix misuse of MPTSAS_CONFIG_PACK · 8342e124
      Paolo Bonzini 提交于
      These issues cause respectively a QEMU crash and a leak of 2 bytes of
      stack.  They were discovered by VictorV of 360 Marvel Team.
      Reported-by: NTom Victor <i-tangtianwen@360.cm>
      Cc: qemu-stable@nongnu.org
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      (cherry picked from commit 65a8e1f6)
      Signed-off-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      8342e124
    • P
      scsi: mptconfig: fix an assert expression · 0b6ab253
      Prasad J Pandit 提交于
      When LSI SAS1068 Host Bus emulator builds configuration page
      headers, mptsas_config_pack() should assert that the size
      fits in a byte.  However, the size is expressed in 32-bit
      units, so up to 1020 bytes fit.  The assertion was only
      allowing replies up to 252 bytes, so fix it.
      Suggested-by: NPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NPrasad J Pandit <pjp@fedoraproject.org>
      Message-Id: <1472645167-30765-2-git-send-email-ppandit@redhat.com>
      Cc: qemu-stable@nongnu.org
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      (cherry picked from commit cf2bce20)
      Signed-off-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      0b6ab253
    • P
      vmw_pvscsi: check page count while initialising descriptor rings · 74288657
      Prasad J Pandit 提交于
      Vmware Paravirtual SCSI emulation uses command descriptors to
      process SCSI commands. These descriptors come with their ring
      buffers. A guest could set the page count for these rings to
      an arbitrary value, leading to infinite loop or OOB access.
      Add check to avoid it.
      Reported-by: NTom Victor <vv474172261@gmail.com>
      Signed-off-by: NPrasad J Pandit <pjp@fedoraproject.org>
      Message-Id: <1472626169-12989-1-git-send-email-ppandit@redhat.com>
      Cc: qemu-stable@nongnu.org
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      (cherry picked from commit 7f61f469)
      Signed-off-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      74288657
    • R
      scsi-disk: change disk serial length from 20 to 36 · 2f8e8c73
      Rony Weng 提交于
      Openstack Cinder assigns volume a 36 characters uuid as serial.
      QEMU will shrinks the uuid to 20 characters, which does not match
      the original uuid.
      
      Note that there is no limit to the length of the serial number in
      the SCSI spec.  20 was copy-pasted from virtio-blk which in turn was
      copy-pasted from ATA; 36 is even more arbitrary.  However, bumping it
      up too much might cause issues (e.g. 252 seems to make sense because
      then the maximum amount of returned data is 256; but who knows there's
      no off-by-one somewhere for such a nicely rounded number).
      Signed-off-by: NRony Weng <ronyweng@synology.com>
      Message-Id: <1472457138-23386-1-git-send-email-ronyweng@synology.com>
      Cc: qemu-stable@nongnu.org
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      (cherry picked from commit 48b62063)
      Signed-off-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      2f8e8c73
    • L
      qemu-char: avoid segfault if user lacks of permisson of a given logfile · 069e885d
      Lin Ma 提交于
      Function qemu_chr_alloc returns NULL if it failed to open logfile by any reason,
      says no write permission. For backends tty, stdio and msmouse, They need to
      check this return value to avoid segfault in this case.
      Signed-off-by: NLin Ma <lma@suse.com>
      Cc: qemu-stable <qemu-stable@nongnu.org>
      Message-Id: <20160914062250.22226-1-lma@suse.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      (cherry picked from commit 71200fb9)
      Signed-off-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      069e885d
    • P
      scsi: pvscsi: limit process IO loop to ring size · bfb15f77
      Prasad J Pandit 提交于
      Vmware Paravirtual SCSI emulator while processing IO requests
      could run into an infinite loop if 'pvscsi_ring_pop_req_descr'
      always returned positive value. Limit IO loop to the ring size.
      
      Cc: qemu-stable@nongnu.org
      Reported-by: NLi Qiang <liqiang6-s@360.cn>
      Signed-off-by: NPrasad J Pandit <pjp@fedoraproject.org>
      Message-Id: <1473845952-30785-1-git-send-email-ppandit@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      (cherry picked from commit d251157a)
      Signed-off-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      bfb15f77
    • L
      scsi: mptsas: use g_new0 to allocate MPTSASRequest object · c6a7b922
      Li Qiang 提交于
      When processing IO request in mptsas, it uses g_new to allocate
      a 'req' object. If an error occurs before 'req->sreq' is
      allocated, It could lead to an OOB write in mptsas_free_request
      function. Use g_new0 to avoid it.
      Reported-by: NLi Qiang <liqiang6-s@360.cn>
      Signed-off-by: NPrasad J Pandit <pjp@fedoraproject.org>
      Message-Id: <1473684251-17476-1-git-send-email-ppandit@redhat.com>
      Cc: qemu-stable@nongnu.org
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      (cherry picked from commit 670e56d3)
      Signed-off-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      c6a7b922
    • G
      9pfs: fix potential segfault during walk · d06c61f3
      Greg Kurz 提交于
      If the call to fid_to_qid() returns an error, we will call v9fs_path_free()
      on uninitialized paths.
      
      It is a regression introduced by the following commit:
      
      56f101ec 9pfs: handle walk of ".." in the root directory
      
      Let's fix this by initializing dpath and path before calling fid_to_qid().
      Signed-off-by: NGreg Kurz <groug@kaod.org>
      Reviewed-by: NCédric Le Goater <clg@kaod.org>
      [groug: updated the changelog to indicate this is regression and to provide
              the offending commit SHA1]
      Signed-off-by: NGreg Kurz <groug@kaod.org>
      
      (cherry picked from commit 13fd08e6)
      Signed-off-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      d06c61f3
    • G
      vnc: fix qemu crash because of SIGSEGV · 91a2f462
      Gonglei 提交于
      The backtrace is:
      
      0x00007f0b75cdf880 in pixman_image_get_stride () from /lib64/libpixman-1.so.0
      0x00007f0b77bcb3cf in vnc_server_fb_stride (vd=0x7f0b7a1a2bb0) at ui/vnc.c:680
      vnc_dpy_copy (dcl=0x7f0b7a1a2c00, src_x=224, src_y=263, dst_x=319, dst_y=363, w=1, h=1) at ui/vnc.c:915
      0x00007f0b77bbcc35 in dpy_gfx_copy (con=0x7f0b7a146210, src_x=src_x@entry=224, src_y=src_y@entry=263, dst_x=dst_x@entry=319,
      dst_y=dst_y@entry=363, w=1, h=1) at ui/console.c:1575
      0x00007f0b77bbda4e in qemu_console_copy (con=<optimized out>, src_x=src_x@entry=224, src_y=src_y@entry=263, dst_x=dst_x@entry=319,
      dst_y=dst_y@entry=363, w=<optimized out>, h=<optimized out>) at ui/console.c:2111
      0x00007f0b77ac0980 in cirrus_do_copy (h=<optimized out>, w=<optimized out>, src=<optimized out>, dst=<optimized out>, s=0x7f0b7b086090) at hw/display/cirrus_vga.c:774
      cirrus_bitblt_videotovideo_copy (s=0x7f0b7b086090) at hw/display/cirrus_vga.c:793
      cirrus_bitblt_videotovideo (s=0x7f0b7b086090) at hw/display/cirrus_vga.c:915
      cirrus_bitblt_start (s=0x7f0b7b086090) at hw/display/cirrus_vga.c:1056
      0x00007f0b77965cfb in memory_region_write_accessor (mr=0x7f0b7b096e40, addr=320, value=<optimized out>, size=1, shift=<optimized out>,mask=<optimized out>, attrs=...) at /root/rpmbuild/BUILD/master/qemu/memory.c:525
      0x00007f0b77963f59 in access_with_adjusted_size (addr=addr@entry=320, value=value@entry=0x7f0b69a268d8, size=size@entry=4,
      access_size_min=<optimized out>, access_size_max=<optimized out>, access=access@entry=0x7f0b77965c80 <memory_region_write_accessor>,
      mr=mr@entry=0x7f0b7b096e40, attrs=attrs@entry=...) at /root/rpmbuild/BUILD/master/qemu/memory.c:591
      0x00007f0b77968315 in memory_region_dispatch_write (mr=mr@entry=0x7f0b7b096e40, addr=addr@entry=320, data=18446744073709551362,
      size=size@entry=4, attrs=attrs@entry=...) at /root/rpmbuild/BUILD/master/qemu/memory.c:1262
      0x00007f0b779256a9 in address_space_write_continue (mr=0x7f0b7b096e40, l=4, addr1=320, len=4, buf=0x7f0b77713028 "\002\377\377\377",
      attrs=..., addr=4273930560, as=0x7f0b7827d280 <address_space_memory>) at /root/rpmbuild/BUILD/master/qemu/exec.c:2544
      address_space_write (as=<optimized out>, addr=<optimized out>, attrs=..., buf=<optimized out>, len=<optimized out>) at /root/rpmbuild/BUILD/master/qemu/exec.c:2601
      0x00007f0b77925c1d in address_space_rw (as=<optimized out>, addr=<optimized out>, attrs=..., attrs@entry=...,
      buf=buf@entry=0x7f0b77713028 "\002\377\377\377", len=<optimized out>, is_write=<optimized out>) at /root/rpmbuild/BUILD/master/qemu/exec.c:2703
      0x00007f0b77962f53 in kvm_cpu_exec (cpu=cpu@entry=0x7f0b79fcc2d0) at /root/rpmbuild/BUILD/master/qemu/kvm-all.c:1965
      0x00007f0b77950cc6 in qemu_kvm_cpu_thread_fn (arg=0x7f0b79fcc2d0) at /root/rpmbuild/BUILD/master/qemu/cpus.c:1078
      0x00007f0b744b3dc5 in start_thread (arg=0x7f0b69a27700) at pthread_create.c:308
      0x00007f0b70d3d66d in clone () from /lib64/libc.so.6
      
      The code path while meeting segfault:
       vnc_dpy_copy
         vnc_update_client
           vnc_disconnect_finish [while vnc_disconnect_start() is invoked because somethins wrong]
             vnc_update_server_surface
               vd->server = NULL;
         vnc_server_fb_stride
           pixman_image_get_stride(vd->server)
      
      Let's add a non-NULL check before calling vnc_server_fb_stride() to avoid segmentation fault.
      
      Cc: Gerd Hoffmann <kraxel@redhat.com>
      Cc: Daniel P. Berrange <berrange@redhat.com>
      Reported-by: NYanying Zhuang <ann.zhuangyanying@huawei.com>
      Signed-off-by: NGonglei <arei.gonglei@huawei.com>
      Reviewed-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Message-id: 1472788698-120964-1-git-send-email-arei.gonglei@huawei.com
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      (cherry picked from commit 3e10c3ec)
      Signed-off-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      91a2f462
    • L
      virtio-balloon: discard virtqueue element on reset · 520d4b28
      Ladi Prosek 提交于
      The one pending element is being freed but not discarded on device
      reset, which causes svq->inuse to creep up, eventually hitting the
      "Virtqueue size exceeded" error.
      
      Properly discarding the element on device reset makes sure that its
      buffers are unmapped and the inuse counter stays balanced.
      
      Cc: Michael S. Tsirkin <mst@redhat.com>
      Cc: Roman Kagan <rkagan@virtuozzo.com>
      Cc: Stefan Hajnoczi <stefanha@redhat.com>
      Signed-off-by: NLadi Prosek <lprosek@redhat.com>
      Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      (cherry picked from commit 104e70ca)
      Signed-off-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      520d4b28
    • S
      virtio: zero vq->inuse in virtio_reset() · 4b6542dd
      Stefan Hajnoczi 提交于
      vq->inuse must be zeroed upon device reset like most other virtqueue
      fields.
      
      In theory, virtio_reset() just needs assert(vq->inuse == 0) since
      devices must clean up in-flight requests during reset (requests cannot
      not be leaked!).
      
      In practice, it is difficult to achieve vq->inuse == 0 across reset
      because balloon, blk, 9p, etc implement various different strategies for
      cleaning up requests.  Most devices call g_free(elem) directly without
      telling virtio.c that the VirtQueueElement is cleaned up.  Therefore
      vq->inuse is not decremented during reset.
      
      This patch zeroes vq->inuse and trusts that devices are not leaking
      VirtQueueElements across reset.
      
      I will send a follow-up series that refactors request life-cycle across
      all devices and converts vq->inuse = 0 into assert(vq->inuse == 0) but
      this more invasive approach is not appropriate for stable trees.
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      Cc: qemu-stable <qemu-stable@nongnu.org>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      Reviewed-by: NLadi Prosek <lprosek@redhat.com>
      (cherry picked from commit 4b7f91ed)
      Signed-off-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      4b6542dd
    • M
      Merge tag 'ppc-for-2.7-20161013' into stable-2.7-staging · c1a77fd6
      Michael Roth 提交于
      qemu-2.7 (stable): ppc patch queue 2016-10-13
      
      TCG for ppc does not properly implement hardware transactional memory.
      It has a stub implementation in which transactions always fail.
      Unfortunately in v2.7.0, HTM is advertised as being available to
      guests, which means guests may incorrectly attempt to use it and hang.
      
      This has been the case for a while, but has become more urgent with
      recent (guest) Linux kernel versions which attempt to lazily enable
      TM.  Under TCG that now triggers the problem regularly, instead of
      just when running a TM aware userspace program.
      
      The problem is already fixed in the 2.8/master branch, by correctly
      advertising HTM as not being available with TCG.  This series
      backports the relevant patches to the qemu-2.7 stable branch to fix
      the problem there.
      
      * tag 'ppc-for-2.7-20161013':
        ppc: Check the availability of transactional memory
        hw/ppc/spapr: Fix the selection of the processor features
        hw/ppc/spapr: Move code related to "ibm,pa-features" to a separate function
        linux-headers: update
      c1a77fd6
  2. 13 10月, 2016 4 次提交
  3. 02 9月, 2016 1 次提交
  4. 31 8月, 2016 5 次提交
  5. 30 8月, 2016 4 次提交
  6. 25 8月, 2016 1 次提交
    • P
      Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging · e00da552
      Peter Maydell 提交于
      virtio: fixes
      
      some bugfixes for virtio
      balloon is still broken wrt migration
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      
      # gpg: Signature made Tue 23 Aug 2016 17:33:11 BST
      # gpg:                using RSA key 0x281F0DB8D28D5469
      # gpg: Good signature from "Michael S. Tsirkin <mst@kernel.org>"
      # gpg:                 aka "Michael S. Tsirkin <mst@redhat.com>"
      # Primary key fingerprint: 0270 606B 6F3C DF3D 0B17  0970 C350 3912 AFBE 8E67
      #      Subkey fingerprint: 5D09 FD08 71C8 F85B 94CA  8A0D 281F 0DB8 D28D 5469
      
      * remotes/mst/tags/for_upstream:
        virtio: decrement vq->inuse in virtqueue_discard()
        virtio: recalculate vq->inuse after migration
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      e00da552
  7. 24 8月, 2016 3 次提交
  8. 22 8月, 2016 4 次提交
  9. 19 8月, 2016 4 次提交