RAND_MAX issue?

Andrey Chernov ache at freebsd.org
Thu Aug 29 19:18:54 UTC 2013


On 29.08.2013 21:05, John Baldwin wrote:
> On Thursday, August 29, 2013 11:59:53 am Jason Helfman wrote:
>> I am working on trying to resolve a build issue with devel/libvirt, and
>> posted to the libvirt mailing list, and received this feedback. Please read
>> this thread, and if you have any thoughts I would be interested in any
>> resolution.
>>
>> Here is a link to the thread:
>> https://www.redhat.com/archives/libvir-list/2013-August/msg01544.html
>>
>> Thanks!
> 
> It mostly seems to not matter reading the followups.  You would need to
> ask Bruce what he thinks about the assumption of RAND_MAX being 2^n-1
> for some n.
> 

The whole libvirt check looks like Linuxism based on wrong assumption
"combining a small number of pseudorandom bits to make a larger
pseudorandom number produce a uniform distribution". See explaining
comments on POSIX site:
http://austingroupbugs.net/view.php?id=743
BTW, they seems does not support new proposed addition to POSIX.
Moreover, returning old range (as it was before) will bring false safety
stopgap for combining with wrong result.

Two possible fixes: increase libvirt's internal RAND_MAX (quick and
dirty) or rewrite their incorrect combining (preferred).

-- 
http://ache.vniz.net/
bitcoin:1G6ugdNY6e5jx1GVnAU2ntj2NEfmjKG85r


More information about the freebsd-current mailing list