Skip to content

Commit 08475da

Browse files
committed
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 <[email protected]> Cc: Dmitry Vyukov <[email protected]> Cc: Andrew Morton <[email protected]> Reviewed-by: Marco Elver <[email protected]> Signed-off-by: Jason A. Donenfeld <[email protected]>
1 parent f623849 commit 08475da

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mm/kfence/core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -864,7 +864,7 @@ static void kfence_init_enable(void)
864864

865865
void __init kfence_init(void)
866866
{
867-
stack_hash_seed = (u32)random_get_entropy();
867+
stack_hash_seed = get_random_u32();
868868

869869
/* Setting kfence_sample_interval to 0 on boot disables KFENCE. */
870870
if (!kfence_sample_interval)

0 commit comments

Comments
 (0)