[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#13768: --without-posix code uses scm_getpid() in libguile-2.0.2

From: Andy Wingo
Subject: bug#13768: --without-posix code uses scm_getpid() in libguile-2.0.2
Date: Mon, 25 Feb 2013 10:06:38 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux)

On Mon 25 Feb 2013 02:17, Mark H Weaver <address@hidden> writes:

> Andy Wingo <address@hidden> writes:
>> On Wed 20 Feb 2013 00:38, Jan Schukat <address@hidden> writes:
>>> What happens is, in random.c in random_state_of_last_resort on line 668
>>> scm_getpid is used to seed the random generator. So either a
>>> preprocessor switch or a hand constructed scm like in scm_getpid
>>> (scm_from_ulong(getpid())) should be used there.
>> Fixed, thanks for the report.
> This has potential security implications.  If the same program is run
> multiple times in the same second, then without something like a PID,
> there's a significant danger that two runs of the program will use the
> same random seed.

Our PRNG is not secure.  We should not be making arguments from the
perspective of security.  (I think including the PID is a good thing,
but not because of security.)

> Therefore, I think we ought to try hard to ensure that something like a
> PID will always be included in this seed.  Perhaps 'scm_getpid' should
> be included even when building --without-posix.

Why don't we just add the result of getpid() without relying on the
scm_getpid() binding.  All platforms have it.

> At the very least, the documentation (which currently claims that the
> PID is included in the random-state-of-last-resort) should be adjusted
> to reflect the new reality.  I just took care of that.

Thanks for following up.  TBH though I would prefer that if you already
know the solution, to go ahead and fix it instead of writing a mail and
fixing the docs.  Much easier on users (and developers :) if Guile just
does the right thing.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]