From owner-cvs-src@FreeBSD.ORG Wed Mar 24 17:55:09 2004 Return-Path: Delivered-To: cvs-src@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8725516A4D0 for ; Wed, 24 Mar 2004 17:55:09 -0800 (PST) Received: from relay.pair.com (relay.pair.com [209.68.1.20]) by mx1.FreeBSD.org (Postfix) with SMTP id D0F4943D53 for ; Wed, 24 Mar 2004 17:55:08 -0800 (PST) (envelope-from silby@silby.com) Received: (qmail 99884 invoked from network); 25 Mar 2004 01:55:07 -0000 Received: from niwun.pair.com (HELO localhost) (209.68.2.70) by relay.pair.com with SMTP; 25 Mar 2004 01:55:07 -0000 X-pair-Authenticated: 209.68.2.70 Date: Wed, 24 Mar 2004 19:55:05 -0600 (CST) From: Mike Silbersack To: David Schultz In-Reply-To: <20040325013941.GA65920@VARK.homeunix.com> Message-ID: <20040324195119.R39855@odysseus.silby.com> References: <200403241444.i2OEiv86083617@repoman.freebsd.org> <20040325013941.GA65920@VARK.homeunix.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: Brian Feldman cc: src-committers@FreeBSD.ORG cc: cvs-all@FreeBSD.ORG cc: cvs-src@FreeBSD.ORG Subject: Re: cvs commit: src/lib/libc/gen arc4random.c X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Mar 2004 01:55:09 -0000 On Wed, 24 Mar 2004, David Schultz wrote: > > Add locking so that arc4random(3) functions are all reentrant for > > pthreads. > > I think you mean thread-safe, not reentrant. Also: > PR: 63287 > > AFAIK, there's no standard for how arc4random() is supposed to > behave, but the new behavior is a break from that of other BSDs, > and from the behavior of random(), so the change should probably > be documented in the manpage. Er, what would the manpage say? "arc4random no longer corrupts its state when called simultaneously?" If our other library routines do not guarantee this, they probably should be changed so that they do. > FWIW, on my UP Pentium 4 with SMT, this adds roughly 3% overhead > for unthreaded apps and 52% overhead for threaded apps. It is > conceivable that an application writer would want access to the > raw interface in order to serialize calls manually for efficiency, > but I'm not such an application writer, so I won't complain. As I said when I locked down arc4random in the kernel, it would be possible to use seperate entropy buckets for each processor (or thread) if performance really becomes an issue. Mike "Silby" Silbersack