1. 07 1月, 2014 3 次提交
    • J
      qemu: Avoid using stale data in virDomainGetBlockInfo · b7992595
      Jiri Denemark 提交于
      CVE-2013-6458
      
      Generally, every API that is going to begin a job should do that before
      fetching data from vm->def. However, qemuDomainGetBlockInfo does not
      know whether it will have to start a job or not before checking vm->def.
      To avoid using disk alias that might have been freed while we were
      waiting for a job, we use its copy. In case the disk was removed in the
      meantime, we will fail with "cannot find statistics for device '...'"
      error message.
      b7992595
    • J
      qemu: Do not access stale data in virDomainBlockStats · db86da5c
      Jiri Denemark 提交于
      CVE-2013-6458
      https://bugzilla.redhat.com/show_bug.cgi?id=1043069
      
      When virDomainDetachDeviceFlags is called concurrently to
      virDomainBlockStats: libvirtd may crash because qemuDomainBlockStats
      finds a disk in vm->def before getting a job on a domain and uses the
      disk pointer after getting the job. However, the domain in unlocked
      while waiting on a job condition and thus data behind the disk pointer
      may disappear. This happens when thread 1 runs
      virDomainDetachDeviceFlags and enters monitor to actually remove the
      disk. Then another thread starts running virDomainBlockStats, finds the
      disk in vm->def, and while it's waiting on the job condition (owned by
      the first thread), the first thread finishes the disk removal. When the
      second thread gets the job, the memory pointed to be the disk pointer is
      already gone.
      
      That said, every API that is going to begin a job should do that before
      fetching data from vm->def.
      db86da5c
    • E
      maint: fix comment typos in qemu numa code · 599ef94d
      Eric Blake 提交于
      Introduced in commit 81fae6b9.
      
      * src/qemu/qemu_driver.c (qemuDomainSetNumaParamsLive): Fix typos.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      599ef94d
  2. 06 1月, 2014 2 次提交
    • P
      qemu: range check numa memory placement mode · 6e7490c7
      Peter Krempa 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1047234
      
      Add a range check for supported numa memory placement modes provided by
      the user before setting them in the domain definition. Without the check
      the user is able to provide a (yet) unknown mode which is then stored in
      the domain definition. This potentially causes a NULL dereference when
      the defintion is formatted into the XML.
      
      To reproduce run:
       virsh numatune DOMNAME --mode 6 --nodeset 0
      
      The XML will then contain:
        <numatune>
            <memory mode='(null)' nodeset='0'/>
        </numatune>
      
      With this fix, the command fails:
       error: Unable to change numa parameters
       error: invalid argument: unsupported numa_mode: '6'
      6e7490c7
    • P
      qemu: Clean up qemuDomainSetNumaParameters · 8b573a6b
      Peter Krempa 提交于
      Add whitespace to separate logical code blocks, reformat error messages
      and clean up code flow.
      
      This patch changes error handling in some cases where the the loop would
      be continued to jump to cleanup instead and error out rather than modify
      the domain any further.
      8b573a6b
  3. 12 12月, 2013 2 次提交
  4. 10 12月, 2013 6 次提交
  5. 06 12月, 2013 1 次提交
  6. 04 12月, 2013 1 次提交
  7. 03 12月, 2013 2 次提交
    • L
      qemu: default to vfio for nodedev-detach · 47b9aae0
      Laine Stump 提交于
      This patch resolves:
      
        https://bugzilla.redhat.com/show_bug.cgi?id=1035188
      
      Commit f094aaac changed the PCI device assignment in qemu domains
      to default to using VFIO rather than legacy KVM device assignment
      (when VFIO is available). It didn't change which driver was used by
      default for virNodeDeviceDetachFlags(), though, so that API (and the
      virsh nodedev-detach command) was still binding to the pci-stub
      driver, used by legacy KVM assignment, by default.
      
      This patch publicizes (only within the qemu module, though, so no
      additions to the symbol exports are needed) the functions that check
      for presence of KVM and VFIO device assignment, then uses those
      functions to decide what to do when no driver is specified for
      virNodeDeviceDetachFlags(); if the vfio driver is loaded, the device
      will be bound to vfio-pci, or if legacy KVM assignment is supported on
      this system, the device will be bound to pci-stub; if neither method
      is available, the detach will fail.
      47b9aae0
    • P
      qemu: snapshots: Declare supported and unsupported snapshot configs · 26fb96d8
      Peter Krempa 提交于
      Currently the snapshot code did not check if it actually supports
      snapshots on various disk backends for domains. To avoid future problems
      add checkers that whitelist the supported configurations.
      26fb96d8
  8. 02 12月, 2013 2 次提交
  9. 27 11月, 2013 1 次提交
    • B
      qemu: preserve netdev MAC address during 'domxml-to-native' · 8e043864
      Bing Bu Cao 提交于
      The virsh command 'domxml-to-native' (virConnectDomainXMLToNative())
      converts all network devices to "type='ethernet'" in order to make it
      more likely that the generated command could be run directly from a
      shell (other libvirt network device types end up referencing file
      descriptors for tap devices assumed to have been created by libvirt,
      which can't be done in this case).
      
      During this conversion, all of the netdev parameters are cleared out,
      then specific items are filled in after changing the type. The MAC
      address was not one of these preserved items, and the result was that
      mac addresses in the generated commandlines were always
      00:00:00:00:00:00.
      
      This patch saves the mac address before the conversion, then
      repopulates it afterwards, so the proper mac addresses show up in the
      commandline.
      Signed-off-by: NBing Bu Cao <mars@linux.vnet.ibm.com>
      Signed-off-by: NLaine Stump <laine@laine.org>
      8e043864
  10. 21 11月, 2013 2 次提交
  11. 18 11月, 2013 1 次提交
  12. 12 11月, 2013 1 次提交
    • M
      qemuDomainObjStart: Warn on corrupted image · cfc28c66
      Michal Privoznik 提交于
      If the managedsave image is corrupted, e.g. the XML part is, we fail to
      parse it and throw an error, e.g.:
      
      error: Failed to start domain jms8
      error: XML error: missing security model when using multiple labels
      
      This is okay, as we can't really start the machine and avoid undefined
      qemu behaviour. On the other hand, the error message doesn't give a
      clue to users what should they do. The consensus here would be to thrown
      a warning to logs saying "Hey, you've got a corrupted file".
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      cfc28c66
  13. 30 10月, 2013 1 次提交
    • D
      Fix race condition reconnecting to vms & loading configs · f26701f5
      Daniel P. Berrange 提交于
      The following sequence
      
       1. Define a persistent QMEU guest
       2. Start the QEMU guest
       3. Stop libvirtd
       4. Kill the QEMU process
       5. Start libvirtd
       6. List persistent guests
      
      At the last step, the previously running persistent guest
      will be missing. This is because of a race condition in the
      QEMU driver startup code. It does
      
       1. Load all VM state files
       2. Spawn thread to reconnect to each VM
       3. Load all VM config files
      
      Only at the end of step 3, does the 'virDomainObjPtr' get
      marked as "persistent". There is therefore a window where
      the thread reconnecting to the VM will remove the persistent
      VM from the list.
      
      The easy fix is to simply switch the order of steps 2 & 3.
      
      In addition to this though, we must only attempt to reconnect
      to a VM which had a non-zero PID loaded from its state file.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      f26701f5
  14. 21 10月, 2013 1 次提交
  15. 18 10月, 2013 2 次提交
  16. 15 10月, 2013 1 次提交
    • E
      maint: avoid 'const fooPtr' in qemu · 9a520a59
      Eric Blake 提交于
      'const fooPtr' is the same as 'foo * const' (the pointer won't
      change, but it's contents can).  But in general, if an interface
      is trying to be const-correct, it should be using 'const foo *'
      (the pointer is to data that can't be changed).
      
      Fix up offenders in src/qemu.
      
      * src/qemu/qemu_bridge_filter.h (networkAllowMacOnPort)
      (networkDisallowMacOnPort): Use intended type.
      * src/qemu/qemu_bridge_filter.c (networkAllowMacOnPort)
      (networkDisallowMacOnPort): Likewise.
      * src/qemu/qemu_command.c (qemuBuildTPMBackendStr)
      (qemuBuildTPMDevStr, qemuBuildCpuArgStr)
      (qemuBuildObsoleteAccelArg, qemuBuildMachineArgStr)
      (qemuBuildSmpArgStr, qemuBuildNumaArgStr): Likewise.
      * src/qemu/qemu_conf.c (qemuSharedDeviceEntryCopy): Likewise.
      * src/qemu/qemu_driver.c (qemuDomainSaveImageStartVM): Likewise.
      * src/qemu/qemu_hostdev.c
      (qemuDomainHostdevNetConfigVirtPortProfile): Likewise.
      * src/qemu/qemu_monitor_json.c
      (qemuMonitorJSONAttachCharDevCommand): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      9a520a59
  17. 14 10月, 2013 2 次提交
  18. 11 10月, 2013 3 次提交
  19. 10 10月, 2013 2 次提交
  20. 07 10月, 2013 1 次提交
    • D
      Remove use of virConnectPtr from all remaining nwfilter code · 999d72fb
      Daniel P. Berrange 提交于
      The virConnectPtr is passed around loads of nwfilter code in
      order to provide it as a parameter to the callback registered
      by the virt drivers. None of the virt drivers use this param
      though, so it serves no purpose.
      
      Avoiding the need to pass a virConnectPtr means that the
      nwfilterStateReload method no longer needs to open a bogus
      QEMU driver connection. This addresses a race condition that
      can lead to a crash on startup.
      
      The nwfilter driver starts before the QEMU driver and registers
      some callbacks with DBus to detect firewalld reload. If the
      firewalld reload happens while the QEMU driver is still starting
      up though, the nwfilterStateReload method will open a connection
      to the partially initialized QEMU driver and cause a crash.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      999d72fb
  21. 04 10月, 2013 2 次提交
  22. 27 9月, 2013 1 次提交