From owner-svn-src-head@FreeBSD.ORG Fri Jan 20 05:58:27 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6B3AE106564A; Fri, 20 Jan 2012 05:58:27 +0000 (UTC) (envelope-from ache@vniz.net) Received: from vniz.net (vniz.net [194.87.13.69]) by mx1.freebsd.org (Postfix) with ESMTP id D32D78FC18; Fri, 20 Jan 2012 05:58:26 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by vniz.net (8.14.5/8.14.5) with ESMTP id q0K5wOG5028229; Fri, 20 Jan 2012 09:58:24 +0400 (MSK) (envelope-from ache@vniz.net) Received: (from ache@localhost) by localhost (8.14.5/8.14.5/Submit) id q0K5wOph028228; Fri, 20 Jan 2012 09:58:24 +0400 (MSK) (envelope-from ache) Date: Fri, 20 Jan 2012 09:58:23 +0400 From: Andrey Chernov To: Mark Murray Message-ID: <20120120055823.GA28177@vniz.net> Mail-Followup-To: Andrey Chernov , Mark Murray , David Schultz , src-committers@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, svn-src-head@FreeBSD.ORG References: <201201162018.q0GKIADK050161@svn.freebsd.org> <20120118061943.GA80874@vniz.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@FreeBSD.ORG, David Schultz , src-committers@FreeBSD.ORG, svn-src-all@FreeBSD.ORG Subject: Re: svn commit: r230230 - head/sys/dev/random X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Jan 2012 05:58:27 -0000 On Thu, Jan 19, 2012 at 07:52:30PM +0000, Mark Murray wrote: > Andrey Chernov writes: > > On Mon, Jan 16, 2012 at 08:18:10PM +0000, David Schultz wrote: > > > Author: das > > > Date: Mon Jan 16 20:18:10 2012 > > > New Revision: 230230 > > > URL: http://svn.freebsd.org/changeset/base/230230 > > > > > > Log: > > > Generate a warning if the kernel's arc4random() is seeded with bogus entropy. > > > > While you are here, could you review/commit my patch to fix bad 31bit > > arc4rand() seeding, please? > > > > --- yarrow.c.bak 2011-09-26 07:35:48.000000000 +0400 > > +++ yarrow.c 2012-01-18 10:13:47.000000000 +0400 > > This is the wrong place for this; it may achieve the desired result, but > the file is where the Yarrow algorithm is implepeneted; ARC4 reseeds are > not a part of that, which makes this proposal a layering violation at > best, and an unwarranted dependancy at worst. > > Look at the function random_yarrow_unblock(). Thats where yopu want to > be doing this. This function is where the random device is unblocked > once safely seeded. Thanx for your hint, but I fear one moment using random_yarrow_unblock(). It is called under mtx_lock(&random_reseed_mtx) in reseed(). And when arc4rand() seeding is called, it uses read_random(), so I see possible deadlock can happens. In my version arc4rand() seeding happens only when this lock is released, so no blocking is possible. But perhaps I oversight something, correct me if I am wrong, please. -- http://ache.vniz.net/