Bug 516543

Summary: qemu-kvm segfaults when run inside another virtual machine
Product: [Fedora] Fedora Reporter: Richard W.M. Jones <rjones>
Component: qemuAssignee: Richard W.M. Jones <rjones>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: rawhideCC: berrange, dwmw2, gcosta, itamar, jaswinder, markmc, virt-maint
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-08-21 08:56:36 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 498969    

Description Richard W.M. Jones 2009-08-10 11:35:06 UTC
Description of problem:

qemu-kvm segfaults when run from inside another virtual machine.
For example (from inside a KVM VM):

$ qemu-kvm -hda /dev/zero -nographic
open /dev/kvm: No such file or directory
Could not initialize KVM, will disable KVM support
Segmentation fault

The same command on baremetal does not segfault.

Version-Release number of selected component (if applicable):

qemu-system-x86-0.10.91-0.5.rc1.fc12.x86_64

How reproducible:

Always.

Steps to Reproduce:
1. Run qemu-kvm in a KVM or Xen VM.
2. Segfaults.
3.

Comment 1 Richard W.M. Jones 2009-08-10 11:36:23 UTC
This affects 'make check' in libguestfs, for example:
http://koji.fedoraproject.org/koji/getfile?taskID=1588660&name=build.log

Comment 2 Mark McLoughlin 2009-08-10 11:40:42 UTC
Could you get a stack trace?

Comment 3 Richard W.M. Jones 2009-08-10 11:41:18 UTC
Sure can ...

Program received signal SIGSEGV, Segmentation fault.
tb_gen_code (env=0x20b9860, pc=4294967280, cs_base=4294901760, flags=68, 
    cflags=<value optimized out>)
    at /usr/src/debug/qemu-kvm-0.11.0-rc1/exec.c:901
901	    tb->tc_ptr = tc_ptr;
Missing separate debuginfos, use: debuginfo-install dbus-libs-1.2.16-4.fc12.x86_64 libICE-1.0.4-9.fc12.x86_64 libSM-1.1.0-7.fc12.x86_64 libXau-1.0.4-7.fc12.x86_64 libXext-1.0.99.4-3.fc12.x86_64 libXi-1.2.99-10.20090805.fc12.x86_64 libXtst-1.0.99.1-3.fc12.x86_64 libasyncns-0.7-3.fc12.x86_64 libattr-2.4.43-4.fc12.x86_64 libcap-2.16-5.fc12.x86_64 libgcrypt-1.4.4-7.fc12.x86_64 libgpg-error-1.6-4.x86_64 libsndfile-1.0.20-2.fc12.x86_64 libtasn1-2.2-2.fc12.x86_64 libuuid-2.16-3.fc12.x86_64 libxcb-1.3-2.fc12.x86_64 nss-mdns-0.10-8.fc12.x86_64 nss-softokn-freebl-3.12.3.99.3-6.fc12.x86_64 tcp_wrappers-libs-7.6-56.fc12.x86_64
(gdb) bt
#0  tb_gen_code (env=0x20b9860, pc=4294967280, cs_base=4294901760, flags=68, 
    cflags=<value optimized out>)
    at /usr/src/debug/qemu-kvm-0.11.0-rc1/exec.c:901
#1  0x00000000004de106 in tb_find_slow (flags=<value optimized out>, 
    cs_base=<value optimized out>, pc=<value optimized out>)
    at /usr/src/debug/qemu-kvm-0.11.0-rc1/cpu-exec.c:168
#2  tb_find_fast (flags=<value optimized out>, cs_base=<value optimized out>, 
    pc=<value optimized out>)
    at /usr/src/debug/qemu-kvm-0.11.0-rc1/cpu-exec.c:189
#3  cpu_x86_exec (flags=<value optimized out>, cs_base=<value optimized out>, 
    pc=<value optimized out>)
    at /usr/src/debug/qemu-kvm-0.11.0-rc1/cpu-exec.c:614
#4  0x000000000040eea2 in qemu_cpu_exec (env=<value optimized out>)
    at /usr/src/debug/qemu-kvm-0.11.0-rc1/vl.c:4262
#5  tcg_cpu_exec (env=<value optimized out>)
    at /usr/src/debug/qemu-kvm-0.11.0-rc1/vl.c:4293
#6  main_loop (env=<value optimized out>)
    at /usr/src/debug/qemu-kvm-0.11.0-rc1/vl.c:4412
#7  main (env=<value optimized out>)
    at /usr/src/debug/qemu-kvm-0.11.0-rc1/vl.c:6271
(gdb) quit

Comment 4 Mark McLoughlin 2009-08-10 15:38:29 UTC
Lovely, a TCG bug

Should be easy enough to bisect ...

Comment 5 Richard W.M. Jones 2009-08-20 08:37:22 UTC
Just note that this still happens with 0.10.91-0.7.rc1

I will try to bisect it.

Comment 7 Richard W.M. Jones 2009-08-20 13:42:37 UTC
http://koji.fedoraproject.org/koji/taskinfo?taskID=1617421

Requested this be pushed into Fedora 12 Alpha:
https://fedorahosted.org/rel-eng/ticket/2132

Comment 8 Mark McLoughlin 2009-08-21 08:56:36 UTC
Alpha is finished, but the fix is in rawhide now