1. 04 12月, 2017 3 次提交
    • P
      Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging · e80a2561
      Peter Maydell 提交于
      pc, pci, virtio: fixes for rc3
      
      A bunch of fixes all over the place.
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      
      # gpg: Signature made Fri 01 Dec 2017 17:06:33 GMT
      # 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:
        pc: fix crash on attempted cpu unplug
        virtio: check VirtQueue Vring object is set
        vhost: fix error check in vhost_verify_ring_mappings()
        dump-guest-memory.py: fix No symbol "vmcoreinfo_find"
        vhost: restore avail index from vring used index on disconnection
        virtio: Add queue interface to restore avail index from vring used index
        i386/msi: Correct mask of destination ID in MSI address
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      e80a2561
    • P
      Merge remote-tracking branch 'remotes/dgibson/tags/ppc-for-2.11-20171204' into staging · 495566ec
      Peter Maydell 提交于
      ppc patch queue 2017-12-04
      
      We are, alas, not yet to the bottom of ppc bugs.  This pull request
      fixes several more.  I believe they're important enough to include in
      2.11. despite the late date.
      
      # gpg: Signature made Mon 04 Dec 2017 03:40:56 GMT
      # gpg:                using RSA key 0x6C38CACA20D9B392
      # gpg: Good signature from "David Gibson <david@gibson.dropbear.id.au>"
      # gpg:                 aka "David Gibson (Red Hat) <dgibson@redhat.com>"
      # gpg:                 aka "David Gibson (ozlabs.org) <dgibson@ozlabs.org>"
      # gpg:                 aka "David Gibson (kernel.org) <dwg@kernel.org>"
      # Primary key fingerprint: 75F4 6586 AE61 A66C C44E  87DC 6C38 CACA 20D9 B392
      
      * remotes/dgibson/tags/ppc-for-2.11-20171204:
        spapr: Include "pre-plugged" DIMMS in ram size calculation at reset
        target-ppc: Don't invalidate non-supported msr bits
        pseries: fix TCG migration
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      495566ec
    • D
      spapr: Include "pre-plugged" DIMMS in ram size calculation at reset · 768a20f3
      David Gibson 提交于
      At guest reset time, we allocate a hash page table (HPT) for the guest
      based on the guest's RAM size.  If dynamic HPT resizing is not available we
      use the maximum RAM size, if it is we use the current RAM size.
      
      But the "current RAM size" calculation is incorrect - we just use the
      "base" ram_size from the machine structure.  This doesn't include any
      pluggable DIMMs that are already plugged at reset time.
      
      This means that if you try to start a 'pseries' machine with a DIMM
      specified on the command line that's much larger than the "base" RAM size,
      then the guest will get a woefully inadequate HPT.  This can lead to a
      guest freeze during boot as it runs out of HPT space during initial MMU
      setup.
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Reviewed-by: NGreg Kurz <groug@kaod.org>
      Tested-by: NGreg Kurz <groug@kaod.org>
      768a20f3
  2. 02 12月, 2017 7 次提交
  3. 30 11月, 2017 4 次提交
    • K
      target-ppc: Don't invalidate non-supported msr bits · be1b21e8
      Kurban Mallachiev 提交于
      The msr invalidation code (commits 993eb and 2360b) inverts all
      bits except MSR_TGPR and MSR_HVB. On non PowerPC 601 processors
      this leads to incorrect change of excp_prefix in hreg_store_msr()
      function. The problem is that new msr value get multiplied by msr_mask
      and inverted msr does not, thus values of MSR_EP bit in new msr value
      and inverted msr are distinct, so that excp_prefix changes but should
      not.
      Signed-off-by: NKurban Mallachiev <mallachiev@ispras.ru>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      be1b21e8
    • L
      pseries: fix TCG migration · 0c86b2df
      Laurent Vivier 提交于
      Migration of pseries is broken with TCG because
      QEMU tries to restore KVM MMU state unconditionally.
      
      The result is a SIGSEGV in kvm_vm_ioctl():
      
        #0  kvm_vm_ioctl (s=0x0, type=-2146390353)
            at qemu/accel/kvm/kvm-all.c:2032
        #1  0x00000001003e3e2c in kvmppc_configure_v3_mmu (cpu=<optimized out>,
            radix=<optimized out>, gtse=<optimized out>, proc_tbl=<optimized out>)
            at qemu/target/ppc/kvm.c:396
        #2  0x00000001002f8b88 in spapr_post_load (opaque=0x1019103c0,
            version_id=<optimized out>) at qemu/hw/ppc/spapr.c:1578
        #3  0x000000010059e4cc in vmstate_load_state (f=0x106230000,
            vmsd=0x1009479e0 <vmstate_spapr>, opaque=0x1019103c0,
            version_id=<optimized out>) at qemu/migration/vmstate.c:165
        #4  0x00000001005987e0 in vmstate_load (f=<optimized out>, se=<optimized out>)
            at qemu/migration/savevm.c:748
      
      This patch fixes the problem by not calling the KVM function with the
      TCG mode.
      
      Fixes: d39c90f5 ("spapr: Fix migration of Radix guests")
      Signed-off-by: NLaurent Vivier <lvivier@redhat.com>
      Reviewed-by: NSuraj Jitindar Singh <sjitindarsingh@gmail.com>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      0c86b2df
    • P
      Update version for v2.11.0-rc3 release · c11d6127
      Peter Maydell 提交于
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      c11d6127
    • P
      Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging · 915308bc
      Peter Maydell 提交于
      Block layer patches for 2.11.0-rc3
      
      # gpg: Signature made Wed 29 Nov 2017 15:25:13 GMT
      # gpg:                using RSA key 0x7F09B272C88F2FD6
      # gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>"
      # Primary key fingerprint: DC3D EB15 9A9A F95D 3D74  56FE 7F09 B272 C88F 2FD6
      
      * remotes/kevin/tags/for-upstream:
        block/nfs: fix nfs_client_open for filesize greater than 1TB
        blockjob: reimplement block_job_sleep_ns to allow cancellation
        blockjob: introduce block_job_do_yield
        blockjob: remove clock argument from block_job_sleep_ns
        block: Expect graph changes in bdrv_parent_drained_begin/end
        blockjob: Remove the job from the list earlier in block_job_unref()
        QAPI & interop: Clarify events emitted by 'block-job-cancel'
        qemu-options: Mention locking option of file driver
        docs: Add image locking subsection
        iotests: fix 075 and 078
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      915308bc
  4. 29 11月, 2017 6 次提交
  5. 28 11月, 2017 8 次提交
    • A
      blockjob: Remove the job from the list earlier in block_job_unref() · 0a3e155f
      Alberto Garcia 提交于
      When destroying a block job in block_job_unref() we should remove it
      from the job list before calling block_job_remove_all_bdrv().
      
      This is because removing the BDSs can trigger an aio_poll() and wake
      up other jobs that might attempt to use the block job list. If that
      happens the job we're currently destroying should not be in that list
      anymore.
      Signed-off-by: NAlberto Garcia <berto@igalia.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      0a3e155f
    • P
      Merge remote-tracking branch 'remotes/ericb/tags/pull-nbd-2017-11-28' into staging · 844496f3
      Peter Maydell 提交于
      nbd patches for 2017-11-28
      
      Eric Blake - 0/2 fix two NBD server CVEs
      
      # gpg: Signature made Tue 28 Nov 2017 12:58:29 GMT
      # gpg:                using RSA key 0xA7A16B4A2527436A
      # gpg: Good signature from "Eric Blake <eblake@redhat.com>"
      # gpg:                 aka "Eric Blake (Free Software Programmer) <ebb9@byu.net>"
      # gpg:                 aka "[jpeg image of size 6874]"
      # Primary key fingerprint: 71C2 CC22 B1C4 6029 27D2  F3AA A7A1 6B4A 2527 436A
      
      * remotes/ericb/tags/pull-nbd-2017-11-28:
        nbd/server: CVE-2017-15118 Stack smash on large export name
        nbd/server: CVE-2017-15119 Reject options larger than 32M
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      844496f3
    • E
      nbd/server: CVE-2017-15118 Stack smash on large export name · 51ae4f84
      Eric Blake 提交于
      Introduced in commit f37708f6 (2.10).  The NBD spec says a client
      can request export names up to 4096 bytes in length, even though
      they should not expect success on names longer than 256.  However,
      qemu hard-codes the limit of 256, and fails to filter out a client
      that probes for a longer name; the result is a stack smash that can
      potentially give an attacker arbitrary control over the qemu
      process.
      
      The smash can be easily demonstrated with this client:
      $ qemu-io f raw nbd://localhost:10809/$(printf %3000d 1 | tr ' ' a)
      
      If the qemu NBD server binary (whether the standalone qemu-nbd, or
      the builtin server of QMP nbd-server-start) was compiled with
      -fstack-protector-strong, the ability to exploit the stack smash
      into arbitrary execution is a lot more difficult (but still
      theoretically possible to a determined attacker, perhaps in
      combination with other CVEs).  Still, crashing a running qemu (and
      losing the VM) is bad enough, even if the attacker did not obtain
      full execution control.
      
      CC: qemu-stable@nongnu.org
      Signed-off-by: NEric Blake <eblake@redhat.com>
      51ae4f84
    • E
      nbd/server: CVE-2017-15119 Reject options larger than 32M · fdad35ef
      Eric Blake 提交于
      The NBD spec gives us permission to abruptly disconnect on clients
      that send outrageously large option requests, rather than having
      to spend the time reading to the end of the option.  No real
      option request requires that much data anyways; and meanwhile, we
      already have the practice of abruptly dropping the connection on
      any client that sends NBD_CMD_WRITE with a payload larger than 32M.
      
      For comparison, nbdkit drops the connection on any request with
      more than 4096 bytes; however, that limit is probably too low
      (as the NBD spec states an export name can theoretically be up
      to 4096 bytes, which means a valid NBD_OPT_INFO could be even
      longer) - even if qemu doesn't permit exports longer than 256
      bytes.
      
      It could be argued that a malicious client trying to get us to
      read nearly 4G of data on a bad request is a form of denial of
      service.  In particular, if the server requires TLS, but a client
      that does not know the TLS credentials sends any option (other
      than NBD_OPT_STARTTLS or NBD_OPT_EXPORT_NAME) with a stated
      payload of nearly 4G, then the server was keeping the connection
      alive trying to read all the payload, tying up resources that it
      would rather be spending on a client that can get past the TLS
      handshake.  Hence, this warranted a CVE.
      
      Present since at least 2.5 when handling known options, and made
      worse in 2.6 when fixing support for NBD_FLAG_C_FIXED_NEWSTYLE
      to handle unknown options.
      
      CC: qemu-stable@nongnu.org
      Signed-off-by: NEric Blake <eblake@redhat.com>
      fdad35ef
    • P
      Merge remote-tracking branch 'remotes/berrange/tags/pull-qio-2017-11-28-1' into staging · a914f04c
      Peter Maydell 提交于
      Merge qio 2017/11/28 v1
      
      # gpg: Signature made Tue 28 Nov 2017 10:49:08 GMT
      # gpg:                using RSA key 0xBE86EBB415104FDF
      # gpg: Good signature from "Daniel P. Berrange <dan@berrange.com>"
      # gpg:                 aka "Daniel P. Berrange <berrange@redhat.com>"
      # Primary key fingerprint: DAF3 A6FD B26B 6291 2D0E  8E3F BE86 EBB4 1510 4FDF
      
      * remotes/berrange/tags/pull-qio-2017-11-28-1:
        sockets: avoid crash when cleaning up sockets for an invalid FD
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      a914f04c
    • D
      sockets: avoid crash when cleaning up sockets for an invalid FD · 2d7ad7c0
      Daniel P. Berrange 提交于
      If socket_listen_cleanup is passed an invalid FD, then querying the socket
      local address will fail. We must thus be prepared for the returned addr to
      be NULL
      Reported-by: NDr. David Alan Gilbert <dgilbert@redhat.com>
      Reviewed-by: NDr. David Alan Gilbert <dgilbert@redhat.com>
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      2d7ad7c0
    • P
      Merge remote-tracking branch 'remotes/jasowang/tags/net-pull-request' into staging · c7e1f823
      Peter Maydell 提交于
      # gpg: Signature made Tue 28 Nov 2017 03:58:11 GMT
      # gpg:                using RSA key 0xEF04965B398D6211
      # gpg: Good signature from "Jason Wang (Jason Wang on RedHat) <jasowang@redhat.com>"
      # gpg: WARNING: This key is not certified with sufficiently trusted signatures!
      # gpg:          It is not certain that the signature belongs to the owner.
      # Primary key fingerprint: 215D 46F4 8246 689E C77F  3562 EF04 965B 398D 6211
      
      * remotes/jasowang/tags/net-pull-request:
        virtio-net: don't touch virtqueue if vm is stopped
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      c7e1f823
    • J
      virtio-net: don't touch virtqueue if vm is stopped · 70e53e6e
      Jason Wang 提交于
      Guest state should not be touched if VM is stopped, unfortunately we
      didn't check running state and tried to drain tx queue unconditionally
      in virtio_net_set_status(). A crash was then noticed as a migration
      destination when user type quit after virtqueue state is loaded but
      before region cache is initialized. In this case,
      virtio_net_drop_tx_queue_data() tries to access the uninitialized
      region cache.
      
      Fix this by only dropping tx queue data when vm is running.
      
      Fixes: 283e2c2a ("net: virtio-net discards TX data after link down")
      Cc: Yuri Benditovich <yuri.benditovich@daynix.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Stefan Hajnoczi <stefanha@redhat.com>
      Cc: Michael S. Tsirkin <mst@redhat.com>
      Cc: qemu-stable@nongnu.org
      Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
      Signed-off-by: NJason Wang <jasowang@redhat.com>
      70e53e6e
  6. 27 11月, 2017 7 次提交
    • K
      QAPI & interop: Clarify events emitted by 'block-job-cancel' · c117bb14
      Kashyap Chamarthy 提交于
      When you cancel an in-progress 'mirror' job (or "active `block-commit`")
      with QMP `block-job-cancel`, it emits the event: BLOCK_JOB_CANCELLED.
      However, when `block-job-cancel` is issued *after* `drive-mirror` has
      indicated (via the event BLOCK_JOB_READY) that the source and
      destination have reached synchronization:
      
          [...] # Snip `drive-mirror` invocation & outputs
          {
            "execute":"block-job-cancel",
            "arguments":{
              "device":"virtio0"
            }
          }
      
          {"return": {}}
      
      It (`block-job-cancel`) will counterintuitively emit the event
      'BLOCK_JOB_COMPLETED':
      
          {
            "timestamp":{
              "seconds":1510678024,
              "microseconds":526240
            },
            "event":"BLOCK_JOB_COMPLETED",
            "data":{
              "device":"virtio0",
              "len":41126400,
              "offset":41126400,
              "speed":0,
              "type":"mirror"
            }
          }
      
      But this is expected behaviour, where the _COMPLETED event indicates
      that synchronization has successfully ended (and the destination now has
      a point-in-time copy, which is at the time of cancel).
      
      So add a small note to this effect in 'block-core.json'.  While at it,
      also update the "Live disk synchronization -- drive-mirror and
      blockdev-mirror" section in 'live-block-operations.rst'.
      
      (Thanks: Max Reitz for reminding me of this caveat on IRC.)
      Signed-off-by: NKashyap Chamarthy <kchamart@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      c117bb14
    • P
      Merge remote-tracking branch 'remotes/dgibson/tags/ppc-for-2.11-20171127' into staging · 5e19aed5
      Peter Maydell 提交于
      ppc patch queue 2017-11-27
      
      This series contains a couple of migration fixes for hash guests on
      POWER9 radix MMU hosts.
      
      # gpg: Signature made Mon 27 Nov 2017 04:27:15 GMT
      # gpg:                using RSA key 0x6C38CACA20D9B392
      # gpg: Good signature from "David Gibson <david@gibson.dropbear.id.au>"
      # gpg:                 aka "David Gibson (Red Hat) <dgibson@redhat.com>"
      # gpg:                 aka "David Gibson (ozlabs.org) <dgibson@ozlabs.org>"
      # gpg:                 aka "David Gibson (kernel.org) <dwg@kernel.org>"
      # Primary key fingerprint: 75F4 6586 AE61 A66C C44E  87DC 6C38 CACA 20D9 B392
      
      * remotes/dgibson/tags/ppc-for-2.11-20171127:
        target/ppc: Fix setting of cpu->compat_pvr on incoming migration
        target/ppc: Move setting of patb_entry on hash table init
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      5e19aed5
    • F
      qemu-options: Mention locking option of file driver · 1878eaff
      Fam Zheng 提交于
      Signed-off-by: NFam Zheng <famz@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      1878eaff
    • F
      docs: Add image locking subsection · b1d1cb27
      Fam Zheng 提交于
      This documents the image locking feature and explains when and how
      related options can be used.
      Signed-off-by: NFam Zheng <famz@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      b1d1cb27
    • J
      iotests: fix 075 and 078 · 45f1882a
      John Snow 提交于
      Both of these tests are for formats which now stipulate that they are
      read-only. Adjust the tests to match.
      Signed-off-by: NJohn Snow <jsnow@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NLukáš Doktor <ldoktor@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      45f1882a
    • S
      target/ppc: Fix setting of cpu->compat_pvr on incoming migration · e07cc192
      Suraj Jitindar Singh 提交于
      cpu->compat_pvr is used to store the current compat mode of the cpu.
      
      On the receiving side during incoming migration we check compatibility
      with the compat mode by calling ppc_set_compat(). However we fail to set
      the compat mode with the hypervisor since the "new" compat mode doesn't
      differ from the current (due to a "cpu->compat_pvr != compat_pvr" check).
      This means that kvm runs the vcpus without a compat mode, which is the
      incorrect behaviour. The implication being that a compatibility mode
      will never be in effect after migration.
      
      To fix this so that the compat mode is correctly set with the
      hypervisor, store the desired compat mode and reset cpu->compat_pvr to
      zero before calling ppc_set_compat().
      
      Fixes: 5dfaa532 ("ppc: fix ppc_set_compat() with KVM PR")
      Signed-off-by: NSuraj Jitindar Singh <sjitindarsingh@gmail.com>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      e07cc192
    • S
      target/ppc: Move setting of patb_entry on hash table init · ee4d9ecc
      Suraj Jitindar Singh 提交于
      The patb_entry is used to store the location of the process table in
      guest memory. The msb is also used to indicate the mmu mode of the
      guest, that is patb_entry & 1 << 63 ? radix_mode : hash_mode.
      
      Currently we set this to zero in spapr_setup_hpt_and_vrma() since if
      this function gets called then we know we're hash. However some code
      paths, such as setting up the hpt on incoming migration of a hash guest,
      call spapr_reallocate_hpt() directly bypassing this higher level
      function. Since we assume radix if the host is capable this results in
      the msb in patb_entry being left set so in spapr_post_load() we call
      kvmppc_configure_v3_mmu() and tell the host we're radix which as
      expected means addresses cannot be translated once we actually run the cpu.
      
      To fix this move the zeroing of patb_entry into spapr_reallocate_hpt().
      Signed-off-by: NSuraj Jitindar Singh <sjitindarsingh@gmail.com>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      ee4d9ecc
  7. 24 11月, 2017 5 次提交