Bug 1074403

Summary: qemu-kvm can not give any warning hint when set sndbuf with negative value
Product: Red Hat Enterprise Linux 7 Reporter: Jun Li <juli>
Component: qemu-kvmAssignee: Amos Kong <akong>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: low Docs Contact:
Priority: low    
Version: 7.0CC: ailan, flang, hhuang, juzhang, knoel, michen, qiguo, rbalakri, virt-maint, xfu
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: qemu-kvm-1.5.3-68.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-03-05 08:04:51 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:
Embargoed:

Description Jun Li 2014-03-10 06:23:44 UTC
Description of problem:
qemu-kvm can not give any warning hint when set sndbuf with negative value.
But when set sndbuf with other illegal value(such as: -abc), qemu-kvm will give a friendly hint.

Version-Release number of selected component (if applicable):
qemu-kvm-rhev-1.5.3-50.el7.x86_64
3.10.0-99.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1.boot guest with following cli:
# /usr/libexec/qemu-kvm -M pc -m 4G -smp 4 -vnc :1 -monitor stdio -drive file=/home/juli/win2012r2-64.qcow2,if=none,id=sys,cache=none -device virtio-scsi-pci,id=scsi0 -device scsi-hd,id=dev-sys,drive=sys,bus=scsi0.0 -netdev tap,id=tap1,queues=3,vhost=off,vhostforce=off,script=/etc/qemu-ifup,sndbuf=-123456789 -device virtio-net-pci,netdev=tap1,id=net1,mq=on,mac=00:15:17:6c:c7:11,status=on
2.
3.

Actual results:
After step1, qemu-kvm will boot up as normal.

Expected results:
qemu-kvm will give some warning hint. As
# /usr/libexec/qemu-kvm -M pc -m 4G -smp 4 -vnc :1 -monitor stdio -drive file=/home/juli/win2012r2-64.qcow2,if=none,id=sys,cache=none -device virtio-scsi-pci,id=scsi0 -device scsi-hd,id=dev-sys,drive=sys,bus=scsi0.0 -netdev tap,id=tap1,queues=3,vhost=off,vhostforce=off,script=/etc/qemu-ifup,sndbuf=-abc -device virtio-net-pci,netdev=tap1,id=net1,mq=on,mac=00:15:17:6c:c7:11,status=on 
qemu-kvm: -netdev tap,id=tap1,queues=3,vhost=off,vhostforce=off,script=/etc/qemu-ifup,sndbuf=-abc: Parameter 'sndbuf' expects a size value representible as a non-negative int64

Additional info:

Comment 2 Amos Kong 2014-04-27 14:12:52 UTC
We use default sndbuf (INT_MAX) if user assigns an invalid sndbuf. I posted a patch to upstream to add error note in this case.

http://marc.info/?l=qemu-devel&m=139860777404195&w=3

# qemu ... -netdev tap,id=h0,queues=1,sndbuf=2147483648
qemu-system-x86_64: -netdev tap,id=h0,queues=1,sndbuf=2147483648: given sndbuf isn't an integer, or it's larger than INT_MAX(2147483647). use default sndbuf(2147483647)

# qemu ... -netdev tap,id=h0,queues=1,sndbuf=-1234
qemu-system-x86_64: -netdev tap,id=h0,queues=1,sndbuf=-1234: given sndbuf isn't an integer, or it's larger than INT_MAX(2147483647). use default sndbuf(2147483647)

Comment 3 Amos Kong 2014-07-06 12:50:19 UTC
This patch resolved this issue, need backport

commit cb45de6798956975c4b13a6233f7a00d2239b61a
Author: Amos Kong <akong>
Date:   Mon Apr 28 13:53:49 2014 +0800

    qapi: treat all negative return of strtosz_suffix() as error
    
    strtosz_suffix() might return negative error, this patch fixes
    the error handling.
    
    This patch also changes to handle error in the if statement
    rather than handle success specially, this will make this use
    of strtosz_suffix consistent with all other uses.
    
    Signed-off-by: Amos Kong <akong>
    Reviewed-by: Michael S. Tsirkin <mst>
    Signed-off-by: Luiz Capitulino <lcapitulino>

Comment 5 Miroslav Rezanina 2014-08-15 07:29:01 UTC
Fix included in qemu-kvm-1.5.3-68.el7

Comment 7 langfang 2014-09-05 07:10:48 UTC
Reproduce this bug as follow version:
Host
# uname -r
3.10.0-144.el7.x86_64
# rpm -q qemu-kvm-rhev
qemu-kvm-rhev-1.5.3-30.el7.x86_64

Steps

1.Boot guest
...
-netdev tap,id=tap1,queues=3,vhost=off,vhostforce=off,script=/etc/qemu-ifup,sndbuf=-11111 -device virtio-net-pci,netdev=tap1,id=net1,mq=on,mac=00:15:17:6c:c7:11,status=on...

Results:
guest boot up


*Verify this bug as follow version: Intel machine&qemu-kvm-rhev 

Host:
# uname -r
3.10.0-144.el7.x86_64
# rpm -q qemu-kvm-rhev
qemu-kvm-rhev-2.1.0-3.el7.x86_64


Results:
...qemu-kvm: -netdev tap,id=tap1,queues=3,vhost=off,vhostforce=off,script=/etc/qemu-ifup,sndbuf=-11111: Parameter 'sndbuf' expects a size value representible as a non-negative int64...

*Verify this bug on AMD &qemu-kvm version:
# uname -r
3.10.0-147.el7.x86_64
# rpm -q qemu-kvm
qemu-kvm-1.5.3-69.el7.x86_64


qemu-kvm: -netdev tap,id=tap1,queues=3,vhost=off,vhostforce=off,script=/etc/qemu-ifup,sndbuf=-22222222222222222: Parameter 'sndbuf' expects a size value representible as a non-negative int64


Addtional info

also tried other parameters,work well

According to above test ,this bug has been fixed.

Comment 8 langfang 2014-10-10 07:12:04 UTC
Also tried as follow version:
Host:Intel
# uname -r
3.10.0-171.el7.x86_64
# rpm -q qemu-kvm-rhev
qemu-kvm-rhev-2.1.2-1.el7.x86_64

Results:
qemu-kvm: -netdev tap,id=tap1,queues=3,vhost=off,vhostforce=off,script=/etc/qemu-ifup,sndbuf=-abc: Parameter 'sndbuf' expects a size value representible as  a non-negative int64


According to comment7 and comment8,this bug has been fixed.

Comment 11 errata-xmlrpc 2015-03-05 08:04:51 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.

https://rhn.redhat.com/errata/RHSA-2015-0349.html