From owner-freebsd-current@FreeBSD.ORG Thu Aug 29 19:18:54 2013 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 6E1C8294 for ; Thu, 29 Aug 2013 19:18:54 +0000 (UTC) (envelope-from mailer-daemon@vniz.net) Received: from mail-ee0-f50.google.com (mail-ee0-f50.google.com [74.125.83.50]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id F34EF227F for ; Thu, 29 Aug 2013 19:18:53 +0000 (UTC) Received: by mail-ee0-f50.google.com with SMTP id d51so451520eek.23 for ; Thu, 29 Aug 2013 12:18:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :cc:subject:references:in-reply-to:openpgp:content-type :content-transfer-encoding; bh=v2Fwtn/ZHQ1e/hY/rEgS8MO4+q0qCBNFyJGuk0ymuVE=; b=PR/oiWokVxKE8qHRdfkLqLs1yOgGoMN+PzVMvZqeViH7G/omKIQc+/bRYCCUdfK1Ul s8kTcGwWfIj4XLpes7DeQO4Q9S8dnNjqttjKX2/osALFLpEC/+a/EQQGKxxVbbAeUe1f a3bgWqus9anjqgGN9hyacaeuJ1WwhXTvrXy9vZlYYf7v+oIJ4aNgTr4CFh29ikAOZzjz AtV4dWTEr3Zp04XEkZwke8awtIYHyOp/i9Ybcs5Ao1QD45yJe584yvJMgE+VQVPzG/Id zMoUxsM3h/Az2ZChBPjfOVJ4NoK+Qma3N8+SXPq8P0tl68BSI5TG21X6mjUqcWrGQ826 OZoQ== X-Gm-Message-State: ALoCoQkO3I3y0x/gQO3zcIr+Fh9OS9H/z3xJkv9K8l23rXcDBKwYGi3+2iqjoJXbQYAScdDm7QE/ X-Received: by 10.14.208.194 with SMTP id q42mr6097490eeo.31.1377800185509; Thu, 29 Aug 2013 11:16:25 -0700 (PDT) Received: from [192.168.1.2] ([89.169.173.68]) by mx.google.com with ESMTPSA id bn13sm48174417eeb.11.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 29 Aug 2013 11:16:24 -0700 (PDT) Message-ID: <521F8FF5.1050904@freebsd.org> Date: Thu, 29 Aug 2013 22:16:21 +0400 From: Andrey Chernov User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 To: John Baldwin Subject: Re: RAND_MAX issue? References: <201308291305.09931.jhb@freebsd.org> In-Reply-To: <201308291305.09931.jhb@freebsd.org> OpenPGP: id=964474DD Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: freebsd-current@freebsd.org, Jason Helfman X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Aug 2013 19:18:54 -0000 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