1. 29 1月, 2013 1 次提交
    • P
      rpc: Fix crash on error paths of message dispatching · 46532e3e
      Peter Krempa 提交于
      This patch resolves CVE-2013-0170:
      https://bugzilla.redhat.com/show_bug.cgi?id=893450
      
      When reading and dispatching of a message failed the message was freed
      but wasn't removed from the message queue.
      
      After that when the connection was about to be closed the pointer for
      the message was still present in the queue and it was passed to
      virNetMessageFree which tried to call the callback function from an
      uninitialized pointer.
      
      This patch removes the message from the queue before it's freed.
      
      * rpc/virnetserverclient.c: virNetServerClientDispatchRead:
          - avoid use after free of RPC messages
      46532e3e
  2. 28 1月, 2013 2 次提交
  3. 27 1月, 2013 2 次提交
  4. 26 1月, 2013 11 次提交
    • J
      vbox: Adjust the UTF FREE macros · 97278ab4
      John Ferlan 提交于
      Adjust the macros to free memory allocated during various calls to
      perform the check if parameter is NULL prior to really freeing and to
      set the pointer to NULL after done freeing.
      97278ab4
    • J
      vbox: Address false positive for NULL dereference · 4f01d3d5
      John Ferlan 提交于
      Resolve a false positive from 'vboxIIDFromUUID_v2_x()'. The code sets
      'iid->value = &iid->backing' unconditionally prior to calling 'nsIDFromChar()'.
      The 'vboxIIDUnalloc_v2_x()' checks iid->value to not be &iid->backing. The
      iid->backing is a static buffer within the initialized structure.
      4f01d3d5
    • G
      2cebf848
    • P
      virsh: Add --print-xml flag for attach-disk command · f8d5119e
      Peter Krempa 提交于
      The flag causes the XML of the disk that would be attached to be printed
      instead.
      f8d5119e
    • J
      libxl: Domain event handler improvements · 70291149
      Jim Fehlig 提交于
      Since libxl provides the domain ID in the event handler callback,
      find the domain object based on the ID.  This approach prevents
      processing the callback on a domain that has already been reaped.
      
      Also, similar to the xl implementation, ignore the SUSPEND shutdown
      reason.  By calling libxl_domain_suspend(), we know a shutdown
      event with SUSPEND reason will be generated, but it can be safely
      ignored since any subsequent cleanup will be done by the callers.
      70291149
    • J
      libxl: Fix removing non-persistent domain after save · 02ed255e
      Jim Fehlig 提交于
      libxlDoDomainSave() was removing non-persistent domains, but
      required callers to have the virDomainObj locked.  Callers could
      potentially unlock an already freed virDomainObj.  Move this
      logic to the callers of libxlDoDomainSave().
      02ed255e
    • J
      libxl: Explicitly remove timeouts · ce33422d
      Jim Fehlig 提交于
      I've noticed that libxl can invoke timeout reregister/modify hooks
      after returning from libxl_ctx_free.  Explicitly remove the
      timeouts before freeing the libxl ctx to avoid executing hooks on
      stale objects.
      ce33422d
    • J
      libxl: Fix race between destruction of objects · 889ce746
      Jim Fehlig 提交于
      It is possible to destroy and cleanup a VM, resulting in freeing the
      libxlDomainObjPrivate object and associated libxl ctx, before all fds and
      timeouts have been deregistered and destroyed.
      
      Fix this race by incrementing the reference count on libxlDomainObjPrivate
      for each fd and timeout registration.  Only when all fds and timeouts are
      deregistered and destroyed will the libxlDomainObjPrivate be destroyed.
      889ce746
    • J
      libxl: Fix races in libxl event code · e0622ca2
      Jim Fehlig 提交于
      The libxl driver is racy in it's interactions with libxl and libvirt's
      event loop.  The event loop can invoke callbacks after libxl has
      deregistered the event, and possibly access freed data associated with
      the event.
      
      This patch fixes the race by converting libxlDomainObjPrivate to a
      virObjectLockable, and locking it while executing libxl upcalls and
      libvirt event loop callbacks.
      
      Note that using the virDomainObj lock is not satisfactory since it may
      be desirable to hold the virDomainObj lock even when libxl events such
      as reading and writing to xenstore need processed.
      e0622ca2
    • J
      libxl: Fix handling of timeouts · 04172610
      Jim Fehlig 提交于
      xen-unstable changeset 26469 makes changes wrt modifying and deregistering
      timeouts.
      
      First, timeout modify callbacks will only be invoked with an
      abs_t of {0,0}, i.e. make the timeout fire immediately.  Prior to this
      commit, timeout modify callbacks were never invoked.
      
      Second, timeout deregister hooks will no longer be called.
      
      This patch makes changes in the libvirt libxl driver that should be
      compatible before and after changeset 26469.
      
      While at it, fix a potential overflow in the timeout register callback.
      04172610
    • E
      conf: avoid NULL deref for pmsuspended domain state · e0642059
      Eric Blake 提交于
      While working with a pmsuspend vs. snapshot issue, I noticed that
      the state file in /var/run/libvirt/qemu/dom.xml contained a rather
      suspicious "(null)" string, which does not round-trip well through
      a libvirtd restart.  Had I been on a platform other than glibc
      where printf("%s",NULL) crashes instead of printing (null), we might
      have noticed the problem much sooner.
      
      And in fixing that problem, I also noticed that we had several
      missing states, because we were #defining several *_LAST names
      to a value _different_ than what they were already given as enums
      in libvirt.h.  Yuck.  I got rid of default: labels in the case
      statements, because they get in the way of gcc's -Wswitch helping
      us ensure we cover all enum values.
      
      * src/conf/domain_conf.c (virDomainStateReasonToString)
      (virDomainStateReasonFromString): Fill in missing domain states;
      rewrite case statement to let compiler enforce checking.
      (VIR_DOMAIN_NOSTATE_LAST, VIR_DOMAIN_RUNNING_LAST)
      (VIR_DOMAIN_BLOCKED_LAST, VIR_DOMAIN_PAUSED_LAST)
      (VIR_DOMAIN_SHUTDOWN_LAST, VIR_DOMAIN_SHUTOFF_LAST)
      (VIR_DOMAIN_CRASHED_LAST): Drop dead defines.
      (VIR_DOMAIN_PMSUSPENDED_LAST): Drop dead define.
      (virDomainPMSuspendedReason): Add missing enum function.
      (virDomainRunningReason, virDomainPausedReason): Add missing enum
      value.
      * src/conf/domain_conf.h (virDomainPMSuspendedReason): Declare
      missing functions.
      * src/libvirt_private.syms (domain_conf.h): Export them.
      e0642059
  5. 25 1月, 2013 12 次提交
    • E
      maint: make it easier to sort syms files · f0aa4935
      Eric Blake 提交于
      I got bit by 'make check' complaining that the sort order I got
      by emacs' sort-lines function differed from expectations.
      
      * src/libvirt_private.syms: Add emacs trailer.
      * src/libvirt_atomic.syms: Likewise.
      * src/libvirt_daemon.syms: Likewise.
      * src/libvirt_esx.syms: Likewise.
      * src/libvirt_libssh2.syms: Likewise.
      * src/libvirt_linux.syms: Likewise.
      * src/libvirt_openvz.syms: Likewise.
      * src/libvirt_sasl.syms: Likewise.
      * src/libvirt_vmx.syms: Likewise.
      * src/libvirt_xenxs.syms: Likewise.
      f0aa4935
    • M
      qemu_monitor: Fix tray-open attribute in query-block · 319ed264
      Michal Privoznik 提交于
      With our code, we fail to query for tray-open attribute currently.
      That's because in HMP it is 'tray-open' and in QMP it's 'tray_open'.
      It always has been. However, we got it exactly the opposite.
      319ed264
    • D
      Fix bogus reporting of KVM support for non-native emulators · c29eafc8
      Daniel P. Berrange 提交于
      A logic bug meant we reported KVM was possible for every
      architecture, merely based on whether the query-kvm command
      exists. We should instead have been doing it based on whether
      the query-kvm command returns 'present: 1'
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      c29eafc8
    • D
      Move QEMU capabilities initialization later in QEMU startup · d7a3700e
      Daniel P. Berrange 提交于
      Currently QEMU capabilities are initialized before the QEMU driver
      sets ownership on its various directories. The upshot is that if
      you change the user/group in the qemu.conf file, libvirtd will fail
      to probe QEMU the first time it is run after the config change.
      Moving QEMU capabilities initialization to after the chown() calls
      fixes this
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      d7a3700e
    • D
      Fix performance & reliabilty of QMP probing · 1b253a10
      Daniel P. Berrange 提交于
      This previous commit
      
        commit 1a50ba2c
        Author: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
        Date:   Mon Nov 26 15:17:13 2012 +0100
      
          qemu: Fix QMP Capabability Probing Failure
      
      which attempted to make sure the QEMU process used for probing
      ran as the right user id, caused serious performance regression
      and unreliability in probing. The -daemonize switch in QEMU
      guarantees that the monitor socket is present before the parent
      process exits. This means libvirtd is guaranteed to be able to
      connect immediately. By switching from -daemonize to the
      virCommandDaemonize API libvirtd was no longer synchronized with
      QEMU's startup process. The result was that the QEMU monitor
      failed to open and went into its 200ms sleep loop. This happened
      for all 25 binaries resulting in 5 seconds worth of sleeping
      at libvirtd startup. In addition sometimes when libvirt connected,
      QEMU would be partially initialized and crash causing total
      failure to probe that binary.
      
      This commit reverts the previous change, ensuring we do use the
      -daemonize flag to QEMU. Startup delay is cut from 7 seconds
      to 2 seconds on my machine, which is on a par with what it was
      prior to the capabilities rewrite.
      
      To deal with the fact that QEMU needs to be able to create the
      pidfile, we switch pidfile location fron runDir to libDir, which
      QEMU is guaranteed to be able to write to.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      1b253a10
    • M
      qemuDomainSendKey: Relax the qemu driver locking · 2eb54c74
      Michal Privoznik 提交于
      Currently, there is no reason to hold qemu driver locked
      throughout whole API execution. Moreover, we can use the
      new qemuDomObjFromDomain() internal API to lookup domain then.
      2eb54c74
    • S
      node_memory: Add '\n' to help message · 3dbabd29
      Satoru Moriya 提交于
      Linefeed is missed in the help of node-memory-tune.
      This patch just adds '\n' to get a correct help message.
      Signed-off-by: NSatoru Moriya <satoru.moriya@hds.com>
      3dbabd29
    • J
      qemu: escape ipv6 for rbd network disk hosts · c1509ab4
      Josh Durgin 提交于
      Hosts for rbd are ceph monitor daemons. These have fixed IP addresses,
      so they are often referenced by IP rather than hostname for
      convenience, or to avoid relying on DNS. Using IPv4 addresses as the
      host name works already, but IPv6 addresses require rbd-specific
      escaping because the colon is used as an option separator in the
      string passed to qemu.
      
      Escape these colons, and enclose the IPv6 address in square brackets
      so it is distinguished from the port, which is currently mandatory.
      Acked-by: NOsier Yang <jyang@redhat.com>
      Signed-off-by: NJosh Durgin <josh.durgin@inktank.com>
      c1509ab4
    • E
      snapshot: fix state after external snapshot of S3 domain · 339bdd99
      Eric Blake 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=876829 complains that
      if a guest is put into S3 state (such as via virsh dompmsuspend)
      and then an external snapshot is taken, qemu forcefully transitions
      the domain to paused, but libvirt doesn't reflect that change
      internally.  Thus, a user has to use 'virsh suspend' to get libvirt
      back in sync with qemu state, and if the user doesn't know this
      trick, then the guest appears hung.
      
      * src/qemu/qemu_driver.c (qemuDomainSnapshotCreateActiveExternal):
      Track fact that qemu wakes up a suspended domain on migration.
      339bdd99
    • J
      locking: use virStrcpyStatic instead of memcpy · 678e8913
      John Ferlan 提交于
      678e8913
    • J
      python: Fix bindings for virDomainSnapshotGet{Domain,Connect} · 7b35fd71
      Jiri Denemark 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=895882
      
      virDomainSnapshot.getDomain() and virDomainSnapshot.getConnect()
      wrappers around virDomainSnapshotGet{Domain,Connect} were not supposed
      to be ever implemented. The class should contain proper domain() and
      connect() accessors that fetch python objects stored internally within
      the class. While domain() was already provided, connect() was missing.
      
      This patch adds connect() method to virDomainSnapshot class and
      reimplements getDomain() and getConnect() methods as aliases to domain()
      and connect() for backward compatibility.
      7b35fd71
    • D
      Fix crash free'ing securityDriverNames in QEMU driver · bbc663b1
      Daniel P. Berrange 提交于
      The previous fix to avoid leaking securityDriverNames forgot to
      handle the case of securityDriverNames being NULL, leading to
      a crash
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      bbc663b1
  6. 24 1月, 2013 12 次提交