Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 5 Jul 2012 00:32:40 +0400
From:      Andrey Chernov <ache@FreeBSD.ORG>
To:        Konstantin Belousov <kostikbel@gmail.com>
Cc:        svn-src-head@FreeBSD.ORG, markm@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, src-committers@FreeBSD.ORG, Pawel Jakub Dawidek <pjd@FreeBSD.ORG>
Subject:   Re: svn commit: r238118 - head/lib/libc/gen
Message-ID:  <20120704203239.GA42326@vniz.net>
In-Reply-To: <20120704200220.GM2337@deviant.kiev.zoral.com.ua>
References:  <201207041951.q64JpPXu029310@svn.freebsd.org> <20120704200220.GM2337@deviant.kiev.zoral.com.ua>

next in thread | previous in thread | raw e-mail | index | archive | help

--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--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120704203239.GA42326>