From: Kees Cook <keescook@chromium.org>
To: "Ahmed S. Darwish" <darwish.07@gmail.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
Thomas Gleixner <tglx@linutronix.de>,
a.darwish@linutronix.de, LKML <linux-kernel@vger.kernel.org>,
Theodore Ts'o <tytso@mit.edu>,
Nicholas Mc Guire <hofrat@opentech.at>,
the arch/x86 maintainers <x86@kernel.org>,
Andy Lutomirski <luto@kernel.org>
Subject: Re: x86/random: Speculation to the rescue
Date: Tue, 1 Oct 2019 09:37:39 -0700 [thread overview]
Message-ID: <201910010932.C6DF862@keescook> (raw)
In-Reply-To: <20191001161448.GA1918@darwi-home-pc>
On Tue, Oct 01, 2019 at 06:15:02PM +0200, Ahmed S. Darwish wrote:
> On Sat, Sep 28, 2019 at 04:53:52PM -0700, Linus Torvalds wrote:
> > Ahmed - would you be willing to test this on your problem case (with
> > the ext4 optimization re-enabled, of course)?
> >
>
> So I pulled the patch and the revert of the ext4 revert as they're all
> now merged in master. It of course made the problem go away...
>
> To test the quality of the new jitter code, I added a small patch on
> top to disable all other sources of randomness except the new jitter
> entropy code, [1] and made quick tests on the quality of getrandom(0).
>
> Using the "ent" tool, [2] also used to test randomness in the Stephen
> Müller LRNG paper, on a 500000-byte file, produced the following
> results:
>
> $ ent rand-file
>
> Entropy = 7.999625 bits per byte.
>
> Optimum compression would reduce the size of this 500000 byte file
> by 0 percent.
>
> Chi square distribution for 500000 samples is 259.43, and randomly
> would exceed this value 41.11 percent of the times.
>
> Arithmetic mean value of data bytes is 127.4085 (127.5 = random).
>
> Monte Carlo value for Pi is 3.148476594 (error 0.22 percent).
>
> Serial correlation coefficient is 0.001740 (totally uncorrelated = 0.0).
>
> As can be seen above, everything looks random, and almost all of the
> statistical randomness tests matched the same kernel without the
> "jitter + schedule()" patch added (after getting it un-stuck).
Can you post the patch for [1]? Another test we should do is the
multi-boot test. Testing the stream (with ent, or with my dieharder run)
is mainly testing the RNG algo. I'd like to see if the first 8 bytes
out of the kernel RNG change between multiple boots of the same system.
e.g. read the first 8 bytes, for each of 100000 boots, and feed THAT
byte "stream" into ent...
--
Kees Cook
next prev parent reply other threads:[~2019-10-01 16:37 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-28 22:24 x86/random: Speculation to the rescue Thomas Gleixner
2019-09-28 23:53 ` Linus Torvalds
2019-09-29 7:40 ` Thomas Gleixner
2019-09-29 8:05 ` Alexander E. Patrakov
2019-09-30 1:16 ` Linus Torvalds
2019-09-30 2:59 ` Linus Torvalds
2019-09-30 6:10 ` Borislav Petkov
2019-09-30 16:06 ` Linus Torvalds
2019-10-01 13:51 ` Borislav Petkov
2019-10-01 17:14 ` Linus Torvalds
2019-10-01 17:50 ` [PATCH] char/random: Add a newline at the end of the file Borislav Petkov
2019-09-30 18:05 ` x86/random: Speculation to the rescue Kees Cook
2019-09-30 3:37 ` Theodore Y. Ts'o
2019-09-30 13:16 ` Theodore Y. Ts'o
2019-09-30 16:15 ` Linus Torvalds
2019-09-30 16:32 ` Peter Zijlstra
2019-09-30 17:03 ` Linus Torvalds
2019-10-01 10:28 ` David Laight
2019-10-15 21:50 ` Thomas Gleixner
2019-10-01 16:15 ` Ahmed S. Darwish
2019-10-01 16:37 ` Kees Cook [this message]
2019-10-01 17:18 ` Ahmed S. Darwish
2019-10-01 17:25 ` Linus Torvalds
2019-10-06 12:07 ` Pavel Machek
2019-10-02 12:01 ` Theodore Y. Ts'o
2019-10-06 11:41 ` Pavel Machek
2019-10-06 17:26 ` Linus Torvalds
2019-10-06 17:35 ` Pavel Machek
2019-10-06 18:06 ` Linus Torvalds
2019-10-06 18:21 ` Pavel Machek
2019-10-06 18:26 ` Linus Torvalds
2019-10-07 11:47 ` Theodore Y. Ts'o
2019-10-07 22:18 ` Pavel Machek
2019-10-08 11:33 ` David Laight
2019-10-09 8:02 ` Pavel Machek
2019-10-09 9:37 ` David Laight
-- strict thread matches above, loose matches on Subject: below --
2019-10-01 2:14 hgntkwis
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=201910010932.C6DF862@keescook \
--to=keescook@chromium.org \
--cc=a.darwish@linutronix.de \
--cc=darwish.07@gmail.com \
--cc=hofrat@opentech.at \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
--cc=tytso@mit.edu \
--cc=x86@kernel.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.