Date: Wed, 03 Apr 2013 11:31:43 +0400 From: Andrey Chernov <ache@freebsd.org> To: Bruce Evans <brde@optusnet.com.au> Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Xin LI <delphij@FreeBSD.org> Subject: Re: svn commit: r249035 - head/lib/libc/stdlib Message-ID: <515BDADF.8060303@freebsd.org> In-Reply-To: <20130403165736.F819@besplex.bde.org> References: <201304022341.r32NfL8L096954@svn.freebsd.org> <20130403165736.F819@besplex.bde.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On 03.04.2013 11:04, Bruce Evans wrote: >> + mib[0] = CTL_KERN; >> + mib[1] = KERN_ARND; >> + sysctl(mib, 2, (void *)&next, &len, NULL, 0); >> } > > The sysctl() is certain to fail on old kernels (like open of /dev/random > on even older kernels), but there is no longer any error checking or > handling. The contents of `next' on error is indeterminate (not documented > in the man page), but is probably unchanged. Applications can actually > detect this error although though the API doesn't support this, by > using the documented implementation details and assuming that errno > is properly left changed if the syscall fails (set errno to 0 before > the call here and check it after). Even in case sysctl is not fail, kernel's arc4 is very poorly initialized right after the boot. See the comment in the libkern/arc4random.c arc4_randomstir(), it is about device not loaded case, but it is the same even if device is loaded but not harvest enough. NetBSD implementation of kernel's arc4 is different from ours. Really I am _very_ tired to tell people about the problem, to write patches for the problem, etc., so anybody who are interested can search more details and patches in the mail archives.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?515BDADF.8060303>