HomeFreeBSD

Linux: Upgrade random_get_pseudo_bytes() to xoshiro256++ 1.0

Description

Linux: Upgrade random_get_pseudo_bytes() to xoshiro256++ 1.0

The motivation for upgrading our PRNG is the recent buildbot failures in
the ZTS' tests/functional/fault/decompress_fault test. The probability
of a failure in that test is 0.8^256, which is ~1.6e-25 out of 1, yet we
have observed multiple test failures in it. This suggests a problem with
our random number generation.

The xorshift128+ generator that we were using has been replaced by newer
generators that have "better statistical properties". After doing some
reading, it turns out that these generators have "low linear complexity
of the lowest bits", which could explain the ZTS test failures.

We do two things to try to fix this:

  1. We upgrade from xorshift128+ to xoshiro256++ 1.0.
  1. We tweak random_get_pseudo_bytes() to copy the higher order
	   bytes first.

It is hoped that this will fix the test failures in
tests/functional/fault/decompress_fault, although I have not done
simulations. I am skeptical that any simulations I do on a PRNG with a
period of 2^256 - 1 would be meaningful.

Since we have raised the minimum kernel version to 3.10 since this was
first implemented, we have the option of using the Linux kernel's
get_random_int(). However, I am not currently prepared to do performance
tests to ensure that this would not be a regression (for the time
being), so we opt for upgrading our PRNG to a newer one from Sebastiano
Vigna.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Tino Reichardt <milky-zfs@mcmilk.de>
Signed-off-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Closes #13983

Details

Provenance
Richard Yao <richard.yao@alumni.stonybrook.edu>Authored on Oct 20 2022, 9:14 PM
GitHub <noreply@github.com>Committed on Oct 20 2022, 9:14 PM
Parents
rG9dcdee788985: Optimize microzaps
Branches
Unknown
Tags
Unknown

Event Timeline

GitHub <noreply@github.com> committed rGa06df8d7c1ec: Linux: Upgrade random_get_pseudo_bytes() to xoshiro256++ 1.0 (authored by Richard Yao <richard.yao@alumni.stonybrook.edu>).Oct 20 2022, 9:14 PM