From: Folkert van Heusden <folkert@vanheusden.com>
To: Matt Mackall <mpm@selenic.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: issue with /dev/random? gets depleted very quick
Date: Sun, 14 Jun 2009 21:04:17 +0200 [thread overview]
Message-ID: <20090614190417.GC7272@vanheusden.com> (raw)
In-Reply-To: <1244994669.4496.229.camel@calx>
> [cc:ed to lkml]
> > On an idle system (no gui, no daemons, nothing) system, /dev/random gets
> > empty in a matter of 20 seconds with a 2.6.26 kernel.
> > My test:
> > add 1000 bits to the device:
> > zolder:/tmp# cat test-RNDADDENTROPY.c
...
> > }
> > and then check whayt is in it:
> > zolder:/tmp# ./a.out ; while true ; do echo `date` `cat /proc/sys/kernel/random/entropy_avail` ; sleep 1 ; done
> > 0
> > Sun Jun 14 14:50:44 CEST 2009 1117
...
> > Sun Jun 14 14:50:55 CEST 2009 157
> > Is there something wrong with it?
> Does it go below 128? If not, that's the behavior of something depleting
> the pool down to the anti-starvation threshold via either /dev/urandom
> or get_random_bytes.
No, it stays above 128. Sometimes around 13x, sometimes 151, so not
always close to 128.
> On my system, I'm seeing that behavior as well. fuser reports a bunch of
> processes hold /dev/urandom open, but stracing them doesn't reveal a
> culprit. Which means there's now probably something in the kernel
> calling get_random_bytes continuously.
Yes. On the systems I tried, nothing had /dev/*random open, also no
cronjobs that could use it. And still it gets lower.
> Is this a problem? It really shouldn't be. Everyone should be
> using /dev/urandom anyway. And the anti-starvation threshold guarantees
Well, if I understood correctly how /dev/*random works, urandom is fed
by /dev/random. So if there's almost nothing left in the main pool and
urandom demands bits then we have an issue.
Also, if you frequently want to generate keys (thing gpg, ssl), I think
you want bits from /dev/random and not urandom.
> that if there's entropy being collected, readers of /dev/random can
> always make forward progress.
Also if it is used so heavily, you need quit an entropy-source to keep
it filled.
Folkert van Heusden
--
www.vanheusden.com/multitail - multitail is tail on steroids. multiple
windows, filtering, coloring, anything you can think of
----------------------------------------------------------------------
Phone: +31-6-41278122, PGP-key: 1F28D8AE, www.vanheusden.com
next prev parent reply other threads:[~2009-06-14 19:04 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20090614125138.GZ7272@vanheusden.com>
2009-06-14 15:51 ` issue with /dev/random? gets depleted very quick Matt Mackall
2009-06-14 19:04 ` Folkert van Heusden [this message]
2009-06-14 19:34 ` Matt Mackall
2009-06-14 19:58 ` Folkert van Heusden
2009-06-14 20:22 ` 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=20090614190417.GC7272@vanheusden.com \
--to=folkert@vanheusden.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.