From: Jeff Garzik <jgarzik@pobox.com>
To: Andreas Dilger <adilger@clusterfs.com>
Cc: Eli Billauer <eli_billauer@users.sourceforge.net>,
linux-kernel@vger.kernel.org,
Nick Piggin <piggin@cyberone.com.au>
Subject: Re: [RFC] frandom - fast random generator module
Date: Thu, 16 Oct 2003 19:17:04 -0400 [thread overview]
Message-ID: <3F8F26F0.6080002@pobox.com> (raw)
In-Reply-To: <20031016121825.D7000@schatzie.adilger.int>
Andreas Dilger wrote:
> On Oct 16, 2003 12:31 -0400, Jeff Garzik wrote:
>
>>Andreas Dilger wrote:
>>
>>>Actually, there are several applications of low-cost RNG inside the kernel.
>>>
>>>For Lustre we need a low-cost RNG for generating opaque 64-bit handles in
>>>the kernel. The use of get_random_bytes() showed up near the top of
>>>our profiles and we had to invent our own low-cost crappy PRNG instead (it's
>>>good enough for the time being, but when we start working on real security
>>>it won't be enough).
>>>
>>>The tcp sequence numbers probably do not need to be crypto-secure (I could
>>>of course be wrong on that ;-) and with GigE or 10GigE I imagine the number
>>>of packets being sent would put a strain on the current random pool.
>>
>>
>>We don't need "low cost RNG" and "high cost RNG" in the same kernel.
>>That just begs a "reduce RNG cost" solution... I think security experts
>>can easily come up with arguments as to why creating your own "low-cost
>>crappy PRNG" isn't needed -- you either need crypto-secure, or you
>>don't. If you don't, then you could just as easily create an ascending
>>64-bit number for your opaque filehandle, or use a hash value, or some
>>other solution that doesn't require an additional PRNG in the kernel.
>
>
> Hmm, so every part of the kernel that doesn't need crypto-secure RNG data
> (i.e. fast and relatively unique) should implement its own hash/PRNG then?
> It isn't a matter of unbreakable crypto, but the fact that we want relatively
> unique values that will not be the same on a reboot. Currently we do just
> as you propose for our "crappy PRNG", which is "grab 8 bytes via
> get_random_bytes and increment", but that is a little _too_ easy to guess
> (although good enough for the time being).
If you care at all about it being easy to guess, then why bother with
the crappy PRNG? :)
If you _don't_ care about the numbers being easy to guess -- i.e. you
simply want unique values -- then it doesn't seem like a PRNG is needed
at all. With a random number you have to deal with collisions between
nodes choosing the same number coincidentally _anyway_, so why not just
use sequence numbers?
>>For VIA CPUs, life is easy. Use xstore insn and "You've got bytes!" :)
>
>
> As you say, we could throw away even our crappy PRNG and get better data
> with a single opcode. So you advocate we add CPU/arch-specific code into
> our filesystem? How about we add a wrapper around all the different
> CPU-specific RNG codes and call it the "low cost RNG" which will be faster
> _and_ give better data than any explicitly-coded PRNG. ;-) For our needs
> at least, the asm-generic code would be on the order of maybe 15 lines of C:
Let's see what pans out... It sounds like the random driver has
untapped performance potential, and could be made more SMP-friendly...
FWIW, for h/w RNGs, I prefer the model where a userspace daemon feeds
the kernel entropy pool. On most days, you will have full entropy
buffers because 'xstore' generates random data much faster than most
apps consume it. But the userspace daemon can also throttle (nice to
PM), validate the h/w RNG (ugly and costly to do in-kernel), and utilize
a few processor-dependent features that increase xstore's throughput in
userspace.
Then the problem simply becomes one of making sure you can copy entropy
out of kernel memory buffers efficiently.
Jeff
next prev parent reply other threads:[~2003-10-16 23:17 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-10-16 8:22 [RFC] frandom - fast random generator module Eli Billauer
2003-10-16 8:36 ` Nick Piggin
2003-10-16 10:20 ` Eli Billauer
2003-10-16 10:48 ` Nick Piggin
2003-10-16 11:29 ` Jeff Garzik
2003-10-16 12:27 ` Eli Billauer
2003-10-16 15:10 ` Jeff Garzik
2003-10-16 16:20 ` Andreas Dilger
2003-10-16 16:31 ` Jeff Garzik
2003-10-16 18:18 ` Andreas Dilger
2003-10-16 18:52 ` Richard B. Johnson
2003-10-16 19:31 ` Matt Mackall
2003-10-16 20:40 ` Andreas Dilger
2003-10-16 21:03 ` David Wagner
2003-10-16 23:17 ` Jeff Garzik [this message]
2003-10-16 23:42 ` Andreas Dilger
2003-10-17 0:34 ` David Wagner
2003-10-16 17:45 ` Matt Mackall
2003-10-16 18:38 ` Andreas Dilger
2003-10-16 19:08 ` Matt Mackall
2003-10-16 20:27 ` Andreas Dilger
2003-10-16 20:37 ` Matt Mackall
2003-10-16 17:31 ` Matt Mackall
2003-10-16 23:03 ` Eli Billauer
2003-10-16 23:07 ` Jeff Garzik
2003-10-16 23:13 ` Matt Mackall
2003-10-16 23:35 ` jw schultz
2003-10-21 19:24 ` bill davidsen
2003-10-21 19:55 ` bill davidsen
2003-10-21 21:21 ` Helge Hafting
2003-10-21 22:18 ` bill davidsen
2003-10-22 1:04 ` H. Peter Anvin
2003-10-21 19:17 ` bill davidsen
2003-10-21 21:00 ` H. Peter Anvin
2003-10-21 22:08 ` bill davidsen
2003-10-22 1:06 ` H. Peter Anvin
2003-10-22 2:56 ` jw schultz
2003-10-22 16:22 ` Kent Borg
2003-10-23 2:46 ` Dale Farnsworth
2003-10-23 3:22 ` Sandy Harris
2003-10-23 14:15 ` Kent Borg
2003-10-24 17:37 ` bill davidsen
2003-10-24 17:54 ` Theodore Ts'o
2003-10-24 20:59 ` David Wagner
2003-10-24 21:33 ` jw schultz
2003-10-22 3:49 ` Sandy Harris
2003-10-16 10:45 ` Ingo Oeser
2003-10-21 19:30 ` bill davidsen
[not found] <HbGf.8rL.1@gated-at.bofh.it>
[not found] ` <HbQ5.ep.27@gated-at.bofh.it>
[not found] ` <Hdyv.2Vd.13@gated-at.bofh.it>
[not found] ` <HeE6.4Cc.1@gated-at.bofh.it>
[not found] ` <HjaT.3nN.7@gated-at.bofh.it>
[not found] ` <Hjkw.3Al.11@gated-at.bofh.it>
2003-10-16 17:46 ` David Mosberger-Tang
2003-10-16 19:28 ` Eli Billauer
2003-10-16 20:42 ` Andreas Dilger
2003-10-21 19:46 ` bill davidsen
2003-10-16 21:30 ` Matt Mackall
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=3F8F26F0.6080002@pobox.com \
--to=jgarzik@pobox.com \
--cc=adilger@clusterfs.com \
--cc=eli_billauer@users.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=piggin@cyberone.com.au \
/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).