提交 e5d5546f 编写于 作者: J Jason A. Donenfeld 提交者: Zheng Zengkai

random: do not take pool spinlock at boot

stable inclusion
from stable-v5.10.119
commit f656bd0011fd128d482fb75f45cd564578984473
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I5L6BB

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=f656bd0011fd128d482fb75f45cd564578984473

--------------------------------

commit afba0b80 upstream.

Since rand_initialize() is run while interrupts are still off and
nothing else is running, we don't need to repeatedly take and release
the pool spinlock, especially in the RDSEED loop.
Reviewed-by: NEric Biggers <ebiggers@google.com>
Reviewed-by: NDominik Brodowski <linux@dominikbrodowski.net>
Signed-off-by: NJason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
上级 003d92a3
...@@ -978,10 +978,10 @@ int __init rand_initialize(void) ...@@ -978,10 +978,10 @@ int __init rand_initialize(void)
rv = random_get_entropy(); rv = random_get_entropy();
arch_init = false; arch_init = false;
} }
mix_pool_bytes(&rv, sizeof(rv)); _mix_pool_bytes(&rv, sizeof(rv));
} }
mix_pool_bytes(&now, sizeof(now)); _mix_pool_bytes(&now, sizeof(now));
mix_pool_bytes(utsname(), sizeof(*(utsname()))); _mix_pool_bytes(utsname(), sizeof(*(utsname())));
extract_entropy(base_crng.key, sizeof(base_crng.key)); extract_entropy(base_crng.key, sizeof(base_crng.key));
++base_crng.generation; ++base_crng.generation;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册