[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 1/1] virtio-rng: device to send host entropy to
Re: [Qemu-devel] [PATCH 1/1] virtio-rng: device to send host entropy to guest
Wed, 16 May 2012 13:23:11 -0500
Mozilla/5.0 (X11; Linux x86_64; rv:11.0) Gecko/20120329 Thunderbird/11.0.1
On 05/16/2012 12:21 PM, Amit Shah wrote:
On (Wed) 16 May 2012 [08:24:22], Anthony Liguori wrote:
On 05/16/2012 06:30 AM, Amit Shah wrote:
The Linux kernel already has a virtio-rng driver, this is the device
When Linux needs more entropy, it puts a buffer in the vq. We then put
entropy into that buffer, and push it back to the guest.
Feeding randomness from host's /dev/urandom into the guest is
sufficient, so this is a simple implementation that opens /dev/urandom
and reads from it whenever required.
Invocation is simple:
qemu ... -device virtio-rng-pci
In the guest, we see
$ cat /sys/devices/virtual/misc/hw_random/rng_available
$ cat /sys/devices/virtual/misc/hw_random/rng_current
There are ways to extend the device to be more generic and collect
entropy from other sources, but this is simple enough and works for now.
Signed-off-by: Amit Shah<address@hidden>
It's not this simple unfortunately.
If you did this with libvirt, one guest could exhaust the available
entropy for the remaining guests. This could be used as a mechanism
for one guest to attack another (reducing the available entropy for
You need to rate limit the amount of entropy that a guest can obtain
to allow management tools to mitigate this attack.
Hm, rate-limiting is a good point. However, we're using /dev/urandom
here, which is nonblocking, and will keep on providing data as long as
we keep reading.
But you're still exhausting the entropy pool (which is a global resource).
That's the problem.
Re: [Qemu-devel] [PATCH 1/1] virtio-rng: device to send host entropy to guest, Amit Shah, 2012/05/16