Re: [PATCH v6 3/3] arch/x86/mm/kaslr: use siphash instead of prandom_bytes_state

From: David Keisar Schm
Date: Sun Apr 23 2023 - 03:30:44 EST


On Sun, Apr 16, 2023 at 8:26 PM Jason A. Donenfeld <Jason@xxxxxxxxx> wrote:
>
> On 4/16/23, david.keisarschm@xxxxxxxxxxxxxxx
> <david.keisarschm@xxxxxxxxxxxxxxx> wrote:
> > From: David Keisar Schmidt <david.keisarschm@xxxxxxxxxxxxxxx>
> >
> > However, the seeding here is done by calling prandom_seed_state,
> > which effectively uses only 32bits of the seed, which means that observing
> > ONE
> > region's offset (say 30 bits) can provide the attacker with 2 possible
> > seeds
> > (from which the attacker can calculate the remaining two regions)
> >
> > In order to fix it, we have replaced the two invocations of
> > prandom_bytes_state and prandom_seed_state
> > with siphash, which is considered more secure.
> > Besides, the original code used the same pseudo-random number in every
> > iteration,
> > so to add some additional randomization
> > we call siphash every iteration, hashing the iteration index with the
> > described key.
> >
> >
>
> Nack. Please don't add bespoke new RNG constructions willy nilly. I
> just spent a while cleaning this kind of thing up.

Hi Jason,

Thank you for reviewing our revised patch. We appreciate your concern
regarding the use of custom RNG constructions, and we understand the
potential issues that could arise from doing so.

However, we wanted to clarify that our intention was to use a
deterministic PRNG that meets Kees Cook's requirements for debugging
and performance analysis purposes.

We also acknowledge that using a custom RNG could introduce additional
risks, and we're open to exploring alternative solutions that meet our
requirements.

If you have any suggestions for a more secure and deterministic RNG,
we'd be happy to hear them and implement them.