Skip to content
Commit f7e466e9 authored by David Keisar Schmidt's avatar David Keisar Schmidt Committed by Vlastimil Babka
Browse files

mm/slab: Replace invocation of weak PRNG



The Slab allocator randomization uses the prandom_u32
PRNG. That was added to prevent attackers to obtain information on the heap
state, by randomizing the freelists state.

However, this PRNG turned out to be weak, as noted in commit c51f8f88
To fix it, we have changed the invocation of prandom_u32_state to get_random_u32
to ensure the PRNG is strong. Since a modulo operation is applied right after that,
we used get_random_u32_below, to achieve uniformity.

In addition, we changed the freelist_init_state union to struct,
since the rnd_state inside which is used to store the state of prandom_u32,
is not needed anymore, since get_random_u32 maintains its own state.

Signed-off-by: default avatarDavid Keisar Schmidt <david.keisarschm@mail.huji.ac.il>
Signed-off-by: default avatarVlastimil Babka <vbabka@suse.cz>
parent 44c026a7
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment