Bug 1402666

Summary: [virtio-win][qemu-ga-win]negtive testing: executing "guest-sync-delimited" cmd with invalid id will block the following cmd's normal output.
Product: Red Hat Enterprise Linux 7 Reporter: xiagao
Component: qemu-guest-agentAssignee: Sameeh Jubran <sjubran>
Status: CLOSED NOTABUG QA Contact: FuXiangChun <xfu>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.4CC: chayang, juzhang, knoel, lijin, michen, phou, wyu, xfu, yvugenfi
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-08-20 09:40:24 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:
Bug Depends On:    
Bug Blocks: 1473046    

Description xiagao 2016-12-08 05:13:38 UTC
Description of problem:
negtive testing: executing "guest-sync-delimited" cmd with invalid id will block the following cmd output.

Version-Release number of selected component (if applicable):
host:
qemu-kvm-rhev-2.6.0-27.el7.x86_64

guest:
win2012-64
virtio-win-1.9.0-3.el7.src.rpm
qemu-ga-win-7.3.2-1


How reproducible:
100%

Steps to Reproduce:
1.Boot guest with virtio serial and install/start guest agent.
/usr/libexec/qemu-kvm -S -name avocado-vt-vm1 -nodefaults -vga std -m 3G -smp 4 -drive file=50fee0e6-9b31-4dd0-bd33-6ce8e0a3ef77,if=none,id=drive-ide0-0-0,format=raw,cache=none -device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=0 -vnc :8 -rtc base=localtime,clock=host,driftfix=slew -boot order=cd,menu=on -enable-kvm -monitor stdio -qmp tcp:0:1238,server,nowait -device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x7 -chardev socket,path=/tmp/qga.sock,server,nowait,id=qga0 -device virtserialport,bus=virtio-serial0.0,chardev=qga0,name=org.qemu.guest_agent.0 -netdev tap,id=hostnet0,vhost=on -device virtio-net-pci,netdev=hostnet0,id=net0,mac=00:1a:4a:16:01:56,bus=pci.0,addr=0x3 -drive file=/usr/share/virtio-win/virtio-win-1.9.0.iso,if=none,readonly=on,media=cdrom,format=raw,id=cdrom2 -device ide-drive,drive=cdrom2,bus=ide.1,unit=0,id=ide-cd2

2.Install vioser driver and qemu-ga-x64.msi in guest

3.Connect the chardev socket in host side for sending commands to guest:
# nc -U /tmp/qga.sock
{"execute":"guest-ping"}
{"return": {}}

4. Send "guest-sync-delimited" command in the host side,but with invalid id:
{ "execute": "guest-sync-delimited", "arguments": { "id": 12:"> } }

5. Send "guet-ping" and other correct cmd

6. Close the chardev socket and reconnet the socket, and then repeate step 5

7. Restart ***Qemu Guest Agent service*** in guest,and then repeate step 5


Actual results:
after step 4,
{ "execute": "guest-sync-delimited", "arguments": { "id": 12:"> } }

after step 5,
{"execute":"guest-ping"}
{"error": {"desc": "Invalid JSON syntax"}}
{"error": {"desc": "JSON parse error, invalid keyword `execute'"}}
{"error": {"desc": "Invalid JSON syntax"}}
{"error": {"desc": "JSON parse error, invalid keyword `guest'"}}
{"error": {"desc": "Invalid JSON syntax"}}
{"error": {"desc": "JSON parse error, invalid keyword `ing'"}}
{"error": {"desc": "JSON parse error, invalid keyword `ing'"}}

{ "execute": "guest-sync-delimited", "arguments": { "id": 123456 } }
{"error": {"desc": "Invalid JSON syntax"}}
{"error": {"desc": "JSON parse error, invalid keyword `execute'"}}
{"error": {"desc": "Invalid JSON syntax"}}
{"error": {"desc": "JSON parse error, invalid keyword `guest'"}}
{"error": {"desc": "Invalid JSON syntax"}}
{"error": {"desc": "JSON parse error, invalid keyword `ync'"}}
{"error": {"desc": "Invalid JSON syntax"}}
{"error": {"desc": "JSON parse error, invalid keyword `elimited'"}}
{"error": {"desc": "Invalid JSON syntax"}}
{"error": {"desc": "JSON parse error, invalid keyword `arguments'"}}
{"error": {"desc": "Invalid JSON syntax"}}
{"error": {"desc": "JSON parse error, invalid keyword `id'"}}

after step 6,
# nc -U /tmp/qga.sock
{"execute":"guest-ping"}
{"error": {"desc": "Invalid JSON syntax"}}
{"error": {"desc": "JSON parse error, invalid keyword `execute'"}}
{"error": {"desc": "Invalid JSON syntax"}}
{"error": {"desc": "JSON parse error, invalid keyword `guest'"}}
{"error": {"desc": "Invalid JSON syntax"}}
{"error": {"desc": "JSON parse error, invalid keyword `ing'"}}

afer step 7,
{"execute":"guest-ping"}
{"return": {}}

Expected results:
When do negtive test, should not block the normal following cmd output.



Additional info:

Comment 3 Sameeh Jubran 2017-08-14 08:24:21 UTC
To sum this up and close this BZ:
This is not a bug, this input is not a valid json string, as it has an uneven number of double quotation marks.

Comment 4 Sameeh Jubran 2017-08-20 09:40:24 UTC
As I have explained in the previous comment, this is not a bug but an illegal input.