]> git.ipfire.org Git - thirdparty/libvirt.git/commit
Fix race in starting transient VMs
authorDaniel P. Berrange <berrange@redhat.com>
Thu, 31 Oct 2013 18:37:37 +0000 (18:37 +0000)
committerDaniel P. Berrange <berrange@redhat.com>
Fri, 1 Nov 2013 11:10:25 +0000 (11:10 +0000)
commit89759301dea870ee80f2ca74751db589e8f7b593
tree39890f04a0b061c5a3db9db9b50ce546c433d8b3
parent3e1e16aa8d4238241a1806cb9bdb3b9ad60db777
Fix race in starting transient VMs

When starting a transient VM the first thing done is to check
for duplicates. The check looks if there are any running VMs
with the matching name/uuid. It explicitly allows there to
be inactive VMs, so that a persistent VM can be temporarily
booted with a different config.

There is a race condition, however, where 2 or more clients
try to create the same transient VM. The first client will
cause a virDomainObjPtr to be added to the domain list, and
it is inactive at this stage. The second client may then
come along and see this inactive VM, and mistake it for a
persistent VM.

If the first VM fails to start its transient guest for any
reason, then it'll remove the virDomainObjPtr from the list.
The second client now has a virDomainObjPtr that it can try
to boot, which libvirt no longer has a record of. The result
can be a running QEMU process that is orphaned.

It was also, however, possible for the virDomainObjPtr to be
completely free'd which will cause libvirtd to crash in some
scenarios.

The fix is to only allow an existing inactive VM if it is
marked as persistent.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
src/conf/domain_conf.c