NetBSD Problem Report #48028
From www@NetBSD.org Mon Jul 8 02:58:24 2013
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
(Client CN "mail.NetBSD.org", Issuer "Postmaster NetBSD.org" (verified OK))
by mollari.NetBSD.org (Postfix) with ESMTPS id C43DA716C1
for <gnats-bugs@gnats.NetBSD.org>; Mon, 8 Jul 2013 02:58:24 +0000 (UTC)
Message-Id: <20130708025823.45C96716C2@mollari.NetBSD.org>
Date: Mon, 8 Jul 2013 02:58:23 +0000 (UTC)
From: aran@100acres.us
Reply-To: aran@100acres.us
To: gnats-bugs@NetBSD.org
Subject: Read from /dev/random hangs
X-Send-Pr-Version: www-1.0
>Number: 48028
>Category: kern
>Synopsis: Read from /dev/random hangs
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: riastradh
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Jul 08 03:00:01 +0000 2013
>Closed-Date: Sun Jul 21 23:03:11 +0000 2013
>Last-Modified: Sun Jul 21 23:03:11 +0000 2013
>Originator: Aran Clauson
>Release: 6.99.23
>Organization:
>Environment:
NetBSD sanders 6.99.23 NetBSD 6.99.23 (GENERIC) #7: Sun Jul 7 19:08:24 PDT 2013 aran@sanders:/home/NetBSD/obj/sys/arch/amd64/compile/GENERIC amd64
>Description:
At boot, cgdconfig hangs when configuring randomly keyed device. The hang occurs when reading from /dev/random. I've chased this into sys/kern/subr_cprng.c line 197 in the call to cv_wait_sig.
>How-To-Repeat:
Compiler source from July 2, 2013, boot, read from /dev/random while initializing the system.
>Fix:
>Release-Note:
>Audit-Trail:
From: Taylor R Campbell <riastradh@NetBSD.org>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: kern/48028: Read from /dev/random hangs
Date: Tue, 9 Jul 2013 23:22:44 +0000
Did it hang before a kernel update? If so, when was your previous
kernel from?
Does banging on the keyboard like a monkey unwedge the system?
What entropy sources do you have on your system (rndctl -l)?
Is this in the usual /etc/rc.d/cgd -- that is, for a device listed in
/etc/cgd/cgd.conf? If not, how are you invoking cgdconfig?
Did you have an entropy file (/var/db/entropy-file)? (Note that
/etc/rc.d/rndctl will delete it on boot, and recreate it on shutdown
-- if shutdown is clean.)
Can you try using a kernel with options RND_DEBUG and RND_VERBOSE?
From: Aran Clauson <aran@otsys.com>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: kern/48028: Read from /dev/random hangs
Date: Wed, 10 Jul 2013 09:05:46 -0700 (PDT)
> Did it hang before a kernel update? If so, when was your previous
> kernel from?
>
> Does banging on the keyboard like a monkey unwedge the system?
>
> What entropy sources do you have on your system (rndctl -l)?
>
> Is this in the usual /etc/rc.d/cgd -- that is, for a device listed in
> /etc/cgd/cgd.conf? If not, how are you invoking cgdconfig?
>
> Did you have an entropy file (/var/db/entropy-file)? (Note that
> /etc/rc.d/rndctl will delete it on boot, and recreate it on shutdown
> -- if shutdown is clean.)
>
> Can you try using a kernel with options RND_DEBUG and RND_VERBOSE?
>
The kernel build from
$ cvs -q up -dP -D '07/01/2013'
works just fine. Kernel build from
$ cvs -q up -dP -D '07/02/2013'
hangs on cgdconfig at boot. My current kernel source is from 07/07/2013 with
the same behavior as 07/02.
I am trying to read from /dev/random while I write this email. I'm still
waiting... It took 1m25.524s.
$ rndctl -l
Source Bits Type Flags
cd0 0 disk estimate, collect
wd0 15816 disk estimate, collect
cpu3 545 vm estimate, collect
cpu2 165 vm estimate, collect
cpu1 154 vm estimate, collect
cpu0 1926 vm estimate, collect
coretemp1-cpu2 839 env estimate, collect
coretemp0-cpu0 718 env estimate, collect
wm0 0 net
pms0 36559 tty estimate, collect
pckbd0 4317 tty estimate, collect
acpitz0-cpu0/cp 12 env estimate, collect
thinkpad0-fan-s 21 env estimate, collect
thinkpad0-tempe 0 env estimate, collect
thinkpad0-tempe 0 env estimate, collect
thinkpad0-tempe 0 env estimate, collect
thinkpad0-tempe 0 env estimate, collect
thinkpad0-tempe 0 env estimate, collect
thinkpad0-tempe 0 env estimate, collect
thinkpad0-tempe 0 env estimate, collect
thinkpad0-tempe 51 env estimate, collect
acpibat0-discha 0 env estimate, collect
acpibat0-charge 0 env estimate, collect
system-power 1 power estimate, collect
callout 0 skew collect
I have to cgd devices. One has a fixed key and contains my normal file systems.
The other uses a random key and contains my swap space. Basically I followed
the how to in the cgd manual.
I'm not sure how to check if I have an entropy-file. This, however, may be the
problem. /var is one of the cgd filesystems.
I will build a new kernel with these two options and report back.
Aran
From: Taylor R Campbell <riastradh@NetBSD.org>
To: Aran Clauson <aran@otsys.com>
Cc: gnats-bugs@NetBSD.org
Subject: Re: kern/48028: Read from /dev/random hangs
Date: Thu, 11 Jul 2013 23:30:02 +0000
Date: Wed, 10 Jul 2013 16:10:01 +0000
From: Aran Clauson <aran@otsys.com>
The kernel build from
$ cvs -q up -dP -D '07/01/2013'
works just fine. Kernel build from
$ cvs -q up -dP -D '07/02/2013'
hangs on cgdconfig at boot. My current kernel source is from
07/07/2013 with the same behavior as 07/02.
OK, chances are it was triggered (if not caused) by
<https://mail-index.netbsd.org/source-changes/2013/07/01/msg045202.html>.
I am trying to read from /dev/random while I write this email. I'm still
waiting... It took 1m25.524s.
Does banging on the keyboard or trackpad like a monkey affect that?
I have to cgd devices. One has a fixed key and contains my normal
file systems. The other uses a random key and contains my swap
space. Basically I followed the how to in the cgd manual.
I'm not sure how to check if I have an entropy-file. This,
however, may be the problem. /var is one of the cgd filesystems.
In that case, /etc/rc.d/random_seed (which I mistakenly referred to as
/etc/rc.d/rndctl in my last message) won't be able to load it after
/var is mounted but before the swap cgd is randomkey-configured.
As an alternative, if your root file system is unencrypted and
persistently writable, you could store the entropy file in the root:
1. Set random_file=/entropy in /etc/rc.conf.
2. Add the command `rndseed /entropy' to your /boot.cfg file.
That way, /etc/rc.d/random_seed will save entropy to /entropy on
shutdown, and the boot loader (not /etc/rc) will load it early on
boot, well before /etc/rc.d/cgd runs.
However, while this might work around the problem, it doesn't explain
why the problem recently arose.
I will build a new kernel with these two options and report back.
OK, thanks. If that doesn't reveal anything, I can try putting more
debugging messages in.
As an aside, we really ought to do encrypted swap another way, not by
configuring a cgd. Encrypted swap ought to have zero administrative
hassle (and be on by default...).
From: Aran Clauson <aran@otsys.com>
To: riastradh@NetBSD.org
Cc: gnats-bugs@NetBSD.org
Subject: Re: kern/48028: Read from /dev/random hangs
Date: Thu, 18 Jul 2013 20:38:46 -0700 (PDT)
Taylor,
I'm running a kernel built from sources as of this morning (7/18/2013) with the
debugging options you specified. Sixteen byte reads from /dev/random are still
taking a long time (3:35, 1:02, 1:47).
The rnd message are as follows:
$ dmesg | grep rnd
rnd: callout attached as an entropy source (collecting without estimation)
rnd: initialised (4096) with counter
rnd: WARNING! initial entropy low (3).
rnd: starting statistical RNG test, entropy = 4.
rnd: statistical RNG test done, entropy = 4.
rnd: WARNING! initial entropy low (0).
rnd: system-power attached as an entropy source (collecting)
rnd: WARNING! initial entropy low (1).
rnd: WARNING! initial entropy low (0).
rnd: acpibat0-charge attached as an entropy source (collecting)
rnd: acpibat0-discha attached as an entropy source (collecting)
rnd: thinkpad0-tempe attached as an entropy source (collecting)
rnd: thinkpad0-tempe attached as an entropy source (collecting)
rnd: thinkpad0-tempe attached as an entropy source (collecting)
rnd: thinkpad0-tempe attached as an entropy source (collecting)
rnd: thinkpad0-tempe attached as an entropy source (collecting)
rnd: thinkpad0-tempe attached as an entropy source (collecting)
rnd: thinkpad0-tempe attached as an entropy source (collecting)
rnd: thinkpad0-tempe attached as an entropy source (collecting)
rnd: thinkpad0-fan-s attached as an entropy source (collecting)
rnd: acpitz0-cpu0/cp attached as an entropy source (collecting)
rnd: pckbd0 attached as an entropy source (collecting)
rnd: pms0 attached as an entropy source (collecting)
rnd: wm0 attached as an entropy source (off)
rnd: coretemp0-cpu0 attached as an entropy source (collecting)
rnd: coretemp1-cpu2 attached as an entropy source (collecting)
rnd: cpu0 attached as an entropy source (collecting)
rnd: cpu1 attached as an entropy source (collecting)
rnd: cpu2 attached as an entropy source (collecting)
rnd: cpu3 attached as an entropy source (collecting)
rnd: empty, asking for 509 bits
rnd: wd0 attached as an entropy source (collecting)
rnd: empty, asking for 509 bits
rnd: empty, asking for 509 bits
rnd: cd0 attached as an entropy source (collecting)
rnd: empty, asking for 508 bits
rnd: WARNING! initial entropy low (28).
rnd: WARNING! initial entropy low (0).
rnd: empty, asking for 512 bits
rnd: empty, asking for 511 bits
rnd: empty, asking for 511 bits
rnd: WARNING! initial entropy low (6).
rnd: WARNING! initial entropy low (0).
rnd: empty, asking for 512 bits
rnd: empty, asking for 511 bits
rnd: empty, asking for 511 bits
rnd: empty, asking for 511 bits
rnd: empty, asking for 511 bits
rnd: empty, asking for 510 bits
rnd: empty, asking for 510 bits
rnd: empty, asking for 510 bits
rnd: empty, asking for 510 bits
rnd: empty, asking for 509 bits
rnd: empty, asking for 509 bits
rnd: empty, asking for 509 bits
rnd: empty, asking for 509 bits
rnd: empty, asking for 508 bits
rnd: empty, asking for 508 bits
rnd: empty, asking for 508 bits
rnd: empty, asking for 508 bits
rnd: empty, asking for 507 bits
rnd: empty, asking for 507 bits
rnd: empty, asking for 507 bits
rnd: empty, asking for 507 bits
rnd: empty, asking for 506 bits
rnd: empty, asking for 506 bits
rnd: empty, asking for 506 bits
rnd: empty, asking for 506 bits
rnd: empty, asking for 505 bits
rnd: empty, asking for 505 bits
rnd: empty, asking for 505 bits
rnd: empty, asking for 505 bits
rnd: empty, asking for 504 bits
rnd: empty, asking for 504 bits
rnd: empty, asking for 504 bits
rnd: empty, asking for 504 bits
rnd: empty, asking for 503 bits
rnd: empty, asking for 503 bits
rnd: empty, asking for 503 bits
rnd: empty, asking for 503 bits
rnd: empty, asking for 502 bits
rnd: empty, asking for 502 bits
rnd: empty, asking for 502 bits
rnd: empty, asking for 502 bits
rnd: have initial entropy (84)
rnd: source wd0 is fast (1 samples at once, 188 bits in 6 seconds), processing samples in bulk.
rnd: source pms0 is fast (1 samples at once, 16 bits in 156 seconds), processing samples in bulk.
rnd: source pckbd0 is fast (1 samples at once, 72 bits in 156 seconds), processing samples in bulk.
rnd: source coretemp1-cpu2 is fast (1 samples at once, 16 bits in 156 seconds), processing samples in bulk.
rnd: source coretemp0-cpu0 is fast (1 samples at once, 16 bits in 156 seconds), processing samples in bulk.
rnd: source thinkpad0-tempe is fast (1 samples at once, 21 bits in 205 seconds), processing samples in bulk.
rnd: empty, asking for 503 bits
rnd: empty, asking for 503 bits
rnd: empty, asking for 503 bits
rnd: source thinkpad0-fan-s is fast (1 samples at once, 40 bits in 383 seconds), processing samples in bulk.
rnd: empty, asking for 502 bits
rnd: empty, asking for 502 bits
rnd: empty, asking for 502 bits
rnd: empty, asking for 502 bits
rnd: empty, asking for 502 bits
rnd: empty, asking for 502 bits
rnd: empty, asking for 502 bits
rnd: empty, asking for 502 bits
rnd: empty, asking for 502 bits
rnd: empty, asking for 502 bits
rnd: empty, asking for 502 bits
rnd: empty, asking for 502 bits
rnd: empty, asking for 502 bits
rnd: empty, asking for 502 bits
rnd: empty, asking for 502 bits
rnd: empty, asking for 502 bits
rnd: empty, asking for 502 bits
rnd: empty, asking for 502 bits
rnd: empty, asking for 502 bits
rnd: empty, asking for 502 bits
rnd: empty, asking for 510 bits
rnd: empty, asking for 502 bits
Aran
From: Aran Clauson <aran@otsys.com>
To: riastradh@NetBSD.org
Cc: gnats-bugs@NetBSD.org
Subject: Re: kern/48028: Read from /dev/random hangs
Date: Thu, 18 Jul 2013 22:07:56 -0700 (PDT)
Taylor,
With sources from 7/1 I see the following:
$ dmesg | grep rnd
rnd: pms0 attached as an entropy source (collecting)
rnd: wm0 attached as an entropy source (off)
rnd: coretemp0-cpu0 attached as an entropy source (collecting)
rnd: coretemp1-cpu2 attached as an entropy source (collecting)
rnd: cpu0 attached as an entropy source (collecting)
rnd: cpu1 attached as an entropy source (collecting)
rnd: cpu2 attached as an entropy source (collecting)
rnd: cpu3 attached as an entropy source (collecting)
rnd: empty, asking for 509 bits
rnd: wd0 attached as an entropy source (collecting)
rnd: empty, asking for 509 bits
rnd: empty, asking for 509 bits
rnd: cd0 attached as an entropy source (collecting)
rnd: empty, asking for 508 bits
rnd: WARNING! initial entropy low (28).
rnd: WARNING! initial entropy low (0).
rnd: empty, asking for 512 bits
rnd: empty, asking for 511 bits
rnd: empty, asking for 511 bits
rnd: WARNING! initial entropy low (6).
rnd: WARNING! initial entropy low (0).
rnd: empty, asking for 512 bits
rnd: empty, asking for 511 bits
rnd: empty, asking for 511 bits
rnd: empty, asking for 511 bits
rnd: empty, asking for 511 bits
rnd: empty, asking for 510 bits
rnd: empty, asking for 510 bits
rnd: empty, asking for 510 bits
rnd: empty, asking for 510 bits
rnd: empty, asking for 509 bits
rnd: empty, asking for 509 bits
rnd: empty, asking for 509 bits
rnd: empty, asking for 509 bits
rnd: empty, asking for 508 bits
rnd: empty, asking for 508 bits
rnd: empty, asking for 508 bits
rnd: empty, asking for 508 bits
rnd: empty, asking for 507 bits
rnd: empty, asking for 507 bits
rnd: empty, asking for 507 bits
rnd: empty, asking for 507 bits
rnd: empty, asking for 506 bits
rnd: empty, asking for 506 bits
rnd: empty, asking for 506 bits
rnd: empty, asking for 506 bits
rnd: empty, asking for 505 bits
rnd: empty, asking for 505 bits
rnd: empty, asking for 505 bits
rnd: empty, asking for 505 bits
rnd: empty, asking for 504 bits
rnd: empty, asking for 504 bits
rnd: empty, asking for 504 bits
rnd: empty, asking for 504 bits
rnd: empty, asking for 503 bits
rnd: empty, asking for 503 bits
rnd: empty, asking for 503 bits
rnd: empty, asking for 503 bits
rnd: empty, asking for 502 bits
rnd: empty, asking for 502 bits
rnd: empty, asking for 502 bits
rnd: empty, asking for 502 bits
rnd: have initial entropy (84)
rnd: source wd0 is fast (1 samples at once, 188 bits in 6 seconds), processing samples in bulk.
rnd: source pms0 is fast (1 samples at once, 16 bits in 156 seconds), processing samples in bulk.
rnd: source pckbd0 is fast (1 samples at once, 72 bits in 156 seconds), processing samples in bulk.
rnd: source coretemp1-cpu2 is fast (1 samples at once, 16 bits in 156 seconds), processing samples in bulk.
rnd: source coretemp0-cpu0 is fast (1 samples at once, 16 bits in 156 seconds), processing samples in bulk.
rnd: source thinkpad0-tempe is fast (1 samples at once, 21 bits in 205 seconds), processing samples in bulk.
rnd: empty, asking for 503 bits
rnd: empty, asking for 503 bits
rnd: empty, asking for 503 bits
rnd: source thinkpad0-fan-s is fast (1 samples at once, 40 bits in 383 seconds), processing samples in bulk.
rnd: empty, asking for 502 bits
rnd: empty, asking for 502 bits
rnd: empty, asking for 502 bits
rnd: empty, asking for 502 bits
rnd: empty, asking for 502 bits
rnd: empty, asking for 502 bits
rnd: empty, asking for 502 bits
rnd: empty, asking for 502 bits
rnd: empty, asking for 502 bits
rnd: empty, asking for 502 bits
rnd: empty, asking for 502 bits
rnd: empty, asking for 502 bits
rnd: empty, asking for 502 bits
rnd: empty, asking for 502 bits
rnd: empty, asking for 502 bits
rnd: empty, asking for 502 bits
rnd: empty, asking for 502 bits
rnd: empty, asking for 502 bits
rnd: empty, asking for 502 bits
rnd: empty, asking for 502 bits
rnd: empty, asking for 510 bits
rnd: empty, asking for 502 bits
rnd: empty, asking for 504 bits
rnd: empty, asking for 504 bits
rnd: empty, asking for 504 bits
rnd: empty, asking for 504 bits
rnd: empty, asking for 504 bits
rnd: empty, asking for 504 bits
rnd: callout attached as an entropy source (collecting without estimation)
rnd: initialised (4096) with counter
rnd: WARNING! initial entropy low (3).
rnd: starting statistical RNG test, entropy = 4.
rnd: statistical RNG test done, entropy = 4.
rnd: WARNING! initial entropy low (0).
rnd: system-power attached as an entropy source (collecting)
rnd: WARNING! initial entropy low (1).
rnd: WARNING! initial entropy low (0).
rnd: acpibat0-charge attached as an entropy source (collecting)
rnd: acpibat0-discha attached as an entropy source (collecting)
rnd: thinkpad0-tempe attached as an entropy source (collecting)
rnd: thinkpad0-tempe attached as an entropy source (collecting)
rnd: thinkpad0-tempe attached as an entropy source (collecting)
rnd: thinkpad0-tempe attached as an entropy source (collecting)
rnd: thinkpad0-tempe attached as an entropy source (collecting)
rnd: thinkpad0-tempe attached as an entropy source (collecting)
rnd: thinkpad0-tempe attached as an entropy source (collecting)
rnd: thinkpad0-tempe attached as an entropy source (collecting)
rnd: thinkpad0-fan-s attached as an entropy source (collecting)
rnd: acpitz0-cpu0/cp attached as an entropy source (collecting)
rnd: pckbd0 attached as an entropy source (collecting)
rnd: pms0 attached as an entropy source (collecting)
rnd: wm0 attached as an entropy source (off)
rnd: coretemp0-cpu0 attached as an entropy source (collecting)
rnd: coretemp1-cpu2 attached as an entropy source (collecting)
rnd: cpu0 attached as an entropy source (collecting)
rnd: cpu1 attached as an entropy source (collecting)
rnd: cpu2 attached as an entropy source (collecting)
rnd: cpu3 attached as an entropy source (collecting)
rnd: empty, asking for 509 bits
rnd: wd0 attached as an entropy source (collecting)
rnd: empty, asking for 509 bits
rnd: empty, asking for 509 bits
rnd: cd0 attached as an entropy source (collecting)
rnd: empty, asking for 508 bits
rnd: WARNING! initial entropy low (28).
rnd: WARNING! initial entropy low (0).
rnd: empty, asking for 512 bits
rnd: empty, asking for 511 bits
rnd: empty, asking for 511 bits
rnd: WARNING! initial entropy low (6).
rnd: WARNING! initial entropy low (0).
rnd: empty, asking for 512 bits
rnd: empty, asking for 511 bits
rnd: empty, asking for 511 bits
rnd: empty, asking for 511 bits
rnd: empty, asking for 511 bits
rnd: empty, asking for 510 bits
rnd: empty, asking for 510 bits
rnd: empty, asking for 510 bits
rnd: empty, asking for 510 bits
rnd: empty, asking for 509 bits
rnd: empty, asking for 509 bits
rnd: empty, asking for 509 bits
rnd: empty, asking for 509 bits
rnd: empty, asking for 508 bits
rnd: empty, asking for 508 bits
rnd: empty, asking for 508 bits
rnd: empty, asking for 508 bits
rnd: empty, asking for 507 bits
rnd: empty, asking for 507 bits
rnd: empty, asking for 507 bits
rnd: empty, asking for 507 bits
rnd: empty, asking for 506 bits
rnd: empty, asking for 506 bits
rnd: empty, asking for 506 bits
rnd: empty, asking for 506 bits
rnd: empty, asking for 505 bits
rnd: empty, asking for 505 bits
rnd: empty, asking for 505 bits
rnd: empty, asking for 505 bits
rnd: empty, asking for 504 bits
rnd: empty, asking for 504 bits
rnd: empty, asking for 504 bits
rnd: empty, asking for 504 bits
rnd: empty, asking for 503 bits
rnd: empty, asking for 503 bits
rnd: empty, asking for 503 bits
rnd: empty, asking for 503 bits
rnd: empty, asking for 502 bits
rnd: empty, asking for 502 bits
rnd: empty, asking for 502 bits
rnd: empty, asking for 502 bits
rnd: have initial entropy (84)
rnd: source wd0 is fast (1 samples at once, 188 bits in 6 seconds), processing samples in bulk.
rnd: source pckbd0 is fast (1 samples at once, 20 bits in 11 seconds), processing samples in bulk.
rnd: hard, want = 16, strength = 16, bytesonkey = 0
rnd: new bytesonkey 0
rnd: hard, want = 16, strength = 16, bytesonkey = 0
rnd: new bytesonkey 0
rnd: source coretemp1-cpu2 is fast (1 samples at once, 16 bits in 156 seconds), processing samples in bulk.
rnd: source pms0 is fast (1 samples at once, 16 bits in 156 seconds), processing samples in bulk.
rnd: source coretemp0-cpu0 is fast (1 samples at once, 16 bits in 158 seconds), processing samples in bulk.
rnd: source thinkpad0-fan-s is fast (1 samples at once, 20 bits in 179 seconds), processing samples in bulk.
rnd: source thinkpad0-tempe is fast (1 samples at once, 28 bits in 267 seconds), processing samples in bulk.
rnd: hard, want = 512, strength = 16, bytesonkey = 0
rnd: new bytesonkey 0
Aran
From: Taylor R Campbell <riastradh@NetBSD.org>
To: Aran Clauson <aran@otsys.com>
Cc: gnats-bugs@NetBSD.org
Subject: Re: kern/48028: Read from /dev/random hangs
Date: Fri, 19 Jul 2013 14:33:46 +0000
This is a multi-part message in MIME format.
--=_EVwwZEfBOLU3b7fuOMOrvjPV5u43+fi5
Thanks! Can you please try the attached patch? Apply with
patch -d /path/to/netbsd/src -p1 < rndread.patch
--=_EVwwZEfBOLU3b7fuOMOrvjPV5u43+fi5
Content-Type: application/octet-stream; name="rndread"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="rndread.patch"
ZGlmZiAtLWdpdCBhL3N5cy9kZXYvcm5kcHNldWRvLmMgYi9zeXMvZGV2L3JuZHBz
ZXVkby5jCmluZGV4IGViOTA4MzcuLjFhZmQzOWIgMTAwNjQ0Ci0tLSBhL3N5cy9k
ZXYvcm5kcHNldWRvLmMKKysrIGIvc3lzL2Rldi9ybmRwc2V1ZG8uYwpAQCAtMzg3
LDYgKzM4NywxNyBAQCBybmRfcmVhZChzdHJ1Y3QgZmlsZSAqZnAsIG9mZl90ICpv
ZmZwLCBzdHJ1Y3QgdWlvICp1aW8sIGthdXRoX2NyZWRfdCBjcmVkLAogCQllcnJv
ciA9IHVpb21vdmUoYnVmLCBuX3JlYWQsIHVpbyk7CiAJCWlmIChlcnJvcikKIAkJ
CWdvdG8gb3V0OworCisJCS8qCisJCSAqIERvIGF0IG1vc3Qgb25lIGl0ZXJhdGlv
biBmb3IgL2Rldi9yYW5kb20gYW5kIHJldHVybgorCQkgKiBhIHNob3J0IHJlYWQg
d2l0aG91dCBoYW5naW5nIGZ1cnRoZXIuICBIYW5naW5nCisJCSAqIGJyZWFrcyBh
cHBsaWNhdGlvbnMgd29yc2UgdGhhbiBzaG9ydCByZWFkcy4gIFJlYWRzCisJCSAq
IGNhbid0IGJlIHplcm8gdW5sZXNzIG5vbmJsb2NraW5nIGZyb20gL2Rldi9yYW5k
b20uCisJCSAqLworCQlLQVNTRVJUKCgwIDwgbl9yZWFkKSB8fCAoY3R4LT5yY19o
YXJkICYmCisJCQlJU1NFVChmcC0+Zl9mbGFnLCBGTk9OQkxPQ0spKSk7CisJCWlm
IChjdHgtPnJjX2hhcmQpIHsKKwkJCWdvdG8gb3V0OwogCX0KIAogb3V0Oglwb29s
X2NhY2hlX3B1dChybmRfdGVtcF9idWZmZXJfY2FjaGUsIGJ1Zik7Cg==
--=_EVwwZEfBOLU3b7fuOMOrvjPV5u43+fi5--
From: Taylor R Campbell <riastradh@NetBSD.org>
To: Aran Clauson <aran@otsys.com>
Cc: gnats-bugs@NetBSD.org
Subject: Re: kern/48028: Read from /dev/random hangs
Date: Fri, 19 Jul 2013 14:37:34 +0000
This is a multi-part message in MIME format.
--=_0QJpMfQBgNj0ADmREqdCYuq5HuebiW27
Oops, there was a stray brace in that version of the patch, sorry.
Let's try that again:
--=_0QJpMfQBgNj0ADmREqdCYuq5HuebiW27
Content-Type: application/octet-stream; name="rndread"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="rndread.patch"
ZGlmZiAtLWdpdCBhL3N5cy9kZXYvcm5kcHNldWRvLmMgYi9zeXMvZGV2L3JuZHBz
ZXVkby5jCmluZGV4IGViOTA4MzcuLjEyYzE4MzIgMTAwNjQ0Ci0tLSBhL3N5cy9k
ZXYvcm5kcHNldWRvLmMKKysrIGIvc3lzL2Rldi9ybmRwc2V1ZG8uYwpAQCAtMzg3
LDYgKzM4NywxNyBAQCBybmRfcmVhZChzdHJ1Y3QgZmlsZSAqZnAsIG9mZl90ICpv
ZmZwLCBzdHJ1Y3QgdWlvICp1aW8sIGthdXRoX2NyZWRfdCBjcmVkLAogCQllcnJv
ciA9IHVpb21vdmUoYnVmLCBuX3JlYWQsIHVpbyk7CiAJCWlmIChlcnJvcikKIAkJ
CWdvdG8gb3V0OworCisJCS8qCisJCSAqIERvIGF0IG1vc3Qgb25lIGl0ZXJhdGlv
biBmb3IgL2Rldi9yYW5kb20gYW5kIHJldHVybgorCQkgKiBhIHNob3J0IHJlYWQg
d2l0aG91dCBoYW5naW5nIGZ1cnRoZXIuICBIYW5naW5nCisJCSAqIGJyZWFrcyBh
cHBsaWNhdGlvbnMgd29yc2UgdGhhbiBzaG9ydCByZWFkcy4gIFJlYWRzCisJCSAq
IGNhbid0IGJlIHplcm8gdW5sZXNzIG5vbmJsb2NraW5nIGZyb20gL2Rldi9yYW5k
b20uCisJCSAqLworCQlLQVNTRVJUKCgwIDwgbl9yZWFkKSB8fCAoY3R4LT5yY19o
YXJkICYmCisJCQlJU1NFVChmcC0+Zl9mbGFnLCBGTk9OQkxPQ0spKSk7CisJCWlm
IChjdHgtPnJjX2hhcmQpCisJCQlnb3RvIG91dDsKIAl9CiAKIG91dDoJcG9vbF9j
YWNoZV9wdXQocm5kX3RlbXBfYnVmZmVyX2NhY2hlLCBidWYpOwo=
--=_0QJpMfQBgNj0ADmREqdCYuq5HuebiW27--
From: Aran Clauson <aran@otsys.com>
To: riastradh@NetBSD.org
Cc: gnats-bugs@NetBSD.org
Subject: Re: kern/48028: Read from /dev/random hangs
Date: Sun, 21 Jul 2013 10:03:25 -0700 (PDT)
Taylor,
That patch fixed it! I've changed by cgd-swap configuration back to /dev/random
and the system start normally. Thanks.
Aran
From: "Taylor R Campbell" <riastradh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/48028 CVS commit: src/sys/dev
Date: Sun, 21 Jul 2013 22:30:19 +0000
Module Name: src
Committed By: riastradh
Date: Sun Jul 21 22:30:19 UTC 2013
Modified Files:
src/sys/dev: rndpseudo.c
Log Message:
When reading from /dev/random, block at most once in cprng_strong.
We are not obligated to return exactly as many bytes as requested,
and many applications -- notably those that use stdio or otherwise
buffered I/O to read from /dev/random -- try to read many more than
32 bytes at a time from /dev/random even if all they are about to use
is 32 bytes.
In this case, blocking until we have enough entropy to fill a large
buffer causes needless application delays, e.g. causing cgdconfig
(which reads from /dev/random with stdio) to hang at boot when trying
to configure a random-keyed device for swap.
Patch tested by Aran Clauson. Fixes PR kern/48028.
To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/rndpseudo.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Responsible-Changed-From-To: kern-bug-people->riastradh
Responsible-Changed-By: riastradh@NetBSD.org
Responsible-Changed-When: Sun, 21 Jul 2013 23:03:11 +0000
Responsible-Changed-Why:
mine
State-Changed-From-To: open->closed
State-Changed-By: riastradh@NetBSD.org
State-Changed-When: Sun, 21 Jul 2013 23:03:11 +0000
State-Changed-Why:
fixed
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.