Bug 1119207

Summary: [rng]qemu-kvm process still can start when specify negative value for max-bytes
Product: Red Hat Enterprise Linux 6 Reporter: Mike Cao <bcao>
Component: qemu-kvmAssignee: John Snow <jsnow>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.6CC: areis, bsarathy, chayang, juzhang, michen, mkenneth, qzhang, rbalakri, shu, virt-maint
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: qemu-kvm-0.12.1.2-2.436.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-10-14 07:02:37 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 Mike Cao 2014-07-14 09:24:58 UTC
Description of problem:


Version-Release number of selected component (if applicable):
2.6.32-478.el6.x86_64
qemu-kvm-0.12.1.2-2.430.el6.x86_64


How reproducible:
100%

Steps to Reproduce:
1.Start VM with -max-byte=-1
CLI:# /usr/libexec/qemu-kvm -name 086RNGBLUE64NQB -enable-kvm -m 6G -smp 4 -uuid d58093ff-d9da-4f75-a648-922e78eac32f -nodefconfig -nodefaults -chardev socket,id=charmonitor,path=/tmp/086RNGBLUE64NQB,server,nowait -mon chardev=charmonitor,id=monitor1,mode=control -rtc base=localtime,driftfix=slew -boot order=cd,menu=on -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 -drive file=086RNGBLUE64NQB,if=none,id=drive-ide0-0-0,format=raw,serial=mike_cao,cache=none -device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 -drive file=en_windows_8_1_enterprise_x64_dvd_2971902.iso,if=none,media=cdrom,id=drive-ide0-1-0,readonly=on,format=raw -device ide-drive,bus=ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0 -drive file=086RNGBLUE64NQB.vfd,if=none,id=drive-fdc0-0-0,format=raw,cache=none -global isa-fdc.driveA=drive-fdc0-0-0 -netdev tap,script=/etc/qemu-ifup,downscript=no,id=hostnet0 -device rtl8139,netdev=hostnet0,id=net0,mac=00:52:42:0f:05:69,bus=pci.0,addr=0x3 -chardev pty,id=charserial0 -device isa-serial,chardev=charserial0,id=isa_serial0 -device usb-tablet,id=input0 -vnc 0.0.0.0:0 -vga cirrus -object rng-random,filename=/dev/urandom,id=rng0 -device virtio-rng-pci,rng=rng0,id=device-rng0,max-bytes=-100,period=1 -monitor stdio
2.(qemu)info qtree  (so such commands on qmp)


Actual results:
      dev: virtio-rng-pci, id "device-rng0"
        dev-prop: indirect_desc = on
        dev-prop: event_idx = on
        dev-prop: rng = "rng0"
        dev-prop: max-bytes = 18446744073709551516


Expected results:
   qemu-kvm process shouldn't boot up 

Additional info:
specify negative number for period eg period=-1 ,qemu-kvm can not start

Comment 2 Ademar Reis 2014-07-14 21:53:25 UTC
and upstream apparently crashes with assert(vrng->conf.max_bytes <= (9223372036854775807L))

Feel free to fix it upstream and close this as WONTFIX for RHEL6.

Comment 3 John Snow 2014-07-15 16:13:17 UTC
Submitted upstream, but awaiting merge. http://lists.gnu.org/archive/html/qemu-devel/2014-07/msg02348.html

Comment 4 John Snow 2014-07-23 20:29:01 UTC
Accepted upstream http://git.qemu.org/?p=qemu.git;a=commit;h=713e8a102222b6b8ca65050d13b287f5705831b0

backported and posted to rhvirt-patches.

Comment 5 John Snow 2014-07-29 17:35:20 UTC
Fixing another issue upstream first before resubmitting.

Comment 8 Jeff Nelson 2014-08-07 19:49:42 UTC
Fix included in qemu-kvm-0.12.1.2-2.436.el6

Comment 10 Shaolong Hu 2014-08-14 06:31:09 UTC
Reproduced on qemu-kvm-0.12.1.2-2.435.el6.x86_64:

boot guest with:
-device virtio-rng-pci,rng=rng0,id=device-rng0,max-bytes=-100,period=1

(qemu) info qtree
bus: main-system-bus
  type System
  dev: i440FX-pcihost, id ""
    bus: pci.0
      type PCI
      dev: virtio-rng-pci, id "device-rng0"
        dev-prop: indirect_desc = on
        dev-prop: event_idx = on
        dev-prop: rng = "rng0"
        dev-prop: max-bytes = 18446744073709551516
        dev-prop: period = 1
        bus-prop: addr = 06.0
        bus-prop: romfile = <null>
        bus-prop: rombar = 1
        bus-prop: multifunction = off
        class Class 00ff, addr 00:06.0, pci id 1af4:1005 (sub 1af4:0004)
        bar 0: i/o at 0xc100 [0xc11f]


Verified on qemu-kvm-0.12.1.2-2.436.el6.x86_64:

boot guest with:
-device virtio-rng-pci,rng=rng0,id=device-rng0,max-bytes=-100,period=1

qemu-kvm prompts error and exits:

qemu-kvm: -device virtio-rng-pci,rng=rng0,id=device-rng0,max-bytes=-100,period=1: Parameter 'max-bytes' expects a non-negative integer below 2^63
qemu-kvm: -device virtio-rng-pci,rng=rng0,id=device-rng0,max-bytes=-100,period=1: Device 'virtio-rng-pci' could not be initialized

Comment 11 errata-xmlrpc 2014-10-14 07:02:37 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/RHBA-2014-1490.html