Red Hat Bugzilla – Bug 479203
SEGFAULT during KVM guest creation when machine attribute not defined
Last modified: 2010-03-16 13:17:17 EDT
Description of problem:
A SEGFAULT is raised when starting a 32-bit KVM guest on a host that has KVM installed (but not qemu).
Version-Release number of selected component (if applicable):
linux : v2.6.28-rc7-275-g4e6f2ba
How reproducible: Very
Steps to Reproduce:
1.Install kvm-userspace without installing qemu. Run libvirtd. 'virsh -c qemu:///system capabilities' should yield something like this:
<acpi default='on' toggle='yes'/>
<apic default='on' toggle='no'/>
2.Create a definition for a kvm guest (32 bit Windows XP in this case) with a 'type' element of <type arch="i686">hvm</type>. Example:
<disk type='file' device='disk'>
<target dev='hda' bus='ide'/>
<disk type='file' device='cdrom'>
<target dev='hdb' bus='ide'/>
<graphics type='vnc' port='-1'/>
<input type='tablet' bus='usb'/>
3.run 'virsh -c qemu:///system start john-doe-2'
Libvirtd will exit with a SEGFAULT
Libvirtd should start the defined domain
The actual SEGFAULT is the result of a strdup at qemu_conf.c:777
vm-def->os.machine is NULL. It was not defined in the xml definition (because I did it by hand), and the arch of the guest did not match the arch of any capabilites in virCapabilitiesDefaultGuestMachine (capabilities.c:465)
because the guest's arch is i686, so a default value was not given. qemudCapsInitGuest (qemu_conf.c:206) does not add the arch i686 capability because /usrb/bin/qemu does not exist, and because the host is not an i686.
The SEGFAULT would not happen in any of the following conditions:
2)the arch attribute of the guest had been set to "x86_64"
3)the machine attribute of the guest had been set
I realize the SEGFAULT was created because of user error (The arch of the guest should have been "x86_64"), but it would probably be optimal if a bad configuration file didn't result in a SEGFAULT.
Patch sent upstream
This was included in 0.6.0 release, so it no long crashes