Re: [kernel-hardening] Re: get_random_bytes returns bad randomness before seeding is complete

From: Jason A. Donenfeld
Date: Fri Jun 02 2017 - 13:46:52 EST


On Fri, Jun 2, 2017 at 7:41 PM, Daniel Micay <danielmicay@xxxxxxxxx> wrote:
> One of the early uses is initializing the stack canary value for SSP in
> very early boot. If that blocks, it's going to be blocking nearly
> anything else from happening.
>
> On x86, that's only the initial canary since the per-task canaries end
> up being used, but elsewhere at least without SMP disabled or changes to
> GCC that's all there is so the entropy matters.

If this is the case, then we simply need a function called
get_random_bytes_but_potentially_crappy_ones_because_we_are_desperate_for_anything(),
which would respond with a weaker guarantee than that
get_random_bytes(), which the documentation says always returns
cryptographically secure numbers.