Libvirt provides a portable, long term stable C API for managing the virtualization technologies provided by many operating systems. It includes support for QEMU, KVM, Xen, LXC, bhyve, Virtuozzo, VMware vCenter and ESX, VMware Desktop, Hyper-V, VirtualBox and the POWER Hypervisor.
Go to file
Michael Chapman 9b4dd2c75b qemu: fix crash in qemuProcessAutoDestroy
The destination libvirt daemon in a migration may segfault if the client
disconnects immediately after the migration has begun:

  # virsh -c qemu+tls://remote/system list --all
   Id    Name                           State
  ----------------------------------------------------
  ...

  # timeout --signal KILL 1 \
      virsh migrate example qemu+tls://remote/system \
        --verbose --compressed --live --auto-converge \
        --abort-on-error --unsafe --persistent \
        --undefinesource --copy-storage-all --xml example.xml
  Killed

  # virsh -c qemu+tls://remote/system list --all
  error: failed to connect to the hypervisor
  error: unable to connect to server at 'remote:16514': Connection refused

The crash is in:

   1531 void
   1532 qemuDomainObjEndJob(virQEMUDriverPtr driver, virDomainObjPtr obj)
   1533 {
   1534     qemuDomainObjPrivatePtr priv = obj->privateData;
   1535     qemuDomainJob job = priv->job.active;
   1536
   1537     priv->jobs_queued--;

Backtrace:

  #0  at qemuDomainObjEndJob at qemu/qemu_domain.c:1537
  #1  in qemuDomainRemoveInactive at qemu/qemu_domain.c:2497
  #2  in qemuProcessAutoDestroy at qemu/qemu_process.c:5646
  #3  in virCloseCallbacksRun at util/virclosecallbacks.c:350
  #4  in qemuConnectClose at qemu/qemu_driver.c:1154
  ...

qemuDomainRemoveInactive calls virDomainObjListRemove, which in this
case is holding the last remaining reference to the domain.
qemuDomainRemoveInactive then calls qemuDomainObjEndJob, but the domain
object has been freed and poisoned by then.

This patch bumps the domain's refcount until qemuDomainRemoveInactive
has completed. We also ensure qemuProcessAutoDestroy does not return the
domain to virCloseCallbacksRun to be unlocked in this case. There is
similar logic in bhyveProcessAutoDestroy and lxcProcessAutoDestroy
(which call virDomainObjListRemove directly).

Signed-off-by: Michael Chapman <mike@very.puzzling.org>
(cherry picked from commit 7578cc17f5)
2015-04-28 11:09:47 -04:00
.gnulib@c27f1a356f
build-aux
daemon daemon: Clear fake domain def object that is used to check ACL prior to use 2015-04-27 19:54:54 -04:00
docs relaxng: allow : in /dev/disk/by-path names 2015-04-28 11:06:43 -04:00
examples
gnulib
include
m4
po Release of libvirt-1.2.13 2015-03-02 11:40:05 +08:00
src qemu: fix crash in qemuProcessAutoDestroy 2015-04-28 11:09:47 -04:00
tests relaxng: allow : in /dev/disk/by-path names 2015-04-28 11:06:43 -04:00
tools virsh: blockCopy: Add missing jump on error path 2015-04-28 11:07:03 -04:00
.ctags
.dir-locals.el
.gitignore
.gitmodules
.mailmap
AUTHORS.in
autobuild.sh
autogen.sh maint: improve usage of autogen's --no-git 2015-02-06 11:35:29 -07:00
bootstrap
bootstrap.conf
cfg.mk Make tests independant of system page size 2015-02-02 20:27:43 +00:00
ChangeLog-old
config-post.h
configure.ac configure: Report --with-loader-nvram value in summary 2015-04-27 20:22:57 -04:00
COPYING
COPYING.LESSER
HACKING
libvirt-lxc.pc.in
libvirt-qemu.pc.in
libvirt.pc.in
libvirt.spec.in spec: Point fedora --with-loader-nvram at nightly firmware repo 2015-04-27 20:23:02 -04:00
Makefile.am
Makefile.nonreentrant
mingw-libvirt.spec.in
README
README-hacking
run.in
TODO

         LibVirt : simple API for virtualization

  Libvirt is a C toolkit to interact with the virtualization capabilities
of recent versions of Linux (and other OSes). It is free software
available under the GNU Lesser General Public License. Virtualization of
the Linux Operating System means the ability to run multiple instances of
Operating Systems concurrently on a single hardware system where the basic
resources are driven by a Linux instance. The library aim at providing
long term stable C API initially for the Xen paravirtualization but
should be able to integrate other virtualization mechanisms if needed.

Daniel Veillard <veillard@redhat.com>