]> 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 07:00:55 +0000 (18:00 +1100)
commit2a878f01f22fd7a238078305813e48597bbcbba0
treeb84ef135c801ca0db0f83a5c2f1354021517e676
parent4f5b454509ab4f1b56a2c9456097ba18baff6609
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
Approved by: re (delphij)

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