Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 14 Nov 2011 18:08:55 -0500
From:      David Schultz <das@freebsd.org>
To:        Andrey Chernov <ache@freebsd.org>, current@freebsd.org, secteam@freebsd.org
Subject:   Re: Is fork() hook ever possible?
Message-ID:  <20111114230855.GA59545@zim.MIT.EDU>
In-Reply-To: <20111114212926.GA28783@vniz.net>
References:  <20080916140319.GA34447@nagual.pp.ru> <20080916201932.GA59781@zim.MIT.EDU> <20111112102241.GA75396@vniz.net> <20111112154135.GA21512@zim.MIT.EDU> <20111112171531.GA83419@vniz.net> <20111114013004.GA53392@zim.MIT.EDU> <20111114192721.GA16834@vniz.net> <20111114205855.GB58790@zim.MIT.EDU> <20111114212926.GA28783@vniz.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Nov 15, 2011, Andrey Chernov wrote:
> On Mon, Nov 14, 2011 at 03:58:55PM -0500, David Schultz wrote:
> > On Mon, Nov 14, 2011, Andrey Chernov wrote:
> > > 1) We should use 
> > > 	mib[0] = CTL_KERN;
> > > 	mib[1] = KERN_ARND;
> > > 
> > > 	len = sizeof(rnd);
> > > 	sysctl(mib, 2, rnd, &len, NULL, 0);
> > > here instead of /dev/random, like OpenBSD did. It helps jails, and 
> > > re-stearing not happens too often in anycase. Obviously it minimizes 
> > > OpenBSD diffs too.
> > 
> > Yes, that was in my list of suggested follow-on work, but I don't
> > have time for it right now.
> 
> I can add this to your patch, we have the same semantics here as OpenBSD, 
> so there will be no surprizes.

Not quite.  OpenBSD's implementation is more careful.  I just
noticed a funny thing about FreeBSD's KERN_ARND sysctl: If the
random device isn't (or can't be) loaded, KERN_ARND silently
decides to initialize itself with the output of random().  This
means that whatever minuscule amount of entropy it might have
picked up from the clock is reduced to a maximum of 31 bits.
That's a fantastic way to provide a false sense of security...



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