qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Anthony Liguori <anthony@codemonkey.ws>
To: Amit Shah <amit.shah@redhat.com>
Cc: qemu list <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH 1/1] virtio-rng: device to send host entropy to guest
Date: Mon, 21 May 2012 15:34:59 -0500	[thread overview]
Message-ID: <4FBAA6F3.3010007@codemonkey.ws> (raw)
In-Reply-To: <20120521193926.GD14541@amit.redhat.com>

On 05/21/2012 02:39 PM, Amit Shah wrote:
> On (Wed) 16 May 2012 [13:23:11], Anthony Liguori wrote:
>> 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
>>>>> implementation.
>>>>>
>>>>> 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
>>>>>    virtio
>>>>>
>>>>>    $ cat /sys/devices/virtual/misc/hw_random/rng_current
>>>>>    virtio
>>>>>
>>>>> 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<amit.shah@redhat.com>
>>>>
>>>> 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
>>>> key generation).
>>>>
>>>> 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.
>
> I understand.  It's been shown, however, that /dev/urandom isn't
> easily exhausted, and can be used as a reliable random source for
> quite a few years without new seeding.  And even if a guest (or more)
> is malicious, the guest doing such activities would itself continue to
> generate some seed for the host's pool, strengthening /dev/urandom.
>
> I don't know where to cite the data from, but I'll pass on that info
> when I have a reference.

Okay, I need to some type of reference here.

Not implementing virtio-rng for all of these years wasn't a simple oversight. 
It was specifically out of fear of exhausting the entropy pool.

I'm pretty opposed to merging this without addressing entropy exhaustion because 
it's a subtle enough issue that I don't think most users would be capable of 
understanding the ramifications.

Regards,

Anthony Liguori

>
> In the meantime, I'll add a rate-limiting option to the device, it
> does seem like a good idea to implement nevertheless.
>
> 		Amit

  reply	other threads:[~2012-05-21 20:40 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-16 11:30 [Qemu-devel] [PATCH 1/1] virtio-rng: device to send host entropy to guest Amit Shah
2012-05-16 11:38 ` Paolo Bonzini
2012-05-16 11:54   ` Amit Shah
2012-05-16 13:24 ` Anthony Liguori
2012-05-16 13:45   ` Daniel P. Berrange
2012-05-16 13:48     ` Anthony Liguori
2012-05-16 13:53       ` Daniel P. Berrange
2012-05-16 14:02         ` Anthony Liguori
2012-05-16 17:28           ` Amit Shah
2012-05-21 19:32       ` Amit Shah
2012-05-16 17:26     ` Amit Shah
2012-05-16 18:24       ` Anthony Liguori
2012-05-21 19:37         ` Amit Shah
2012-05-16 17:21   ` Amit Shah
2012-05-16 18:23     ` Anthony Liguori
2012-05-21 19:39       ` Amit Shah
2012-05-21 20:34         ` Anthony Liguori [this message]
2012-05-22 12:57           ` Amit Shah

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4FBAA6F3.3010007@codemonkey.ws \
    --to=anthony@codemonkey.ws \
    --cc=amit.shah@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).