linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Vivier <lvivier@redhat.com>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org,
	Matt Mackall <mpm@selenic.com>
Subject: Re: [PATCH] hwrng: core - don't block in add_early_randomness()
Date: Mon, 8 Apr 2019 08:55:29 +0200	[thread overview]
Message-ID: <de8d439c-6df1-160a-6d24-2e1998812056@redhat.com> (raw)
In-Reply-To: <20190408063154.7bnt6puawoqtwlgo@gondor.apana.org.au>

On 08/04/2019 08:31, Herbert Xu wrote:
> On Fri, Mar 29, 2019 at 05:30:11PM +0100, Laurent Vivier wrote:
>> If the device is not ready to provide data the kernel will
>> be stuck indefinitely in the init function.
>>
>> This is not a problem if the device is driven using a module,
>> but if the driver is linked directly into the kernel then the
>> kernel boot sequence hangs.
>>
>> This can happen with virtio-rng device with rng-egd backend
>> with no data provider, for instance with QEMU command line parameters:
>>
>> ...
>>     -chardev socket,id=charrng0,host=localhost,port=2345,server,nowait \
>>     -object rng-egd,id=objrng0,chardev=charrng0 \
>>     -device virtio-rng-pci,rng=objrng0,id=rng0
>>
>> To avoid that, we can call rng_get_data() in non blocking mode because
>> the function already manages the case where byte_read is
>> 0 (if the device is not already initialized).
>>
>> See also commit d3cc7996473a
>> ("hwrng: fetch randomness only after device init")
>>
>> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
> 
> I think this is either not a bug (make sure that the user supplies
> a RNG source) or it should be addressed in virtio-rng.

Yes, I did more investigation and I agree.

Thanks,
Laurent


      reply	other threads:[~2019-04-08  6:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-29 16:30 [PATCH] hwrng: core - don't block in add_early_randomness() Laurent Vivier
2019-04-08  6:31 ` Herbert Xu
2019-04-08  6:55   ` Laurent Vivier [this message]

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=de8d439c-6df1-160a-6d24-2e1998812056@redhat.com \
    --to=lvivier@redhat.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mpm@selenic.com \
    /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).