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 786408 - [RFE] Need ability to configure system entropy source for qemu
Summary: [RFE] Need ability to configure system entropy source for qemu
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libvirt
Version: 6.2
Hardware: Unspecified
OS: Unspecified
high
unspecified
Target Milestone: rc
: ---
Assignee: Peter Krempa
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On: 786407 969788 973003 973416 973871 989641 1001770 1001773
Blocks: 896690 1023563 1056252
TreeView+ depends on / blocked
 
Reported: 2012-02-01 11:20 UTC by Steve Grubb
Modified: 2018-12-05 15:28 UTC (History)
17 users (show)

Fixed In Version: libvirt-0.10.2-31.el6
Doc Type: Enhancement
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-10-14 04:13:43 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2014:1374 0 normal SHIPPED_LIVE libvirt bug fix and enhancement update 2014-10-14 08:11:54 UTC

Description Steve Grubb 2012-02-01 11:20:47 UTC
Description of problem:
There is a new security requirement that hosts provide system entropy for use in guest RNGs. Another bug was filed against qemu to add this ability. This bug asks for libvirt to be able to configure that facility in qemu.

Comment 6 Daniel Berrangé 2012-06-20 14:46:03 UTC
Latest QEMU proposal just requires libvirt to be able to configure a character device, and optionally emit an event to client apps when entropy is desired

http://lists.nongnu.org/archive/html/qemu-devel/2012-06/msg03329.html

Comment 7 Amit Shah 2012-07-11 07:48:28 UTC
Anthony's new proposal upstream has two options:

    qemu -chardev socket,host=localhost,port=1024,id=chr0 \
         -object rng-egd,chardev=chr0,id=egd0 \
         -device virtio-rng-pci,rng=egd0

and

    qemu -object rng-urandom,id=rng0 -device virtio-rng-pci,rng=rng0

The first one uses a chardev and we feed in entropy using the egd protocol.

The second one will open /dev/urandom and feed in entropy to the guest.

If this proposal is accepted and merged, we'll have to have an alternative implementation for RHEL6, as we don't have QOM.  This alternative implementation will just end up looking like the proposal linked from comment #6.

In this case, what is preferable to the libvirt team: having a QEVENT emitted each time guest asks for entropy, or to not have the QEVENT?  Keep in mind that there's no QEVENT in the proposal mentioned above by Anthony.

Comment 9 Daniel Berrangé 2012-07-11 09:18:33 UTC
For libvirt POV we would like QEMU to operate as closely as possible to the upstream QEMU.  Even though we don't have QOM in RHEL6, can't we do a little forward compat patch to just parse the two "-object" args you describe in comment #7 and setup RNG manually without using QOM.  If upstream won't have a QEVENT, then we don't want one in RHEL either.

Comment 10 Amit Shah 2012-07-11 09:27:59 UTC
(In reply to comment #9)
> For libvirt POV we would like QEMU to operate as closely as possible to the
> upstream QEMU.  Even though we don't have QOM in RHEL6, can't we do a little
> forward compat patch to just parse the two "-object" args you describe in
> comment #7 and setup RNG manually without using QOM.

I'm not sure about that -- we could get into compat problems, if upstream changes -object behaviour before it lands in RHEL7 or a released upstream version.

>  If upstream won't have
> a QEVENT, then we don't want one in RHEL either.

Agreed on ths.

Comment 11 Laine Stump 2012-07-18 04:14:16 UTC
I believe this is the patchset from Anthony that's mentioned in comment 7:

http://lists.nongnu.org/archive/html/qemu-devel/2012-06/msg04236.html

Comment 23 Amit Shah 2012-11-21 13:12:42 UTC
Patches for qemu have been merged upstream.  See qemu.git commits

16c915ba42b45df7a64a6908287f03bfa3764bed
904d6f588063fb5ad2b61998acdf1e73fb465067

Comment 24 Dave Allan 2013-03-21 17:41:15 UTC
Peter, this is done upstream, right?

Comment 25 Peter Krempa 2013-03-22 09:13:26 UTC
Yes, the basic support was committed to upstream libvirt and is included in the 1.0.3 release.

The core of the functionality was added by commits:

commit 820019fcdff27264bc5ae8fd01095840d3456aa6
Author: Peter Krempa <pkrempa>
Date:   Wed Feb 13 11:22:23 2013 +0100

    qemu: Implement support for EGD backend for virtio-rng
    
    This patch adds a new capability bit QEMU_CAPS_OBJECT_RNG_EGD and code
    to support the egd backend for the VirtIO RNG device.
    
    The device is added by 3 qemu command line options:
    -chardev socket,id=charrng0,host=1.2.3.4,port=1234 (communication
                                                        backend)
    -object rng-egd,chardev=charrng0,id=rng0 (RNG protocol client)
    -device virtio-rng-pci,rng=rng0,bus=pci.0,addr=0x4 (the RNG device)

commit 234a55604eed46b1d4dd55a4d20b66e12a485bc6
Author: Peter Krempa <pkrempa>
Date:   Fri Jan 11 17:48:21 2013 +0100

    qemu: Implement support for default 'random' backend for virtio-rng
    
    This patch implements support for the virtio-rng-pci device and the
    rng-random backend in qemu.
    
    Two capabilities bits are added to track support for those:
    
    QEMU_CAPS_DEVICE_VIRTIO_RNG - for the device support and
    QEMU_CAPS_OBJECT_RNG_RANDOM - for the backend support.
    
    qemu is invoked with these additional parameters if the device is
    enabled:
    
    -object rng-random,id=rng0,filename=/test/phile (to add the backend)
    -device virtio-rng-pci,rng=rng0,bus=pci.0,addr=0x4 (to add the device)

commit e2a0dfcfe99c96daa6e53c968a7630e6ae776dc1
Author: Peter Krempa <pkrempa>
Date:   Fri Jan 11 17:34:37 2013 +0100

    conf: Add support for RNG device configuration in XML
    
    This patch adds basic configuration support for the RNG device
    supporting the virtio model with the "random" and "egd" backend types as
    described in the schema in the previous patch.

commit fa16c80f52136371dcc88649052fd9f7adff73eb
Author: Peter Krempa <pkrempa>
Date:   Thu Dec 20 12:06:52 2012 +0100

    doc: schema: Add basic documentation for the virtual RNG device support
    
    This patch documents XML elements used for (basic) support of virtual
    RNG devices.
    
    In the devices section in the domain XML users may specify:
    
    For the default 'random' backend:
      <devices>
        <rng model='virtio'>
          <backend model='random'>/dev/urandom</backend>
        </rng>
      </devices>
    
    For the slightly more advanced EGD backend:
      <devices>
        <rng model='virtio'>
          <backend model='egd' type='udp'>
            <!-- this is a definition of a character device -->
            <source mode='bind' service='1234'/>
            <source mode='connect' host='1.2.3.4' service='1234'/>
            <!-- or other valid character device configuration -->
          </backend>
        </rng>
      </devices>
    
    For the planned random daemon/pool:
      <devices>
        <rng model='virtio'>
          <backend model='pool' pool='poolname'>class</backend>
        </rng>
      </devices>
    
    to enable the RNG device for guests.

There are a few related commits fixing some minor bugs in the implementation that are already pushed upstream.

In case the fair entropy distribution infrastructure is requested for RHEL6 too please clone https://bugzilla.redhat.com/show_bug.cgi?id=916194 that is tracking  the addition for RHEL7.

If the interface to qemu will differ from the virtio-RNG implementation in upstream qemu we will need to add a RHEL-only hack to bridge the differences as I doubt that libvirt upstream would accept such hacks.

Comment 28 Peter Krempa 2013-06-27 08:02:50 UTC
The backport of the libvirt functionality should be straightforward as the code is already upstream. We're just waiting for the qemu backport to happen to have a testing environment if the backport was successful.

Comment 51 errata-xmlrpc 2014-10-14 04:13:43 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-1374.html


Note You need to log in before you can comment on or make changes to this bug.