<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>8816</bug_id>
          
          <creation_ts>2015-12-16 11:33:32 +0000</creation_ts>
          <short_desc>Add support for paravirtualized hardware random number generator for qemu machines</short_desc>
          <delta_ts>2016-02-15 17:02:21 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>7</classification_id>
          <classification>Build System, Metadata &amp; Runtime</classification>
          <product>OE-Core</product>
          <component>virtual machines</component>
          <version>2.1</version>
          <rep_platform>Other</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium+</priority>
          <bug_severity>enhancement</bug_severity>
          <target_milestone>2.1 M3</target_milestone>
          
          <blocked>8681</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Cristian Iorga">cristian.iorga</reporter>
          <assigned_to name="Saul Wold">sgw</assigned_to>
          <cc>alexandru.c.georgescu</cc>
          
          <qa_contact name="Costin">costin.c.constantin</qa_contact>
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>Don&apos;t know</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>57298</commentid>
    <comment_count>0</comment_count>
    <who name="Cristian Iorga">cristian.iorga</who>
    <bug_when>2015-12-16 11:33:32 +0000</bug_when>
    <thetext>Add support for paravirtualized hardware random number generator for qemu machines

Qemu BSPs might end up not having enough entropy for normal OS/apps operation.

This might help fix the issue.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>57299</commentid>
    <comment_count>1</comment_count>
    <who name="Cristian Iorga">cristian.iorga</who>
    <bug_when>2015-12-16 11:36:21 +0000</bug_when>
    <thetext>References:

1. About Random Numbers and Virtual Machines
http://log.amitshah.net/2013/01/about-random-numbers-and-virtual-machines/

2. QEMU Features-Done/VirtIORNG
http://wiki.qemu.org/Features-Done/VirtIORNG

3. QEMU/Devices/Virtio
https://en.wikibooks.org/wiki/QEMU/Devices/Virtio</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>57390</commentid>
    <comment_count>2</comment_count>
    <who name="Cristian Iorga">cristian.iorga</who>
    <bug_when>2015-12-18 16:38:18 +0000</bug_when>
    <thetext>Design started.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>57754</commentid>
    <comment_count>3</comment_count>
    <who name="Cristian Iorga">cristian.iorga</who>
    <bug_when>2016-01-12 16:34:12 +0000</bug_when>
    <thetext>Implementation is dependent on Linux features that will be active in 4.4, so implementation is postponed until poky master switches to Linux 4.4.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>58351</commentid>
    <comment_count>4</comment_count>
    <who name="Cristian Iorga">cristian.iorga</who>
    <bug_when>2016-01-29 18:11:18 +0000</bug_when>
    <thetext>Kernel config fragments:
CONFIG_HW_RANDOM=y
CONFIG_HW_RANDOM_VIRTIO=y

runqemu params:
runqemu qemux86-64 core-image-sato kvm qemuparams=&quot;-object rng-random,filename=/dev/urandom,id=rng0 -device virtio-rng-pci,rng=rng0&quot;

Check paravirtualization:

cat /sys/devices/virtual/misc/hw_random/rng_available
cat /sys/devices/virtual/misc/hw_random/rng_current
cat /dev/hwrng

rng-tools are needed:

Link /dev/hwrng to /dev/random

rngd -r /dev/hwrng

RNG-tools

Source: http://sourceforge.net/projects/gkernel/files/rng-tools/
Other possible sources: https://qa.debian.org/cgi-bin/vcswatch?package=rng-tools

# rngd -r /dev/urandom
Takes from /dev/urandom (non-blocking) to generate entropy for /dev/random (blocking)

Links that might help:
https://wiki.archlinux.org/index.php/Rng-tools
http://security.stackexchange.com/questions/39992/is-it-safe-to-use-rng-tools-on-a-virtual-machine</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>58352</commentid>
    <comment_count>5</comment_count>
    <who name="Cristian Iorga">cristian.iorga</who>
    <bug_when>2016-01-29 18:12:01 +0000</bug_when>
    <thetext>#Next Steps#
1. Add rng-tools to core-image-sato image
2. How it can be added only for qemu machines?
3. Create link
4. Update runqemu for the inclusion of paravirtualized random number generator
5. Update the kernel config fragments
6. Move rng-tools from meta-oe to oe-core (??)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>58834</commentid>
    <comment_count>6</comment_count>
    <who name="Saul Wold">sgw</who>
    <bug_when>2016-02-10 16:58:12 +0000</bug_when>
    <thetext>Pushing to M3 due to change of resources</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>59037</commentid>
    <comment_count>7</comment_count>
    <who name="Saul Wold">sgw</who>
    <bug_when>2016-02-15 17:02:21 +0000</bug_when>
    <thetext>These two patches add rng-tools to the qemu images and increase the availablity 
of entropy bits

http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=6740dd55798641a47744b891aa1d8fa5e04c2cdc
http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=ce3df21122d7fc4ede6fe36009afb297004672ef

The Kernel configs have been updated to include the HW_RANDOM_VIRTIO and 
HW_RANDOM in virtio.cfg of the yocto-kernel-cache.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>