]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
random(9): Restore historical [0,2^31-1] output range and related man documention.
authorLawrence Stewart <lstewart@FreeBSD.org>
Wed, 24 Mar 2021 04:25:49 +0000 (15:25 +1100)
committerLawrence Stewart <lstewart@FreeBSD.org>
Thu, 25 Mar 2021 06:57:02 +0000 (17:57 +1100)
commit828e6b5f5e30180d31edb8b4f3d84daaba703c42
tree5b4d99d19864e21a4856a06cf74ce5a394049a36
parent6acecf247f60fcd3ba9662d54c59fc7bd46fb67a
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

(cherry picked from commit dbbf3e3f37d67d3eae0931855f8b62b9b299b80a)
share/man/man9/random.9
sys/libkern/random.c