From: "Theodore Ts'o" <tytso@mit.edu>
To: Sandy Harris <sandyinchina@gmail.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
linux-crypto@vger.kernel.org, Jason Cooper <jason@lakedaemon.net>,
John Denker <jsd@av8n.com>, "H. Peter Anvin" <hpa@zytor.com>,
Stephan Mueller <smueller@chronox.de>
Subject: Re: random(4) changes
Date: Sat, 23 Apr 2016 22:03:23 -0400 [thread overview]
Message-ID: <20160424020323.GD20980@thunk.org> (raw)
In-Reply-To: <CACXcFm=PmD1_MqH5j-oY=X=mXD20jLMTuaPe9_GVY7JxN99MpA@mail.gmail.com>
On Fri, Apr 22, 2016 at 06:27:48PM -0400, Sandy Harris wrote:
>
> I really like Stephan's idea of simplifying the interrupt handling,
> replacing the multiple entropy-gathering calls in the current driver
> with one routine called for all interrupts. See section 1.2 of his
> doc. That seems to me a much cleaner design, easier both to analyse
> and to optimise as a fast interrupt handler.
The current /dev/random driver *already* has a fast interrupt handler,
and it was designed specifically to be very fast and very lightweight.
It's a fair argument that getting rid of add_disk_randomness()
probably makes sense. However, add_input_randomness() is useful
because it is also mixing in the HID input (e.g., the characters typed
or the mouse movements), and that is extremely valuable and I wouldn't
want to get rid of this.
> In the current driver -- and I think in Stephan's, though I have not
> looked at his code in any detail, only his paper -- heavy use of
> /dev/urandom or the kernel get_random_bytes() call can deplete the
> entropy available to /dev/random. That can be a serious problem in
> some circumstances, but I think I have a fix.
So /dev/urandom, or preferentially, the getrandom(2) system call,
which will block until the entropy pool is initialized, is designed to
be a CRNG. We use the entropy accounting for the urandom pool as a
hueristic to know how aggressively to pull the random pool and/or
things like hwrandom (since pulling entropy from the TPM does have
costs, for example power utilization for battery-powered devices).
We already throttle back how much we pull from the input pool if it is
being used heavily, specifically to avoid this problem.
Cheers,
- Ted
next prev parent reply other threads:[~2016-04-24 2:03 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-22 22:27 random(4) changes Sandy Harris
2016-04-23 7:52 ` Stephan Mueller
2016-04-24 2:03 ` Theodore Ts'o [this message]
2016-04-24 8:03 ` Stephan Mueller
2016-04-26 3:07 ` Theodore Ts'o
2016-04-26 11:04 ` Herbert Xu
2016-04-26 20:47 ` Andi Kleen
2016-04-27 4:23 ` Herbert Xu
2016-04-26 18:24 ` Stephan Mueller
2016-04-26 18:44 ` Pavel Machek
2016-04-26 18:55 ` Stephan Mueller
2016-04-26 19:41 ` Pavel Machek
2016-04-25 16:06 ` Andi Kleen
2016-04-25 17:25 ` Stephan Mueller
2016-04-25 17:38 ` Andi Kleen
2016-04-25 17:56 ` Stephan Mueller
2016-04-25 19:35 ` Andi Kleen
2016-04-26 12:01 ` Stephan Mueller
2016-04-27 17:47 ` Stephan Mueller
2016-04-26 1:00 ` Theodore Ts'o
2016-04-26 12:42 ` Sandy Harris
[not found] <5279345.Lo7T948V4W@positron.chronox.de>
2016-04-26 20:43 ` George Spelvin
2016-04-26 21:01 ` Stephan Mueller
2016-04-27 0:23 ` George Spelvin
2016-04-27 18:03 ` George Spelvin
2016-04-28 20:15 ` Stephan Mueller
2016-04-29 7:29 ` George Spelvin
2016-04-29 8:02 ` Stephan Mueller
2016-04-29 9:34 ` George Spelvin
2016-04-29 9:53 ` Stephan Mueller
2016-04-29 11:04 ` George Spelvin
2016-04-29 11:18 ` Stephan Mueller
2016-04-29 18:02 ` George Spelvin
2016-04-29 18:41 ` Stephan Mueller
2016-04-29 20:08 ` George Spelvin
2016-04-29 21:54 ` Stephan Mueller
2016-04-29 22:32 ` George Spelvin
2016-04-29 0:47 ` George Spelvin
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=20160424020323.GD20980@thunk.org \
--to=tytso@mit.edu \
--cc=hpa@zytor.com \
--cc=jason@lakedaemon.net \
--cc=jsd@av8n.com \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sandyinchina@gmail.com \
--cc=smueller@chronox.de \
/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