random: provide notifier for VM fork
authorJason A. Donenfeld <Jason@zx2c4.com>
Tue, 1 Mar 2022 19:22:39 +0000 (20:22 +0100)
committerJason A. Donenfeld <Jason@zx2c4.com>
Sun, 13 Mar 2022 01:00:56 +0000 (18:00 -0700)
commitf3c2682bad7bc6033c837e9c66e5af881fe8d465
treef0101c73dee541fd4cd6e599e26f5e5b1195190e
parent5acd35487dc911541672b3ffc322851769c32a56
random: provide notifier for VM fork

Drivers such as WireGuard need to learn when VMs fork in order to clear
sessions. This commit provides a simple notifier_block for that, with a
register and unregister function. When no VM fork detection is compiled
in, this turns into a no-op, similar to how the power notifier works.

Cc: Dominik Brodowski <linux@dominikbrodowski.net>
Cc: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
drivers/char/random.c
include/linux/random.h