Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1007664

Summary: real rng device(QNG PQ4000KU) can not work properly in guest
Product: Red Hat Enterprise Linux 7 Reporter: Xu Han <xuhan>
Component: qemu-kvmAssignee: Amos Kong <akong>
Status: CLOSED NOTABUG QA Contact: Virtualization Bugs <virt-bugs>
Severity: high Docs Contact:
Priority: urgent    
Version: 7.0CC: acathrow, ailan, akong, amit.shah, herrold, juzhang, mazhang, michen, virt-maint, xfu
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1008263 (view as bug list) Environment:
Last Closed: 2013-09-13 09:41:41 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:
Bug Depends On:    
Bug Blocks: 1008263    
Attachments:
Description Flags
Read random data from rng device by libqwqng API (data will be sent to remote socket) none

Description Xu Han 2013-09-13 05:03:06 UTC
Description of problem:
real rng device(QNG PQ4000KU) can not work properly in guest

Version-Release number of selected component (if applicable):
kernel: 3.10.0-18.el7.x86_64
qemu: qemu-kvm-1.5.3-2.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1.boot guest
#/usr/libexec/qemu-kvm ...\
-object rng-random,filename=/dev/ttyUSB0,id=rng0 \
-device virtio-rng-pci,rng=rng0
2.check rng device in guest
#cat /sys/devices/virtual/misc/hw_random/rng_available
#cat /sys/devices/virtual/misc/hw_random/rng_current
#cat /dev/hwrng
3.

Actual results:
2.has no output

Expected results:
real rng device can work properly in guest.

Additional info:

Comment 4 Amit Shah 2013-09-13 05:24:54 UTC
As discussed on irc, even 'cat /dev/ttyUSB1' on the host doesn't give any output, so it's something that's lacking on this particular rng model, rather than on qemu.

For this model of rng, a program will have to be written that reads from the rng's interface and pushes that data somewhere.  This 'somewhere' can be a socket, for qemu to pick up the data, or to the kernel, to feed into the kernel's entropy pool.

For testing, both methods should be available, and we'll use this bug to track the writing of a program that reads from the rng and writes to a socket.

The best solution, of course, is to feed to the kernel's entropy pool, so that the qemu default of sending the host's /dev/random data to the guest doesn't have to change, and remains the most secure option.

I don't agree this should be a TestBlocker - the real test should be whether the guest receives data from the host.  The source of the data should not matter so much to hold up testing / builds.

Comment 6 Amos Kong 2013-09-13 09:00:57 UTC
We can use example programs to read random data from device, what we need to do is writing a program to read data by API, then write the data to a socket.

./read-data
// create socket1, listen 1024 port of 10.66.4.212
// launch qemu, it will connect the socket1
// accept the connection
// read random data and send to remote


./x86_64-softmmu/qemu-system-x86_64 -vnc :0 -snapshot /images/RHEL-Server-6.4-64-virtio.qcow2  -monitor stdio --enable-kvm -m 2000 -chardev socket,host=10.66.4.212,port=1024,id=chr0 -object rng-egd,chardev=chr0,id=rng0 -device virtio-rng-pci,rng=rng0

Comment 7 Amos Kong 2013-09-13 09:41:16 UTC
Created attachment 797225 [details]
Read random data from rng device by libqwqng API (data will be sent to remote socket)

(RandBytes.cpp should be added to libqwqng-1.3.5/examples/ to compile)


localhost) # ./randbytes

remote-host)# ./x86_64-softmmu/qemu-system-x86_64 -vnc :0 -snapshot /images/RHEL-Server-6.4-64-virtio.qcow2  -monitor stdio --enable-kvm -m 2000 -chardev socket,host=10.66.4.212,port=1024,id=chr0 -object rng-egd,chardev=chr0,id=rng0 -device virtio-rng-pci,rng=rng0

guest) # dd if=/dev/hwrng of=/dev/stdout

tested: works well