Bug 694378

Summary: Core dump occurs when ballooning memory to 0
Product: Red Hat Enterprise Linux 6 Reporter: Mike Cao <bcao>
Component: qemu-kvmAssignee: Amit Shah <amit.shah>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: high    
Version: 6.2CC: bcao, ehabkost, juzhang, michen, mkenneth, rhod, virt-maint, xfu
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: qemu-kvm-0.12.1.2-2.179.el6 Doc Type: Bug Fix
Doc Text:
Invalid balloon values, like 0, used to crash QEMU. The fix is to validate input. After the fix, QEMU doesn't crash on invalid input.
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-12-06 15:51:50 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:

Description Mike Cao 2011-04-07 07:28:36 UTC
Description of problem:


Version-Release number of selected component (if applicable):
# uname -r
2.6.32-128.el6.x86_64
# rpm -q qemu-kvm
qemu-kvm-0.12.1.2-2.156.el6.x86_64


How reproducible:
100%

Steps to Reproduce:
1.start VM with -m 4G -device virtio-balloon-pci,id=balloon0
2.after guest booing up ,in the qemu-monitor (qemu)balloon 0

  
Actual results:
qemu-kvm quit with core dump

Expected results:
no core dump occurs ,better prompts it is not allowed in qemu-monitor

Additional info:
(gdb)bt
#0  monitor_resume (mon=0x0) at /usr/src/debug/qemu-kvm-0.12.1.2/monitor.c:4955
#1  0x0000000000411927 in user_monitor_complete (opaque=0x2543750, 
    ret_data=<value optimized out>)
    at /usr/src/debug/qemu-kvm-0.12.1.2/monitor.c:622
#2  0x0000000000412e25 in do_balloon (mon=<value optimized out>, 
    params=0x310dee0, cb=0x411910 <user_monitor_complete>, opaque=0x2543750)
    at /usr/src/debug/qemu-kvm-0.12.1.2/monitor.c:2684
#3  0x0000000000418ffa in user_async_cmd_handler (mon=0x13fc280, 
    cmdline=<value optimized out>)
    at /usr/src/debug/qemu-kvm-0.12.1.2/monitor.c:651
#4  handle_user_command (mon=0x13fc280, cmdline=<value optimized out>)
    at /usr/src/debug/qemu-kvm-0.12.1.2/monitor.c:4384
#5  0x000000000041907a in monitor_command_cb (mon=0x13fc280, 
    cmdline=<value optimized out>, opaque=<value optimized out>)
    at /usr/src/debug/qemu-kvm-0.12.1.2/monitor.c:4941
#6  0x00000000004a49ab in readline_handle_byte (rs=0x28560f0, 
    ch=<value optimized out>) at readline.c:369
#7  0x000000000041929c in monitor_read (opaque=<value optimized out>, 
    buf=0x7fffe79d9200 "\r", size=1)
    at /usr/src/debug/qemu-kvm-0.12.1.2/monitor.c:4927
#8  0x00000000004bd5cb in qemu_chr_read (opaque=0x11d9790) at qemu-char.c:171
#9  fd_chr_read (opaque=0x11d9790) at qemu-char.c:661
#10 0x000000000040ba2f in main_loop_wait (timeout=1000)
    at /usr/src/debug/qemu-kvm-0.12.1.2/vl.c:4428
#11 0x000000000042b4fa in kvm_main_loop ()
    at /usr/src/debug/qemu-kvm-0.12.1.2/qemu-kvm.c:2164
#12 0x000000000040ef35 in main_loop (argc=<value optimized out>, 
    argv=<value optimized out>, envp=<value optimized out>)
    at /usr/src/debug/qemu-kvm-0.12.1.2/vl.c:4638
#13 main (argc=<value optimized out>, argv=<value optimized out>, 
    envp=<value optimized out>) at /usr/src/debug/qemu-kvm-0.12.1.2/vl.c:6843

Comment 2 RHEL Program Management 2011-04-07 07:43:43 UTC
Since RHEL 6.1 External Beta has begun, and this bug remains
unresolved, it has been rejected as it is not proposed as
exception or blocker.

Red Hat invites you to ask your support representative to
propose this request, if appropriate and relevant, in the
next release of Red Hat Enterprise Linux.

Comment 4 Vadim Rozenfeld 2011-06-02 15:15:39 UTC
Hello Mike,

I have two questions:
 - who is the guest, 
 - what is the entire command line?

Best regards,
Vadim.

Comment 5 Mike Cao 2011-06-03 02:54:51 UTC
(In reply to comment #4)
> Hello Mike,
> 
> I have two questions:
>  - who is the guest,
RHEL5.7 64 bit guest 
I think all the linux guest with -device virtio-balloon-pci,id=balloon0  will hit the issue

>  - what is the entire command line?
/usr/libexec/qemu-kvm -M rhel6.1.0 -enable-kvm -m 512 -smp 1,sockets=1,cores=1,threads=1 -name RHEL5u7 -uuid d1356948-d6b2-c328-75c0-5746606f5f34 -rtc base=utc -boot c -drive file=/home/RHEL-Server-5.7-64-virtio.qcow2,if=none,id=drive-virtio-disk0,format=qcow2,cache=none,aio=threads -device virtio-blk-pci,drive=drive-virtio-disk0,id=virtio-disk0 -netdev tap,id=hostnet0,vhost=on -device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:62:64:55 -chardev pty,id=charserial0 -device isa-serial,chardev=charserial0,id=serial0 -usb -vnc 0:0 -vga cirrus -device virtio-balloon-pci,id=balloon0 -monitor stdio

> 
> Best regards,
> Vadim.

Comment 6 Vadim Rozenfeld 2011-06-03 17:08:11 UTC
(In reply to comment #5)
> (In reply to comment #4)
> > Hello Mike,
> > 
> > I have two questions:
> >  - who is the guest,
> RHEL5.7 64 bit guest 
> I think all the linux guest with -device virtio-balloon-pci,id=balloon0  will
> hit the issue
> 
Will check it.
Thank you,
Vadim.

Comment 7 Amit Shah 2011-07-20 08:48:22 UTC
Patches posted upstream.

Comment 12 FuXiangChun 2011-08-18 07:56:09 UTC
reproduce on qemu-kvm-0.12.1.2-2.159.el6.x86_64
verify on qemu-kvm-0.12.1.2-2.182.el6.x86_64

steps to reproduce
1. /usr/libexec/qemu-kvm -enable-kvm -m 6G -smp 4 -name rhel6 -uuid ddcbfb49-3411-1701-3c36-6bdbc00bedb9 -rtc base=utc,clock=host,driftfix=slew -boot c -drive file=/dev/migrate/data3,if=none,id=drive-ide0-0-0,boot=on,format=qcow2,cache=none -device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,physical_block_size=4096,logical_block_size=4096 -netdev tap,id=hostnet0 -device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:50:a4:c2:c2 -chardev pty,id=serial0 -device isa-serial,chardev=serial0 -usb -device usb-tablet,id=input0 -spice id=on,disable-ticketing,port=5912 -monitor stdio -device virtio-balloon-pci,id=balloon0

2. (qemu) balloon 0

actual results:
on qemu-kvm-0.12.1.2-2.159.el6.x86_64
(qemu) balloon 0
*** glibc detected *** /usr/libexec/qemu-kvm: corrupted double-linked list: 0x000000000312f0b0 ***

on qemu-kvm-0.12.1.2-2.182.el6.x86_64
(qemu) balloon 0
Parameter 'target' expects a size and guest work well

Based on above ,this issue has been fixed.

Comment 13 juzhang 2011-08-29 06:22:11 UTC
> 2. (qemu) balloon 0
> 
> actual results:
> on qemu-kvm-0.12.1.2-2.159.el6.x86_64
> (qemu) balloon 0
> *** glibc detected *** /usr/libexec/qemu-kvm: corrupted double-linked list:
> 0x000000000312f0b0 ***
> 
> on qemu-kvm-0.12.1.2-2.182.el6.x86_64
> (qemu) balloon 0
> Parameter 'target' expects a size and guest work well
> 
> Based on above ,this issue has been fixed.

Also tried "negative number" and supper max number.

result:
Parameter 'target' expects a size

Comment 15 Amit Shah 2011-11-18 06:50:01 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
Invalid balloon values, like 0, used to crash QEMU.  The fix is to validate input.  After the fix, QEMU doesn't crash on invalid input.

Comment 16 errata-xmlrpc 2011-12-06 15:51:50 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHSA-2011-1531.html