From owner-svn-src-all@FreeBSD.ORG Wed Jul 4 20:32:48 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2AAEC106566B; Wed, 4 Jul 2012 20:32:48 +0000 (UTC) (envelope-from ache@vniz.net) Received: from vniz.net (vniz.net [194.87.13.69]) by mx1.freebsd.org (Postfix) with ESMTP id 646F38FC17; Wed, 4 Jul 2012 20:32:47 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by vniz.net (8.14.5/8.14.5) with ESMTP id q64KWeDG042644; Thu, 5 Jul 2012 00:32:40 +0400 (MSK) (envelope-from ache@vniz.net) Received: (from ache@localhost) by localhost (8.14.5/8.14.5/Submit) id q64KWeGj042643; Thu, 5 Jul 2012 00:32:40 +0400 (MSK) (envelope-from ache) Date: Thu, 5 Jul 2012 00:32:40 +0400 From: Andrey Chernov To: Konstantin Belousov Message-ID: <20120704203239.GA42326@vniz.net> Mail-Followup-To: Andrey Chernov , Konstantin Belousov , Pawel Jakub Dawidek , src-committers@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, svn-src-head@FreeBSD.ORG, markm@freebsd.org References: <201207041951.q64JpPXu029310@svn.freebsd.org> <20120704200220.GM2337@deviant.kiev.zoral.com.ua> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="rwEMma7ioTxnRzrJ" Content-Disposition: inline In-Reply-To: <20120704200220.GM2337@deviant.kiev.zoral.com.ua> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@FreeBSD.ORG, markm@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, src-committers@FreeBSD.ORG, Pawel Jakub Dawidek Subject: Re: svn commit: r238118 - head/lib/libc/gen X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Jul 2012 20:32:48 -0000 --rwEMma7ioTxnRzrJ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Jul 04, 2012 at 11:02:20PM +0300, Konstantin Belousov wrote: > On Wed, Jul 04, 2012 at 07:51:25PM +0000, Pawel Jakub Dawidek wrote: > > Author: pjd > > Date: Wed Jul 4 19:51:25 2012 > > New Revision: 238118 > > URL: http://svn.freebsd.org/changeset/base/238118 > >=20 > > Log: > > Prefer sysctl to open/read/close for obtaining random data. > > This method is more sandbox-friendly and also should be faster as only > > one syscall is needed instead of three. > > In case of an error fall back to the old method. > > =20 > > Reviewed by: simon, gleb > > MFC after: 2 weeks > IMO it is weird and against a purpose of sysctl that kern.arand sysctl > exists at all. I would prefer to not spread its usage more. We have > to keep it to preserve ABI compatibility, but I do not think that the > location for random data provider is right, not to mention higher > overhead of sysctl machinery. 1) /dev/urandom may not exist in jails/sandboxes while sysctls (or old way= =20 initialization) always exists. 2) Current NetBSD code uses KERN_URND we don't have. 3) Current OpenBSD code uses KERN_ARND as in the change committed. 4) Our KERN_ARND initially is initialized only from from the weak value at= =20 the boot stage. 5) I already provide two working patches (one with atomic and another=20 one without) to bypass issue 4) but they are never committed by person=20 who promise to handle them (markm@ CCed) for the reason unknown and I=20 can't do it by myself due to stupid secteam@ 5 years old ban. 6) So, current KERN_ARND way gives weak randomness for just started after= =20 boot programs and should be fixed by either my patches mentioned in 5) or= =20 by implementing KERN_URND as in NetBSD. Note that the initial ARND seeding problem does not exist in OpenBSD since= =20 they use different KERN_ARND implementation. (besides usage in arc4random code I think KERN_ARND should be fixed in=20 anycase) --=20 http://ache.vniz.net/ --rwEMma7ioTxnRzrJ Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iEYEARECAAYFAk/0qGcACgkQVg5YK5ZEdN1LPgCeLj0IGDbAOKc01hKYZg2+Vh2q tLIAn3+/VqmCURvuAytCw6qV4otUAtyP =s+Rp -----END PGP SIGNATURE----- --rwEMma7ioTxnRzrJ--