unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: Andy Wingo <wingo@pobox.com>
To: Mark H Weaver <mhw@netris.org>
Cc: 13768@debbugs.gnu.org, shookie@email.de
Subject: bug#13768: --without-posix code uses scm_getpid() in libguile-2.0.2
Date: Mon, 25 Feb 2013 10:06:38 +0100	[thread overview]
Message-ID: <87621g92zl.fsf@pobox.com> (raw)
In-Reply-To: <87sj4l5gzo.fsf@tines.lan> (Mark H. Weaver's message of "Sun, 24 Feb 2013 20:17:47 -0500")

On Mon 25 Feb 2013 02:17, Mark H Weaver <mhw@netris.org> writes:

> Andy Wingo <wingo@pobox.com> writes:
>
>> On Wed 20 Feb 2013 00:38, Jan Schukat <shookie@email.de> 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.

Andy
-- 
http://wingolog.org/





  reply	other threads:[~2013-02-25  9:06 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-19 23:38 bug#13768: --without-posix code uses scm_getpid() in libguile-2.0.2 Jan Schukat
2013-02-24 19:21 ` Andy Wingo
2013-02-25  1:17   ` Mark H Weaver
2013-02-25  9:06     ` Andy Wingo [this message]
2013-02-25 18:58       ` Mark H Weaver
2013-02-25 20:39         ` Andy Wingo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87621g92zl.fsf@pobox.com \
    --to=wingo@pobox.com \
    --cc=13768@debbugs.gnu.org \
    --cc=mhw@netris.org \
    --cc=shookie@email.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).