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

From: Jason A. Donenfeld
Date: Sun Apr 16 2023 - 13:26:23 EST


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.