Bug 1016430

Summary: press 'Ctrl + |' will trigger the chardev socket for virtagent quit (core dumped)
Product: Red Hat Enterprise Linux 6 Reporter: Sibiao Luo <sluo>
Component: ncAssignee: Petr Šabata <psabata>
Status: CLOSED NOTABUG QA Contact: BaseOS QE Security Team <qe-baseos-security>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.5CC: acathrow, bsarathy, chayang, flang, jcody, juzhang, michen, mkenneth, qzhang, virt-maint, xfu
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-10-31 07:22:46 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Sibiao Luo 2013-10-08 07:32:28 UTC
Description of problem:
met this quit (core dumped) by chance that when start guest with virtio serial and start guest agent inside guest, then connect the chardev socket in host side for sending commands to guest and press 'Ctrl |' keyboard will trigger the chardev socket for virtagent quit (core dumped).

Version-Release number of selected component (if applicable):
host info:
2.6.32-420.el6.x86_64
qemu-kvm-0.12.1.2-2.410.el6.x86_64
nc-1.84-22.el6.x86_64
guest info:
2.6.32-420.el6.x86_64
qemu-guest-agent-0.12.1.2-2.410.el6.x86_64

How reproducible:


Steps to Reproduce:
1.start guest with virtio serial and start guest agent inside guest.
e.g:...-chardev socket,path=/tmp/qga.sock,server,nowait,id=qga0 -device virtio-serial -device virtserialport,chardev=qga0,name=org.qemu.guest_agent.0
2.connect the chardev socket in host side for sending commands to guest.
# service qemu-ga restart
Stopping qemu-ga:                                          [  OK  ]
Starting qemu-ga:                                          [  OK  ]
# service qemu-ga status
qemu-ga (pid  2576) is running...
3.press \ and 'Ctrl |' keyboard.
# nc -U /tmp/qga.sock readline
\                            <----------press '\'
{"error": {"class": "JSONParsing", "desc": "Invalid JSON syntax", "data": {}}}
^\Quit (core dumped)         <----------press '|'

Actual results:
after step 3, the chardev socket for virtagent quit (core dumped), bt log as following:
Core was generated by `nc -U /tmp/qga.sock readline'.
Program terminated with signal 3, Quit.
#0  0x00000034012df2d8 in poll () from /lib64/libc.so.6
Missing separate debuginfos, use: debuginfo-install glib2-2.26.1-3.el6.x86_64 glibc-2.12-1.130.el6.x86_64
(gdb) bt
#0  0x00000034012df2d8 in poll () from /lib64/libc.so.6
#1  0x0000000000401ae9 in readwrite (nfd=3) at netcat.c:712
#2  0x000000000040302c in main (argc=<value optimized out>, argv=<value optimized out>) at netcat.c:366
(gdb) bt full
#0  0x00000034012df2d8 in poll () from /lib64/libc.so.6
No symbol table info available.
#1  0x0000000000401ae9 in readwrite (nfd=3) at netcat.c:712
        pfd = {{fd = 3, events = 1, revents = 0}, {fd = 0, events = 1, revents = 0}}
        buf = 
    '\000' <repeats 16120 times>"\352, R#\001\064", '\000' <repeats 11 times>, "\004\000\000\000\000\000\000\000\300\016Y\001\064\000\000\000\004\000\000\000\000\000\000\000\030\000\000\000\000\000\000\000\000O>\257\377\177\000\000\260N>\257\377\177\000\000\235\343,\001\064", '\000' <repeats 11 times>"\330, =@\000\000\000\000\000\000\000\000\000\001", '\000' <repeats 11 times>, "\001", '\000' <repeats 15 times>, "H\222>\257\377\177", '\000' <repeats 18 times>, "\003", '\000' <repeats 15 times>, "+$@\000\000\000\000\000\001\000/tmp/qga.sock", '\000' <repeats 80 times>
        n = <value optimized out>
        wfd = <value optimized out>
        lfd = <value optimized out>
        plen = <value optimized out>
#2  0x000000000040302c in main (argc=<value optimized out>, argv=<value optimized out>) at netcat.c:366
        ch = <value optimized out>
        s = 3
        ret = 0
        socksv = 5
        host = 0x7fffaf3e9877 "/tmp/qga.sock"
        uport = <value optimized out>
        endp = 0x0
        hints = {ai_flags = 0, ai_family = 0, ai_socktype = 0, ai_protocol = 0, ai_addrlen = 0, ai_addr = 0x0, 
          ai_canonname = 0x0, ai_next = 0x0}
        sv = 0x0
        len = <value optimized out>
        cliaddr = {ss_family = 37150, __ss_align = 223357765255, __ss_padding = 
    "v", '\000' <repeats 23 times>"\377, \262\360\000\000\000\000\000\302\000\000\000\000\000\000\000\036\221>\257\377\177\000\000\037\221>\257\377\177\000\000\001", '\000' <repeats 15 times>"\355, \b)\001\064", '\000' <repeats 11 times>, "\020\070@", '\000' <repeats 13 times>, "\003\020@\000\000\000\000"}
        proxy = <value optimized out>
        proxyhost = <value optimized out>
        proxyport = <value optimized out>
        proxyhints = {ai_flags = 0, ai_family = 0, ai_socktype = 0, ai_protocol = 0, ai_addrlen = 0, ai_addr = 0x0, 
          ai_canonname = 0x0, ai_next = 0x0}
(gdb)

Expected results:
it should not quit and no any core dump, it should give a prompt message instead, like: {"error": {"class": "JSONParsing", "desc": "Invalid JSON syntax", "data": {}}}

Additional info:

Comment 1 Sibiao Luo 2013-10-08 08:27:41 UTC
My qemu-kvm command line:
# /usr/libexec/qemu-kvm -M pc -S -cpu SandyBridge -enable-kvm -m 2048 -smp 2,sockets=2,cores=1,threads=1 -no-kvm-pit-reinjection -usb -device usb-tablet,id=input0 -name sluo -uuid 990ea161-6b67-47b2-b803-19fb01d30d30 -rtc base=localtime,clock=host,driftfix=slew -drive file=/home/Qemu-ga-RHEL-Server-6.5-64bit.qcow2,if=none,id=drive-virtio-disk,format=qcow2,cache=none,aio=native,werror=stop,rerror=stop -device virtio-blk-pci,vectors=0,bus=pci.0,addr=0x4,scsi=off,drive=drive-virtio-disk,id=virtio-disk,bootindex=1 -netdev tap,id=hostnet0,vhost=on,script=/etc/qemu-ifup -device virtio-net-pci,netdev=hostnet0,id=virtio-net-pci0,mac=2C:41:38:B6:40:21,bus=pci.0,addr=0x5 -device virtio-balloon-pci,id=ballooning,bus=pci.0,addr=0x6 -global PIIX4_PM.disable_s3=0 -global PIIX4_PM.disable_s4=0 -k en-us -boot menu=on -qmp tcp:0:4444,server,nowait -serial unix:/tmp/ttyS0,server,nowait -vnc :1 -spice disable-ticketing,port=5931 -monitor stdio -chardev socket,path=/tmp/qga.sock,server,nowait,id=qga0 -device virtio-serial -device virtserialport,chardev=qga0,name=org.qemu.guest_agent.0

Comment 2 RHEL Program Management 2013-10-13 23:02:52 UTC
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated
in the current release, Red Hat is unable to address this
request at this time.

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

Comment 3 Petr Šabata 2013-10-14 03:31:41 UTC
This looks like you're sending SIGQUIT to the process and the behavior is thus valid.

Comment 4 Petr Šabata 2013-10-31 07:22:46 UTC
Closing as NOTABUG.