All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Américo Wang" <xiyou.wangcong@gmail.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Matt Mackall <mpm@selenic.com>,
	"Eric W. Biederman" <ebiederm@xmission.com>,
	Arjan van de Ven <arjan@infradead.org>, Jake Edge <jake@lwn.net>,
	security@kernel.org,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	James Morris <jmorris@namei.org>,
	linux-security-module@vger.kernel.org,
	Eric Paris <eparis@redhat.com>,
	Alan Cox <alan@lxorguk.ukuu.org.uk>,
	Roland McGrath <roland@redhat.com>,
	mingo@redhat.com, Andrew Morton <akpm@linux-foundation.org>,
	Greg KH <greg@kroah.com>, Dave Jones <davej@redhat.com>
Subject: Re: [patch] random: make get_random_int() more random
Date: Fri, 15 May 2009 09:16:17 +0800	[thread overview]
Message-ID: <2375c9f90905141816s4a9bfb8ck33dfc4395d2d9f00@mail.gmail.com> (raw)
In-Reply-To: <20090506200954.GA21484@elte.hu>

On Thu, May 7, 2009 at 4:09 AM, Ingo Molnar <mingo@elte.hu> wrote:
>
> * Linus Torvalds <torvalds@linux-foundation.org> wrote:
>
>> On Wed, 6 May 2009, Matt Mackall wrote:
>>
>> > On Wed, May 06, 2009 at 12:30:34PM +0200, Ingo Molnar wrote:
>>
>> > > (Also, obviously "only" covering 95% of the Linux systems has
>> > > its use as well. Most other architectures have their own cycle
>> > > counters as well.)
>> >
>> > X86 might be 95% of desktop. But it's a small fraction of Linux
>> > systems once you count cell phones, video players, TVs, cameras,
>> > GPS devices, cars, routers, etc. almost none of which are
>> > x86-based. In fact, just Linux cell phones (with about an 8%
>> > share of a 1.2billion devices per year market) dwarf Linux
>> > desktops (maybe 5% of a 200m/y market).
>>
>> Matt, are you willing to ack my suggested patch which adds history
>> to the mix? Did somebody test that? I have this memory of there
>> being an "exploit" program to show the non-randomness of the
>> values, but I can't recall details, and would really want to get a
>> second opinion from somebody who cares about PRNG's.
>
> I tested it, and besides booting up fine, i also tested the
> get_random_int() randomness. I did this by adding this quick
> trace_printk() line:
>
>   trace_printk("get_random_int(): %08x\n", get_random_int());
>
> to sys_prctl() and triggered sys_prctl() in a loop, which gave a
> list of get_random_int() numbers:
>
> # tracer: nop
> #
> #           TASK-PID    CPU#    TIMESTAMP  FUNCTION
> #              | |       |          |         |
>           <...>-6288  [000]   618.151323: sys_prctl: get_random_int(): 2e927f66
>           <...>-6290  [000]   618.152924: sys_prctl: get_random_int(): d210df1f
>           <...>-6293  [000]   618.155326: sys_prctl: get_random_int(): 753ad860
>           <...>-6295  [000]   618.156939: sys_prctl: get_random_int(): c74d935f
>           <...>-6298  [000]   618.159334: sys_prctl: get_random_int(): bb4e7597
>           <...>-6300  [000]   618.160936: sys_prctl: get_random_int(): b0119885
>           <...>-6303  [000]   618.163331: sys_prctl: get_random_int(): 093f5c70
>

I used systemtap to test this patch too, the result is too obvious. :-)
Samples of output are the following:

==before this patch==
get_random_int returns: f3f71569
get_random_int returns: f3f71569
get_random_int returns: f3f71569
get_random_int returns: f3f71569
get_random_int returns: f3f71569
get_random_int returns: f3f71569
get_random_int returns: c3e650c8
get_random_int returns: c3e650c8
get_random_int returns: c3e650c8
get_random_int returns: c3e650c8
get_random_int returns: c3e650c8
get_random_int returns: c3e650c8

==after this patch==
get_random_int returns: b7566a5b
get_random_int returns: f4b86171
get_random_int returns: 25dd8fd8
get_random_int returns: 58ab81ce
get_random_int returns: f39dbcb2
get_random_int returns: cbf308f9
get_random_int returns: 32d9c09e
get_random_int returns: 4eedfcad
get_random_int returns: fe87cb99
get_random_int returns: 1bd42857
get_random_int returns: 837cf921
get_random_int returns: d9a39d80


Hope this helps.

Thanks!

  parent reply	other threads:[~2009-05-15  1:16 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-04 18:51 [PATCH] proc: avoid information leaks to non-privileged processes Jake Edge
2009-05-04 19:00 ` [Security] " Linus Torvalds
2009-05-04 19:51   ` Arjan van de Ven
2009-05-04 20:20     ` Eric W. Biederman
2009-05-04 22:24       ` Linus Torvalds
2009-05-04 23:26         ` Arjan van de Ven
2009-05-04 23:54         ` Linus Torvalds
2009-05-05  7:51           ` Eric W. Biederman
2009-05-05 15:17             ` Linus Torvalds
2009-05-05 15:35               ` Linus Torvalds
2009-05-05 16:18                 ` Matt Mackall
2009-05-05 16:10               ` Matt Mackall
2009-05-05  5:50         ` Matt Mackall
2009-05-05  6:31           ` Ingo Molnar
2009-05-05  8:14             ` Eric W. Biederman
2009-05-05 19:52               ` Ingo Molnar
2009-05-05 20:22                 ` Matt Mackall
2009-05-05 21:20                   ` Eric W. Biederman
2009-05-06 10:33                     ` Ingo Molnar
2009-05-06 10:30                   ` Ingo Molnar
2009-05-06 16:25                     ` Matt Mackall
2009-05-06 16:48                       ` Linus Torvalds
2009-05-06 17:57                         ` Matt Mackall
2009-05-07  0:50                           ` Matt Mackall
2009-05-07 15:02                             ` Ingo Molnar
2009-05-07 18:14                               ` Matt Mackall
2009-05-07 18:21                                 ` Ingo Molnar
2009-05-07 18:41                                 ` Ingo Molnar
2009-05-07 19:24                                   ` Matt Mackall
2009-05-07 15:16                           ` Florian Weimer
2009-05-07 16:55                             ` Matt Mackall
2009-05-07 17:53                               ` Linus Torvalds
2009-05-07 18:42                                 ` Matt Mackall
2009-05-06 20:09                         ` [patch] random: make get_random_int() more random Ingo Molnar
2009-05-06 20:41                           ` Matt Mackall
2009-05-06 20:51                             ` Ingo Molnar
2009-05-06 21:10                               ` Matt Mackall
2009-05-06 21:24                                 ` Ingo Molnar
2009-05-14 22:47                           ` Jake Edge
2009-05-14 22:55                             ` [Security] " Linus Torvalds
2009-05-15 13:47                               ` Ingo Molnar
2009-05-15 15:10                                 ` Jake Edge
2009-05-16 10:00                                 ` Willy Tarreau
2009-05-16 10:39                                   ` Ingo Molnar
2009-05-16 12:02                                     ` Eric W. Biederman
2009-05-16 14:00                                       ` Michael S. Zick
2009-05-16 14:28                                         ` Michael S. Zick
2009-05-16 14:57                                           ` Arjan van de Ven
2009-05-16 15:09                                             ` Michael S. Zick
2009-05-16 14:32                                       ` Matt Mackall
2009-05-16 13:58                                     ` Willy Tarreau
2009-05-16 15:23                                       ` Linus Torvalds
2009-05-16 15:47                                         ` Willy Tarreau
2009-05-16 15:54                                         ` Oliver Neukum
2009-05-16 16:05                                           ` Linus Torvalds
2009-05-16 16:17                                             ` Linus Torvalds
2009-05-15  1:16                           ` Américo Wang [this message]
2009-05-06 20:25                       ` [Security] [PATCH] proc: avoid information leaks to non-privileged processes Ingo Molnar
2009-05-06 20:52                         ` Matt Mackall
2009-05-05  8:58           ` Andi Kleen

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=2375c9f90905141816s4a9bfb8ck33dfc4395d2d9f00@mail.gmail.com \
    --to=xiyou.wangcong@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=arjan@infradead.org \
    --cc=davej@redhat.com \
    --cc=ebiederm@xmission.com \
    --cc=eparis@redhat.com \
    --cc=greg@kroah.com \
    --cc=jake@lwn.net \
    --cc=jmorris@namei.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=mingo@redhat.com \
    --cc=mpm@selenic.com \
    --cc=roland@redhat.com \
    --cc=security@kernel.org \
    --cc=torvalds@linux-foundation.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.