freebsd-dev/sys/dev/random
Conrad Meyer 374c99911e random(4): Make entropy source deregistration safe
Allow loadable modules that provide random entropy source(s) to safely
unload.  Prior to this change, no driver could ensure that their
random_source structure was not being used by random_harvestq.c for any
period of time after invoking random_source_deregister().

This change converts the source_list LIST to a ConcurrencyKit CK_LIST and
uses an epoch(9) to protect typical read accesses of the list.  The existing
HARVEST_LOCK spin mutex is used to safely add and remove list entries.
random_source_deregister() uses epoch_wait() to ensure no concurrent
source_list readers are accessing a random_source before freeing the list
item and returning to the caller.

Callers can safely unload immediately after random_source_deregister()
returns.

Reviewed by:	markj
Approved by:	csprng(markm)
Discussed with:	jhb
Differential Revision:	https://reviews.freebsd.org/D22489
2019-12-30 01:38:19 +00:00
..
build.sh Remove the Yarrow PRNG algorithm option in accordance with due notice 2018-08-26 12:51:46 +00:00
darn.c random(4): Reorder configuration of random source modules 2019-08-18 16:04:01 +00:00
fortuna.c random(4): Simplify RANDOM_LOADABLE 2019-12-26 19:32:11 +00:00
fortuna.h random(4): Fortuna: allow increased concurrency 2019-06-17 20:29:13 +00:00
hash.c random(4): Flip default Fortuna generator over to Chacha20 2019-12-20 21:11:00 +00:00
hash.h random(4): Fortuna: allow increased concurrency 2019-06-17 20:29:13 +00:00
ivy.c random/ivy: Provide mechanism to read independent seed values from rdrand 2019-11-22 19:30:31 +00:00
nehemiah.c random(4): Reorder configuration of random source modules 2019-08-18 16:04:01 +00:00
other_algorithm.c random(4): Simplify RANDOM_LOADABLE 2019-12-26 19:32:11 +00:00
other_algorithm.h Remove the Yarrow PRNG algorithm option in accordance with due notice 2018-08-26 12:51:46 +00:00
random_harvestq.c random(4): Make entropy source deregistration safe 2019-12-30 01:38:19 +00:00
random_harvestq.h Remove the Yarrow PRNG algorithm option in accordance with due notice 2018-08-26 12:51:46 +00:00
random_infra.c random(4): Simplify RANDOM_LOADABLE 2019-12-26 19:32:11 +00:00
randomdev.c random(4): Simplify RANDOM_LOADABLE 2019-12-26 19:32:11 +00:00
randomdev.h random(4): Simplify RANDOM_LOADABLE 2019-12-26 19:32:11 +00:00
uint128.h random(4): Fortuna: allow increased concurrency 2019-06-17 20:29:13 +00:00
unit_test.c Remove the Yarrow PRNG algorithm option in accordance with due notice 2018-08-26 12:51:46 +00:00
unit_test.h Remove the Yarrow PRNG algorithm option in accordance with due notice 2018-08-26 12:51:46 +00:00