summaryrefslogtreecommitdiffstats
path: root/drivers/char/mem.c
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2022-02-13 18:25:07 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2022-02-28 16:05:25 +0100
commitc2a7de4feb6e09f23af7accc0f882a8fa92e7ae5 (patch)
tree3e18dcd9d8c04016acdda9b5a4eed3ebaa5135fc /drivers/char/mem.c
parentabded93ec1e9692920fe309f07f40bd1035f2940 (diff)
downloadlinux-c2a7de4feb6e09f23af7accc0f882a8fa92e7ae5.tar.gz
linux-c2a7de4feb6e09f23af7accc0f882a8fa92e7ae5.tar.bz2
linux-c2a7de4feb6e09f23af7accc0f882a8fa92e7ae5.zip
random: do crng pre-init loading in worker rather than irq
Taking spinlocks from IRQ context is generally problematic for PREEMPT_RT. That is, in part, why we take trylocks instead. However, a spin_try_lock() is also problematic since another spin_lock() invocation can potentially PI-boost the wrong task, as the spin_try_lock() is invoked from an IRQ-context, so the task on CPU (random task or idle) is not the actual owner. Additionally, by deferring the crng pre-init loading to the worker, we can use the cryptographic hash function rather than xor, which is perhaps a meaningful difference when considering this data has only been through the relatively weak fast_mix() function. The biggest downside of this approach is that the pre-init loading is now deferred until later, which means things that need random numbers after interrupts are enabled, but before workqueues are running -- or before this particular worker manages to run -- are going to get into trouble. Hopefully in the real world, this window is rather small, especially since this code won't run until 64 interrupts had occurred. Cc: Sultan Alsawaf <sultan@kerneltoast.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Eric Biggers <ebiggers@kernel.org> Cc: Theodore Ts'o <tytso@mit.edu> Acked-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Reviewed-by: Dominik Brodowski <linux@dominikbrodowski.net> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'drivers/char/mem.c')
0 files changed, 0 insertions, 0 deletions