diff options
author | Eric Biggers <ebiggers@google.com> | 2021-12-20 16:41:56 -0600 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2022-01-07 00:25:25 +0100 |
commit | 5d73d1e320c3fd94ea15ba5f79301da9a8bcc7de (patch) | |
tree | 3afcc8fcd066d926a5b358b853df7c35e3611300 /arch/x86/crypto | |
parent | 5320eb42dec7a7ef3ab7da3c5c0d7f889a5181e5 (diff) |
random: fix data race on crng_node_pool
extract_crng() and crng_backtrack_protect() load crng_node_pool with a
plain load, which causes undefined behavior if do_numa_crng_init()
modifies it concurrently.
Fix this by using READ_ONCE(). Note: as per the previous discussion
https://lore.kernel.org/lkml/20211219025139.31085-1-ebiggers@kernel.org/T/#u,
READ_ONCE() is believed to be sufficient here, and it was requested that
it be used here instead of smp_load_acquire().
Also change do_numa_crng_init() to set crng_node_pool using
cmpxchg_release() instead of mb() + cmpxchg(), as the former is
sufficient here but is more lightweight.
Fixes: 1e7f583af67b ("random: make /dev/urandom scalable for silly userspace programs")
Cc: stable@vger.kernel.org
Signed-off-by: Eric Biggers <ebiggers@google.com>
Acked-by: Paul E. McKenney <paulmck@kernel.org>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'arch/x86/crypto')
0 files changed, 0 insertions, 0 deletions