Re: x86/random: Speculation to the rescue
From: Linus Torvalds
Date: Tue Oct 01 2019 - 13:15:02 EST
On Tue, Oct 1, 2019 at 6:51 AM Borislav Petkov <bp@xxxxxxxxx> wrote:
>
> So when I add this by hand and do git diff, it adds a second hunk:
You and me both.
We both have editors that always add line-endings, and right now that
file doesn't have a newline at the end of the file thanks to commit
428826f5358c ("fdt: add support for rng-seed").
> and I kinda get what it is trying to tell me but this is new. And when I
> do
>
> $ xxd drivers/char/random.c
> ..
>
> 000125e0: 646f 6d6e 6573 7329 3b0a domness);.
>
> there's a 0xa at the end so what's git really trying to tell me?
The previous state of the file didn't have that 0xa at the end, so you get that
-EXPORT_SYMBOL_GPL(add_bootloader_randomness);
\ No newline at end of file
+EXPORT_SYMBOL_GPL(add_bootloader_randomness);
which is "the '-' line doesn't have a newline, the '+' line does" marker.
> > Doing something like the above to /dev/urandom is likely the right
> > thing to do eventually, but I didn't want to mix up "we can perhaps
> > improve the urandom situation too" with the basic "let's fix the boot
> > problem". The urandom behavior change would be a separate thing.
>
> So make it a separate patch and let's hammer on it during the next weeks
> and see what happens?
Yeah, probably.
> > Also, talking about "future changes". Right now
> > "try_to_generate_entropy()" is actually uninterruptible once it gets
> > started. I think we should add a test for signal_pending() too, but it
>
> Wouldn't that even increase its entropy, which would be a good thing?
I'm not sure it increases it, but it certainly shouldn't make it any worse.
Linus