qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Anthony Liguori <aliguori@us.ibm.com>
Cc: Amit Shah <amit.shah@redhat.com>,
	qemu-devel@nongnu.org, Andreas Faerber <afaerber@suse.de>
Subject: Re: [Qemu-devel] [PATCH 2/4] virtio-rng-pci: create a default backend if none exists
Date: Fri, 26 Oct 2012 21:53:50 +0200	[thread overview]
Message-ID: <508AEA4E.5080202@redhat.com> (raw)
In-Reply-To: <508ADDAA.7070205@redhat.com>

Il 26/10/2012 20:59, Paolo Bonzini ha scritto:
> Il 26/10/2012 19:21, Anthony Liguori ha scritto:
>> This allows you to specify:
>>
>>   $ qemu -device virtio-rng-pci
>>
>> And things will Just Work with a reasonable default.
>>
>> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
>> ---
>>  hw/virtio-pci.c | 13 +++++++++++++
>>  hw/virtio-rng.h |  2 ++
>>  2 files changed, 15 insertions(+)
>>
>> diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c
>> index 0dc2a06..cfdb779 100644
>> --- a/hw/virtio-pci.c
>> +++ b/hw/virtio-pci.c
>> @@ -885,6 +885,19 @@ static int virtio_rng_init_pci(PCIDevice *pci_dev)
>>      VirtIOPCIProxy *proxy = DO_UPCAST(VirtIOPCIProxy, pci_dev, pci_dev);
>>      VirtIODevice *vdev;
>>  
>> +    if (proxy->rng.rng == NULL) {
>> +        proxy->rng.default_backend = RNG_RANDOM(object_new(TYPE_RNG_RANDOM));
>> +
>> +        object_property_add_child(OBJECT(pci_dev),
>> +                                  "default-backend",
>> +                                  OBJECT(proxy->rng.default_backend),
>> +                                  NULL);
>> +
>> +        object_property_set_link(OBJECT(pci_dev),
>> +                                 OBJECT(proxy->rng.default_backend),
>> +                                 "rng", NULL);
>> +    }
>> +
>>      vdev = virtio_rng_init(&pci_dev->qdev, &proxy->rng);
>>      if (!vdev) {
>>          return -1;
>> diff --git a/hw/virtio-rng.h b/hw/virtio-rng.h
>> index fbb0104..63ddb96 100644
>> --- a/hw/virtio-rng.h
>> +++ b/hw/virtio-rng.h
>> @@ -13,12 +13,14 @@
>>  #define _QEMU_VIRTIO_RNG_H
>>  
>>  #include "qemu/rng.h"
>> +#include "qemu/rng-random.h"
>>  
>>  /* The Virtio ID for the virtio rng device */
>>  #define VIRTIO_ID_RNG    4
>>  
>>  struct VirtIORNGConf {
>>      RngBackend *rng;
>> +    RndRandom *default_backend;
>>  };
>>  
>>  #endif
>>
> 
> NACK.  Starting a guest that runs rngd (or just a malicious guest) will
> completely deprive the host of entropy.
> 
> If you make the default /dev/hwrng, however, that would be ok.

Also, does this break non-Linux?  What if the default was changed to
/dev/hwrng but an older Linux distro didn't have the device file at all?

Paolo

  parent reply	other threads:[~2012-10-26 19:53 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-26 17:21 [Qemu-devel] [PATCH 0/4] Enable virtio-{rng,balloon} by default Anthony Liguori
2012-10-26 17:21 ` [Qemu-devel] [PATCH 1/4] rng-random: split out header for rng-random Anthony Liguori
2012-10-26 17:21 ` [Qemu-devel] [PATCH 2/4] virtio-rng-pci: create a default backend if none exists Anthony Liguori
2012-10-26 18:59   ` Paolo Bonzini
2012-10-26 19:51     ` Anthony Liguori
2012-10-26 20:20       ` Paolo Bonzini
2012-10-26 19:53     ` Paolo Bonzini [this message]
2012-10-26 20:16       ` Anthony Liguori
2012-10-26 20:22         ` Paolo Bonzini
2012-10-26 17:21 ` [Qemu-devel] [PATCH 3/4] machine: add default_devices field to QEMUMachine Anthony Liguori
2012-11-05 12:27   ` Markus Armbruster
2012-10-26 17:21 ` [Qemu-devel] [PATCH 4/4] pc-1.3: add virtio-rng and virtio-balloon to the default machine Anthony Liguori

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=508AEA4E.5080202@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=afaerber@suse.de \
    --cc=aliguori@us.ibm.com \
    --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).