/dev/io , /dev/mem : only used by Xorg?

Ted Mittelstaedt tedm at toybox.placo.com
Tue Mar 1 08:06:16 GMT 2005


Kris Kennaway wrote:
> On Mon, Feb 28, 2005 at 04:58:02AM -0800, Ted Mittelstaedt wrote:
>
>> Yes - there's some random testing suites on the Internet, find a
>> few and compile them. (ENT for example) Run them repeatedly and see
>> what happens.
>>
>> Part of the problem is that BY DEFAULT the random device DOES NOT
>> look at interrupts.  See the man page for rndcontrol.  Presumably
>> the system admin of the system knows this and looks at his dmesg
>> output to see which irq's are assigned to network cards and hard
>> disks (which are fairly good sources of randomness) and sets the
>> random device to use these.  In practice this isn't something
>> mentioned in the install docs so it is very unlikely many people
>> know.
>>
>> Another strange thing is that /dev/random should block when it
>> runs out of entropy - it doesen't seem to do so, however.  And the
>> device doesen't seem to gain entropy that quickly.
>
> No, it should not block because it's not defined to block

In FreeBSD

> and that
> would be a bad interface anyway.

The "u" in /dev/urandom means unblocking.

The original UNIX implementation was for /dev/random and /dev/urandom,
programs that needed high quality randomness and didn't mind waiting
for it used /dev/random, programs that needed copious amounts of it
and didn't care much about the quality used /dev/urandom

> It does return as many bytes as it
> can, and if the application wants more entropy than given then it can
> either poll, or fall back to alternative mechanisms as it sees fit
> (blocking would prevent this).
>

The problem is that too many people wrote software that needed copious
amounts of high quality randomness and got pissed when their software
hung - as a result in the older FreeBSD they modded /dev/random to
not block anymore, and I think a lot of other unixes did the same to
their random devices for the same reasons.  If the application wasn't
expecting this the results were undefined, but probably not very random.

> Anyway, all your concerns are moot for 5.x.
>

5.X is still not in as wide circulation as you
apparently hope and it's quite obvious that the vast majority of 4.X
users aren't aware of the issue.

And yes I'll take your advice and switch to 5.X for sending out my
secrets that I don't want the men in the black helicopters to get at. /-|

Ted



More information about the freebsd-questions mailing list