Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1711326

Re: early x86 unseeded randomness

From Linus Torvalds <torvalds@linux-foundation.org>
Newsgroups linux.kernel
Subject Re: early x86 unseeded randomness
Date 2017-08-14 20:20 +0200
Message-ID <ues81-7vo-5@gated-at.bofh.it> (permalink)
References <uervj-72Y-9@gated-at.bofh.it> <uerF1-76t-19@gated-at.bofh.it> <uerYm-7s4-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Mon, Aug 14, 2017 at 11:00 AM, Borislav Petkov <bp@alien8.de> wrote:
> On Mon, Aug 14, 2017 at 10:47:47AM -0700, Linus Torvalds wrote:
>> Plus on modern x86, you'll always get at least the hardware
>> randomness, which is fundamentally much better anyway.
>
> Right, my only intention was to get rid of those:
>
> [    0.000000] random: get_random_bytes called from start_kernel+0x30/0x3d8 with crng_init=0

Ok, guys, you ALL need to learn that blindly just trying to get rid of
warnings IS A HORRIBLE IDEA.

People also need to learn that *adding* warnings isn't always a good
idea, exactly because then people will mindlessly react to them.

I *detest* bad compiler warnings for this reason. The number of
garbage patches that actually break working code that I've seen over
the year is mind-numbing.

> What do you propose? Keep 'em?

Keeping the warning (or removing the warning itself without changing
the code) is certainly preferable to trying to "fix" the warning by
bogus measures, yes.

> Or fix the above, snipped bit to conditionally do rdtsc() *once* or
> get_random_bytes() depending on the crng state?

Neither. Let's aim to make sure to fix the warning the *only* correct
way - by making sure the initialization _ordering_ is correct, not by
hacking around the caller code.

Maybe the warning message should be clarified to say that too. Make it
clear that the only acceptable fix is to change code ordering, not to
play games with randomness.

But maybe those places that currently trigger the warning should just
use "get_random_u32()" instead. That at least gets rid of the warning
if there's a fast architected hardware random thing (ie modern x86).

                       Linus

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

early x86 unseeded randomness Borislav Petkov <bp@alien8.de> - 2017-08-14 19:40 +0200
  Re: early x86 unseeded randomness Linus Torvalds <torvalds@linux-foundation.org> - 2017-08-14 19:50 +0200
    Re: early x86 unseeded randomness Borislav Petkov <bp@alien8.de> - 2017-08-14 20:10 +0200
      Re: early x86 unseeded randomness Linus Torvalds <torvalds@linux-foundation.org> - 2017-08-14 20:20 +0200
        Re: early x86 unseeded randomness Borislav Petkov <bp@alien8.de> - 2017-08-14 21:10 +0200
          Re: early x86 unseeded randomness Theodore Ts'o <tytso@mit.edu> - 2017-08-15 03:40 +0200
            Re: early x86 unseeded randomness Willy Tarreau <w@1wt.eu> - 2017-08-15 08:50 +0200
              Re: early x86 unseeded randomness Ingo Molnar <mingo@kernel.org> - 2017-08-15 09:50 +0200
                Re: early x86 unseeded randomness Willy Tarreau <w@1wt.eu> - 2017-08-15 10:10 +0200
                Re: early x86 unseeded randomness Ingo Molnar <mingo@kernel.org> - 2017-08-15 10:10 +0200
                Re: early x86 unseeded randomness Theodore Ts'o <tytso@mit.edu> - 2017-08-15 14:20 +0200
                Re: early x86 unseeded randomness Willy Tarreau <w@1wt.eu> - 2017-08-15 15:30 +0200
                Re: early x86 unseeded randomness Thomas Gleixner <tglx@linutronix.de> - 2017-08-15 12:50 +0200
                Re: early x86 unseeded randomness Borislav Petkov <bp@alien8.de> - 2017-08-15 15:50 +0200
                Re: early x86 unseeded randomness Thomas Gleixner <tglx@linutronix.de> - 2017-08-15 15:50 +0200
                Re: early x86 unseeded randomness Theodore Ts'o <tytso@mit.edu> - 2017-08-15 16:30 +0200
                Re: early x86 unseeded randomness Thomas Gleixner <tglx@linutronix.de> - 2017-08-15 16:50 +0200
                Re: early x86 unseeded randomness Borislav Petkov <bp@alien8.de> - 2017-08-15 17:30 +0200
                Re: early x86 unseeded randomness Thomas Gleixner <tglx@linutronix.de> - 2017-08-15 19:40 +0200
                Re: early x86 unseeded randomness Theodore Ts'o <tytso@mit.edu> - 2017-08-16 05:40 +0200
                Re: early x86 unseeded randomness Thomas Gleixner <tglx@linutronix.de> - 2017-08-16 11:20 +0200
                Re: early x86 unseeded randomness Will Deacon <will.deacon@arm.com> - 2017-08-16 12:00 +0200
                Re: early x86 unseeded randomness Theodore Ts'o <tytso@mit.edu> - 2017-08-16 05:30 +0200
                Re: early x86 unseeded randomness Borislav Petkov <bp@alien8.de> - 2017-08-15 17:30 +0200
                Re: early x86 unseeded randomness Michael Ellerman <mpe@ellerman.id.au> - 2017-08-15 14:50 +0200

csiph-web