mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 18:40:43 +03:00
libspl/random: add switch to force pseudo-random numbers for all calls
ztest wants to force all kernel random calls to use the pseudo-random generator (/dev/urandom), to avoid depleting the system entropy pool just for testing. Up until the previous commit, it did this by switching the path that the libzpool (now libspl) random API would use to get random data from; that is, it took advantage of an implementation detail. Now that that hole is closed to it, we need another method. This commit introduces that; a simple API call to enable/disable "force pseudo" mode. Sponsored-by: https://despairlabs.com/sponsor/ Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Rob Norris <robn@despairlabs.com> Closes #17861
This commit is contained in:
committed by
Brian Behlendorf
parent
4d451bae8a
commit
23d17f3587
@@ -8952,6 +8952,12 @@ main(int argc, char **argv)
|
||||
|
||||
libspl_init();
|
||||
|
||||
/*
|
||||
* Force random_get_bytes() to use /dev/urandom in order to prevent
|
||||
* ztest from needlessly depleting the system entropy pool.
|
||||
*/
|
||||
random_force_pseudo(B_TRUE);
|
||||
|
||||
if (!fd_data_str) {
|
||||
process_options(argc, argv);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user