From owner-svn-src-head@FreeBSD.ORG Fri Jan 20 15:20:31 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 31B121065674 for ; Fri, 20 Jan 2012 15:20:31 +0000 (UTC) (envelope-from markm@FreeBSD.org) Received: from gromit.grondar.org (grandfather.grondar.org [93.89.92.32]) by mx1.freebsd.org (Postfix) with ESMTP id E44B68FC26 for ; Fri, 20 Jan 2012 15:20:30 +0000 (UTC) Received: from uucp by gromit.grondar.org with local-rmail (Exim 4.76 (FreeBSD)) (envelope-from ) id 1RoGBG-000EZ4-RY for svn-src-head@freebsd.org; Fri, 20 Jan 2012 15:15:06 +0000 Received: from localhost ([127.0.0.1] helo=groundzero.grondar.org) by groundzero.grondar.org with esmtp (Exim 4.77 (FreeBSD)) (envelope-from ) id 1RoG98-000DiP-0Y; Fri, 20 Jan 2012 15:12:54 +0000 To: Andrey Chernov In-reply-to: <20120120055823.GA28177@vniz.net> References: <201201162018.q0GKIADK050161@svn.freebsd.org> <20120118061943.GA80874@vniz.net> <20120120055823.GA28177@vniz.net> From: Mark Murray From: Mark Murray Date: Fri, 20 Jan 2012 15:12:53 +0000 Message-Id: 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 15:20:31 -0000 Andrey Chernov writes: > > 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. The usual way round this is with a flag. Set a static, volatile flag, defaulting "off", and set it to "on" when the seeding has happened. Then arc4random() can do the right thing, depending on this flag. > In my version arc4rand() seeding happens only when this lock is released, > so no blocking is possible. Sure, but the dependancies created are problematic in their own right. M -- Mark R V Murray Cert APS(Open) Dip Phys(Open) BSc Open(Open) BSc(Hons)(Open) Pi: 132511160