]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
random(9): Restore historical [0,2^31-1] output range and related man
authorLawrence Stewart <lstewart@FreeBSD.org>
Wed, 24 Mar 2021 04:25:49 +0000 (15:25 +1100)
committerLawrence Stewart <lstewart@FreeBSD.org>
Wed, 24 Mar 2021 05:14:58 +0000 (16:14 +1100)
commitdbbf3e3f37d67d3eae0931855f8b62b9b299b80a
tree0b18513509bf267880edd1f2e67ac6062ee467a8
parent64c01719e476923fe1b24e5a6c6012a677cd017f
random(9): Restore historical [0,2^31-1] output range and related man
documention.

Commit SVN r364219 / Git 8a0edc914ffd changed random(9) to be a shim around
prng32(9) and inadvertently caused random(9) to begin returning numbers in the
range [0,2^32-1] instead of [0,2^31-1], where the latter has been the documented
range for decades.

The increased output range has been identified as the source of numerous bugs in
code written against the historical output range e.g. ipfw "prob" rules and
stats(3) are known to be affected, and a non-exhaustive audit of the tree
identified other random(9) consumers which are also likely affected.

As random(9) is deprecated and slated for eventual removal in 14.0, consumers
should gradually be audited and migrated to prng(9).

Submitted by: Loic Prylli <lprylli@netflix.com>
Obtained from: Netflix
Reviewed by: cem, delphij, imp
MFC after: 1 day
MFC to: stable/13, releng/13.0
Differential Revision: https://reviews.freebsd.org/D29385
share/man/man9/random.9
sys/libkern/random.c