1. 16 1月, 2014 1 次提交
    • J
      qemu: Do not access stale data in virDomainBlockStats · d003b8f2
      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.
      
      (cherry picked from commit db86da5c)
      
      Conflicts:
      	src/qemu/qemu_driver.c - context: no ACLs
      d003b8f2
  2. 11 7月, 2013 1 次提交
  3. 20 6月, 2013 1 次提交
    • J
      qemu: Resolve issue with GetScheduler APIs for non running domain · 94c88b48
      John Ferlan 提交于
      Cherry-picked from b2375453
      
      As a consequence of the cgroup layout changes from commit '632f78ca', the
      qemuDomainGetSchedulerParameters[Flags]()' and qemuGetSchedulerType() APIs
      failed to return data for a non running domain.  This can be seen through
      a 'virsh schedinfo <domain>' command which returns:
      
      Scheduler      : Unknown
      error: Requested operation is not valid: cgroup CPU controller is not mounted
      
      Prior to that change a non running domain would return:
      
      Scheduler      : posix
      cpu_shares     : 0
      vcpu_period    : 0
      vcpu_quota     : 0
      emulator_period: 0
      emulator_quota : 0
      
      This patch will restore the capability to return configuration only data
      for a non running domain regardless of whether cgroups are available.
      
      Conflicts:
      	src/qemu/qemu_driver.c
      
       * Resolved conflict by using former qemuCgroupHasController() rather than
         virCgroupHasController()
       * Needed to add the code to fetch the 'vm'
            vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
            if (vm == NULL) {
                virReportError(VIR_ERR_INTERNAL_ERROR,
                               _("No such domain %s"), dom->uuid);
                goto cleanup;
            }
      * Used 'ret = strdup("posix");' rather than VIR_STRDUP(ret, "posix");
        and added the virReportOOMError(); on failure.
      94c88b48
  4. 09 5月, 2013 2 次提交
  5. 10 4月, 2013 1 次提交
  6. 28 3月, 2013 1 次提交
  7. 21 3月, 2013 2 次提交
  8. 20 3月, 2013 1 次提交
  9. 14 3月, 2013 1 次提交
  10. 13 3月, 2013 2 次提交
    • M
      qemu_driver: Try KVM_CAP_MAX_VCPUS only if defined · 3b94239f
      Michal Privoznik 提交于
      With our recent patch (1715c83b) we thrive to get the correct
      number of maximal VCPUs. However, we are using a constant from
      linux/kvm.h which may be not defined in every distro. Hence, we
      should guard usage of the constant with ifdef preprocessor
      directive. This was introduced in kernel:
      
          commit 8c3ba334f8588e1d5099f8602cf01897720e0eca
          Author: Sasha Levin <levinsasha928@gmail.com>
          Date:   Mon Jul 18 17:17:15 2011 +0300
      
          KVM: x86: Raise the hard VCPU count limit
      
          The patch raises the hard limit of VCPU count to 254.
      
          This will allow developers to easily work on scalability
          and will allow users to test high VCPU setups easily without
          patching the kernel.
      
          To prevent possible issues with current setups, KVM_CAP_NR_VCPUS
          now returns the recommended VCPU limit (which is still 64) - this
          should be a safe value for everybody, while a new KVM_CAP_MAX_VCPUS
          returns the hard limit which is now 254.
      
      $ git desc 8c3ba334f
      v3.1-rc7-48-g8c3ba33
      3b94239f
    • P
      virCaps: conf: start splitting out irrelevat data · 27cf98e2
      Peter Krempa 提交于
      The virCaps structure gathered a ton of irrelevant data over time that.
      The original reason is that it was propagated to the XML parser
      functions.
      
      This patch aims to create a new data structure virDomainXMLConf that
      will contain immutable data that are used by the XML parser. This will
      allow two things we need:
      
      1) Get rid of the stuff from virCaps
      
      2) Allow us to add callbacks to check and add driver specific stuff
      after domain XML is parsed.
      
      This first attempt removes pointers to private data allocation functions
      to this new structure and update all callers and function that require
      them.
      27cf98e2
  11. 12 3月, 2013 1 次提交
  12. 08 3月, 2013 1 次提交
    • M
      qemuDomainBlockStatsFlags: Guard disk lookup with a domain job · 5a791c89
      Michal Privoznik 提交于
      When there are two concurrent threads, we may dereference a NULL
      pointer, even though it has been checked before:
      
      1. Thread1: starts executing qemuDomainBlockStatsFlags() with nparams != 0.
                  It finds given disk and successfully pass check for disk->info.alias
                  not being NULL.
      2. Thread2: starts executing qemuDomainDetachDeviceFlags() on the very same
                  disk as Thread1 is working on.
      3. Thread1: gets to qemuDomainObjBeginJob() where it sets a job on a
                  domain.
      4. Thread2: also tries to set a job. However, we are not guaranteed which
                  thread wins. So assume it's Thread2 who can continue.
      5. Thread2: does the actual detach and frees disk->info.alias
      6. Thread2: quits the job
      7. Thread1: now successfully acquires the job, and accesses a NULL pointer.
      5a791c89
  13. 06 3月, 2013 1 次提交
  14. 05 3月, 2013 1 次提交
  15. 04 3月, 2013 1 次提交
  16. 28 2月, 2013 3 次提交
  17. 27 2月, 2013 1 次提交
    • D
      Fix crash changing CDROM media · 02b90972
      Daniel P. Berrange 提交于
      This change tried to fix a crash with changing CDROM media but
      failed to actually do so
      
        commit d0172d2b
        Author: Osier Yang <jyang@redhat.com>
        Date:   Tue Feb 19 20:27:45 2013 +0800
      
          qemu: Remove the shared disk entry if the operation is ejecting or updating
      
      It was still accessing disk->src, when the entire 'disk' object
      has been free'd already. Even if it weren't free'd, accessing
      the 'src' value of virDomainDiskDef is not allowed without
      first validating disk->type is file or block. Just remove the
      broken code entirely.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      02b90972
  18. 26 2月, 2013 1 次提交
  19. 23 2月, 2013 2 次提交
  20. 21 2月, 2013 9 次提交
    • J
      qemu: Turn closeCallbacks into virObjectLockable · 3898ba7f
      Jiri Denemark 提交于
      To avoid having to hold the qemu driver lock while iterating through
      close callbacks and calling them. This fixes a real deadlock when a
      domain which is being migrated from another host gets autodestoyed as a
      result of broken connection to the other host.
      3898ba7f
    • G
      qemu: fix an off-by-one error in qemuDomainGetPercpuStats · 09183163
      Guannan Ren 提交于
      The max value of number of cpus to compute(id) should not
      be equal or greater than max cpu number.
      The bug ocurrs when id value is equal to max cpu number which
      leads to the off-by-one error in the following for loop.
      
       # virsh  cpu-stats guest --start 1
       error: Failed to virDomainGetCPUStats()
      
       error: internal error cpuacct parse error
      09183163
    • J
      Remove a couple of misplaced VIR_FREE · 2bff35d5
      John Ferlan 提交于
      2bff35d5
    • M
      qemu: Run lzop with '--ignore-warn' · 0eeedf52
      Michal Privoznik 提交于
      Currently, if lzop decompression binary produces a warning, it
      doesn't exit with zero status but 2 instead. Terrifying, but
      true. However, warnings may be ignored using '--ignore-warn'
      command line argument.  Moreover, in which case, the exit status
      will be zero.
      0eeedf52
    • O
      qemu: Remove the shared disk entry if the operation is ejecting or updating · d0172d2b
      Osier Yang 提交于
      For both AttachDevice and UpdateDevice APIs, if the disk device
      is 'cdrom' or 'floppy', the operations could be ejecting, updating,
      and inserting. For either ejecting or updating, the shared disk
      entry of the original disk src has to be removed, because it's
      not useful anymore.
      
      And since the original disk def will be changed, new disk def passed
      as argument will be free'ed in qemuDomainChangeEjectableMedia, so
      we need to copy the orignal disk def before
      qemuDomainChangeEjectableMedia, to use it for qemuRemoveSharedDisk.
      d0172d2b
    • O
      qemu: Move the shared disk adding and sgio setting prior to attaching · 0db7ff59
      Osier Yang 提交于
      The disk def could be free'ed by qemuDomainChangeEjectableMedia,
      which can thus cause crash if we reference the disk pointer. On
      the other hand, we have to remove the added shared disk entry from
      the table on error codepath.
      0db7ff59
    • O
      qemu: Record names of domain which uses the shared disk in hash table · a4504ac1
      Osier Yang 提交于
      The hash entry is changed from "ref" to {ref, @domains}. With this, the
      caller can simply call qemuRemoveSharedDisk, without afraid of removing
      the entry belongs to other domains. qemuProcessStart will obviously
      benifit from it on error codepath (which calls qemuProcessStop to do
      the cleanup).
      a4504ac1
    • O
      qemu: Merge qemuCheckSharedDisk into qemuAddSharedDisk · 371df778
      Osier Yang 提交于
      Based on moving various checking into qemuAddSharedDisk, this
      avoids the caller using it in wrong ways. Also this adds two
      new checking for qemuCheckSharedDisk (disk device not 'lun'
      and kernel doesn't support unpriv_sgio simply returns 0).
      371df778
    • O
      qemu: Add checking in helpers for sgio setting · dab878a8
      Osier Yang 提交于
      This moves the various checking into the helpers, to avoid the
      callers missing the checking.
      dab878a8
  21. 19 2月, 2013 1 次提交
  22. 13 2月, 2013 1 次提交
    • D
      Remove qemuDriverLock from almost everywhere · a9e97e0c
      Daniel P. Berrange 提交于
      With the majority of fields in the virQEMUDriverPtr struct
      now immutable or self-locking, there is no need for practically
      any methods to be using the QEMU driver lock. Only a handful
      of helper APIs in qemu_conf.c now need it
      a9e97e0c
  23. 11 2月, 2013 2 次提交
  24. 08 2月, 2013 2 次提交