Commit 08475dab authored by Jason A. Donenfeld's avatar Jason A. Donenfeld

kfence: use better stack hash seed

As of the prior commit, the RNG will have incorporated both a cycle
counter value and RDRAND, in addition to various other environmental
noise. Therefore, using get_random_u32() will supply a stronger seed
than simply using random_get_entropy(). N.B.: random_get_entropy()
should be considered an internal API of random.c and not generally
consumed.

Cc: Alexander Potapenko <glider@google.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: default avatarMarco Elver <elver@google.com>
Signed-off-by: default avatarJason A. Donenfeld <Jason@zx2c4.com>
parent f6238499
......@@ -864,7 +864,7 @@ static void kfence_init_enable(void)
void __init kfence_init(void)
{
stack_hash_seed = (u32)random_get_entropy();
stack_hash_seed = get_random_u32();
/* Setting kfence_sample_interval to 0 on boot disables KFENCE. */
if (!kfence_sample_interval)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment