LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Ulrich Drepper <drepper@redhat.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Kees Cook <kees.cook@canonical.com>,
	jakub@redhat.com, arjan@infradead.org, roland@redhat.com,
	linux-kernel@vger.kernel.org, libc-alpha@sourceware.org
Subject: Re: [PATCH v5] ELF: implement AT_RANDOM for glibc PRNG seeding
Date: Tue, 21 Oct 2008 13:22:18 -0700	[thread overview]
Message-ID: <48FE39FA.9030601@redhat.com> (raw)
In-Reply-To: <20081021130111.b8d73625.akpm@linux-foundation.org>

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Andrew Morton wrote:
> I read the above changeloglet and read the above-linked page and it's
> still 87% unclear to me what this feature does.  Something to do with
> stack randomisation, apparently.  I suppose I could go do further
> hunting, but from the quality-of-changelog POV I don't think I should
> need to do so.

Not stack randomization.  glibc needs right after startup a bit of
random data for internal protections (stack canary etc).  What is now in
upstream glibc is that we always unconditionally open /dev/urandom, read
some data, and use it.  For every process startup.  That's slow.

In addition Andi mentioned that this use of /dev/urandom might be
problematic.  I let him explain this.

The solution is to provide a limited amount of random data to the
starting process in the aux vector.  I suggested 16 bytes and this is
what the patch implements.  If we need only 16 bytes or less we use the
data directly.  If we need more we'll use the 16 bytes to see a PRNG.
This avoids the costly /dev/urandom use and it allows the kernel to use
the most adequate source of random data for this purpose.  It might not
be the same pool as that for /dev/urandom.


> It's unclear to me that the random-number issue got sorted out?

I think the last patch used the normal function to get 16 random bytes,
equivalent to the data used for stack randomization etc.

If Andi has concrete proposals for a revamp of the use of entropy in the
kernel this can be easily done as an add-on.  This patch doesn't make
the situation worse, it doesn't deplete entropy more than it happens now.

- --
➧ Ulrich Drepper ➧ Red Hat, Inc. ➧ 444 Castro St ➧ Mountain View, CA ❖
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkj+OfoACgkQ2ijCOnn/RHST+gCfTriVvBAdfYNXSPuklog3V47u
/2kAnipBxYx7IFZe/M2zc6MOnDZkalSb
=JpXN
-----END PGP SIGNATURE-----

  reply	other threads:[~2008-10-21 20:23 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20081001201116.GD12527@outflux.net>
     [not found] ` <48E3EFD6.2010704@redhat.com>
     [not found]   ` <20081001215657.GH12527@outflux.net>
     [not found]     ` <20081001220948.GC32107@sunsite.ms.mff.cuni.cz>
     [not found]       ` <20081001222706.68E7E1544B4@magilla.localdomain>
2008-10-03  0:16         ` [PATCH] ELF: implement AT_RANDOM for future glibc use Kees Cook
2008-10-03  0:43           ` Jakub Jelinek
2008-10-03  5:25             ` Kees Cook
2008-10-03  5:29             ` Kees Cook
2008-10-03  5:57               ` Arjan van de Ven
2008-10-03  6:25                 ` Ulrich Drepper
2008-10-03 14:50                   ` [PATCH] ELF: implement AT_RANDOM for glibc PRNG seeding Kees Cook
2008-10-03 14:56                     ` Ulrich Drepper
2008-10-03 14:57                     ` Jakub Jelinek
2008-10-03 17:33                       ` Kees Cook
2008-10-03 17:41                         ` Ulrich Drepper
2008-10-03 17:59                           ` [PATCH v5] " Kees Cook
2008-10-18  5:42                             ` Ulrich Drepper
2008-10-21 20:01                             ` Andrew Morton
2008-10-21 20:22                               ` Ulrich Drepper [this message]
2008-10-27  5:46                                 ` Andrew Morton
2008-10-03  0:52           ` [PATCH] ELF: implement AT_RANDOM for future glibc use Roland McGrath
2008-10-03  5:15             ` Kees Cook
2008-10-03 20:22               ` Roland McGrath
2008-10-06  6:00           ` Andi Kleen
2008-10-06 17:50             ` Kees Cook
2008-10-06 18:25               ` David Wagner
2008-10-06 20:23                 ` Andi Kleen
2008-10-06 22:16                   ` David Wagner
2008-10-06 19:26               ` Andi Kleen
2008-10-06 22:01                 ` Kees Cook
2008-10-06 23:19                   ` Andi Kleen
2008-10-06 23:29                     ` Kees Cook
2008-10-06 23:44                       ` Andi Kleen
2008-10-06 22:07                 ` Kees Cook
2008-10-06 23:28                   ` Andi Kleen
2008-10-06 23:58                   ` Roland McGrath
2008-10-07  0:08                     ` Ulrich Drepper
2008-10-07  0:31                     ` Kees Cook
2008-10-07  0:57                       ` Ulrich Drepper
2008-10-07  1:44                         ` Kees Cook
2008-10-07  1:51                           ` Ulrich Drepper

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

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

  git send-email \
    --in-reply-to=48FE39FA.9030601@redhat.com \
    --to=drepper@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=arjan@infradead.org \
    --cc=jakub@redhat.com \
    --cc=kees.cook@canonical.com \
    --cc=libc-alpha@sourceware.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=roland@redhat.com \
    --subject='Re: [PATCH v5] ELF: implement AT_RANDOM for glibc PRNG seeding' \
    /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

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 NNTP newsgroup(s).