From owner-freebsd-current Sun Jan 14 19: 5:47 2001 Delivered-To: freebsd-current@freebsd.org Received: from citusc.usc.edu (citusc.usc.edu [128.125.38.123]) by hub.freebsd.org (Postfix) with ESMTP id 11D7237B400; Sun, 14 Jan 2001 19:05:30 -0800 (PST) Received: (from kris@localhost) by citusc.usc.edu (8.9.3/8.9.3) id TAA15758; Sun, 14 Jan 2001 19:06:44 -0800 Date: Sun, 14 Jan 2001 19:06:44 -0800 From: Kris Kennaway To: Garrett Wollman Cc: current@freebsd.org, markm@freebsd.org Subject: Re: mount_mfs "fix" for entropy hang Message-ID: <20010114190644.C15423@citusc.usc.edu> References: <200101120007.f0C07ib14316@hergotha.lcs.mit.edu> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-md5; protocol="application/pgp-signature"; boundary="eHhjakXzOLJAF9wJ" Content-Disposition: inline User-Agent: Mutt/1.2i In-Reply-To: <200101120007.f0C07ib14316@hergotha.lcs.mit.edu>; from wollman@hergotha.lcs.mit.edu on Thu, Jan 11, 2001 at 07:07:44PM -0500 Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG --eHhjakXzOLJAF9wJ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline I wonder if a better approach might be to make /dev/random return 0 bytes when unseeded, instead of blocking. Then srandomdev() would automatically back down to seeding internally, for example, and no other code changes in mount_mfs would be needed. A warning could be emitted in this case for diagnostic purposes (e.g. in case something actually needs cryptographic randomness and isn't getting it because it's running too early) - this should be the only case when /dev/random returns 0 bytes on a read. Kris On Thu, Jan 11, 2001 at 07:07:44PM -0500, Garrett Wollman wrote: > Index: mkfs.c > =================================================================== > RCS file: /home/ncvs/src/sbin/newfs/mkfs.c,v > retrieving revision 1.32 > diff -u -r1.32 mkfs.c > --- mkfs.c 2000/10/24 03:28:59 1.32 > +++ mkfs.c 2001/01/12 00:05:59 > @@ -192,7 +192,13 @@ > #ifdef FSIRAND > if (!randinit) { > randinit = 1; > - srandomdev(); > + if (mfs) { > + time_t t; > + time(&t); > + srandom(t); > + } else { > + srandomdev(); > + } > } > #endif > if (mfs) { --eHhjakXzOLJAF9wJ Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.4 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE6YmlEWry0BWjoQKURAnE3AKDrbTDmcwqFiJIAfA095q86JcFj1ACeNdbR C9HOHVt63yKQI3MlVE2Frr4= =Ulni -----END PGP SIGNATURE----- --eHhjakXzOLJAF9wJ-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message