Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 23 Jul 2005 16:14:49 +0930
From:      Greg 'groggy' Lehey <grog@FreeBSD.org>
To:        Doug Barton <dougb@FreeBSD.org>
Cc:        freebsd-current@FreeBSD.org
Subject:   Re: cvs commit: src/games/fortune/fortune fortune.c
Message-ID:  <20050723064449.GZ842@wantadilla.lemis.com>
In-Reply-To: <42E1DFCE.6090506@FreeBSD.org>
References:  <200507230146.j6N1koqL061690@repoman.freebsd.org> <20050723015517.GA28428@nagual.pp.ru> <20050723020120.GV842@wantadilla.lemis.com> <42E1DFCE.6090506@FreeBSD.org>

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

--XilfshMFnlxBucLf
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Friday, 22 July 2005 at 23:12:30 -0700, Doug Barton wrote:
> Changing venue to -current, since these kinds of protracted discussions
> don't belong on the commit mailing lists.
>
> Greg 'groggy' Lehey wrote:
>
>> But for whatever reasons, many systems seem to have incorrect
>> random(4) initialization.
>
> I don't think it has anything to do with /dev/random initialization, I
> think that there is an error somewhere in the fortune code that is causing
> this problem.

You should take a look at what I committed.  It simply uses the
microsecond value returned by getlocaltime() for the automatic seeding
by srandomdev().  It fixes the problem.  I can see only two
explanations:

1.  srandomdev(), random(4) or friends are broken.
2.  random(4) has been initialized incorrectly.

Currently I'm guessing (2), but I don't care much either way.

> I have seen the same problem Greg has for a long time now,
> but for me it's the fortune with the CVS $FreeBSD$ tag that comes up about
> 8 times out of 10. This is still true even on a system that has been up a=
nd
> running for hours, and has kern.random.sys.seeded: 1
>
> I can't tell if it's a problem with how the files are randomized in the
> first place, or how they get played back, but I haven't looked at this ve=
ry
> hard yet.

The obvious thing is to try this patch and see what happens.

>> You'll recall the debate about removing Rush Limbaugh fortunes recently
>
> I didn't see this debate as I've had e-mail "issues" for the last couple =
of
> days, what list was it on?=20

This was early 2004, it seems.  I've told you the details on IRC (and
I've dropped the buffer from Emacs, so I've forgotten the details;
sorry to the rest of you, but ISTR it was a message from Stephen Mckay
to -chat on 4 January 2004).

> In any case, I would not be at all happy if these fortunes were
> removed. I agreed to add them to the "offensive" fortune database
> because the rule there is that you don't add -o or -a to your
> command line unless you are willing to run the risk of being
> offended.  If every committer gets to go through the fortune
> database and remove every fortune that they find offensive, it's
> going to be a mighty small file.

There was no discussion of that.  If you go back to the thread I
mentioned, you'll see that, though I don't like them, I found it
inappropriate to remove them.

>> This is the only place where it seems to make any difference, so
>> it's easier to use a different seed.
>
> Since my thesis is that this is not a /dev/random initialization
> problem, I tend to agree with you. Just to be on the safe side, I
> have bumped up both the size and number of my /var/db/entropy files,
> and I'll gladly be proven wrong on this one. However, I sincerely
> doubt that this is actually a problem with /dev/random.

It's certainly worth following up on.  From the PoV of fortune, it's
really not worth worrying about the most perfect random number
generator; I suspect that the microsecond seed will satisfy everybody
except possibly the purists.  That doesn't mean that we should forget
the potential issues with random(4).

Greg
--
The virus once contained in this message has lost interest in life,
shrivelled up and died.  LEMIS anti-virus has given it an appropriate
burial.
For further details see http://www.lemis.com/grog/lemis-virus.html

Finger grog@FreeBSD.org for PGP public key.
See complete headers for address and phone numbers.

--XilfshMFnlxBucLf
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (FreeBSD)

iD8DBQFC4edhIubykFB6QiMRAiNZAJ90Ax8+5/E9JIHp/Gz+6nYorsC5rgCdHlm6
9hh+LYGgoKypKGgjeiLlLpw=
=0gXs
-----END PGP SIGNATURE-----

--XilfshMFnlxBucLf--



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