From owner-svn-src-head@FreeBSD.ORG Tue Mar 15 19:33:09 2011 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 0B5DA106564A; Tue, 15 Mar 2011 19:33:09 +0000 (UTC) (envelope-from mdounin@mdounin.ru) Received: from mdounin.cust.ramtel.ru (mdounin.cust.ramtel.ru [81.19.69.81]) by mx1.freebsd.org (Postfix) with ESMTP id BB3418FC2C; Tue, 15 Mar 2011 19:33:08 +0000 (UTC) Received: from mdounin.ru (mdounin.cust.ramtel.ru [81.19.69.81]) by mdounin.cust.ramtel.ru (Postfix) with ESMTP id 1608417011; Tue, 15 Mar 2011 22:33:06 +0300 (MSK) Date: Tue, 15 Mar 2011 22:33:06 +0300 From: Maxim Dounin To: Jung-uk Kim Message-ID: <20110315193306.GK99496@mdounin.ru> References: <201103151714.p2FHEQdF049456@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201103151714.p2FHEQdF049456@svn.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r219672 - in head: share/man/man9 sys/i386/include 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: Tue, 15 Mar 2011 19:33:09 -0000 Hello! On Tue, Mar 15, 2011 at 05:14:26PM +0000, Jung-uk Kim wrote: > Author: jkim > Date: Tue Mar 15 17:14:26 2011 > New Revision: 219672 > URL: http://svn.freebsd.org/changeset/base/219672 > > Log: > Unconditionally use binuptime(9) for get_cyclecount(9) on i386. Since this > function is almost exclusively used for random harvesting, there is no need > for micro-optimization. Adjust the manual page accordingly. Note that on early boot only dummy timecounter available, and binuptime() has no entropy. As a result of this change random(9) won't have entropy on early boot on i386, and arc4random(9) as well. While there are no known major security problems associated with it - it at least makes stack protector easily bypasseable as it now (again after r198295) uses well-known stack guard instead of random one. And there may be other issues as well. Hope you thought well before moving i386 to a set of platforms which have no early boot randomness at all. And you have good reason for doing it. Maxim Dounin > > Modified: > head/share/man/man9/get_cyclecount.9 > head/sys/i386/include/cpu.h > > Modified: head/share/man/man9/get_cyclecount.9 > ============================================================================== > --- head/share/man/man9/get_cyclecount.9 Tue Mar 15 16:50:17 2011 (r219671) > +++ head/share/man/man9/get_cyclecount.9 Tue Mar 15 17:14:26 2011 (r219672) > @@ -24,7 +24,7 @@ > .\" > .\" $FreeBSD$ > .\" > -.Dd October 24, 2009 > +.Dd March 15, 2011 > .Dt GET_CYCLECOUNT 9 > .Os > .Sh NAME > @@ -65,14 +65,14 @@ do not have such a register, > so > .Fn get_cyclecount > on these platforms > -returns a (non-monotonic) combination of numbers > +returns a (monotonic) combination of numbers > represented by the > structure returned by > .Xr binuptime 9 . > .Pp > The > -.Tn Pentium > -processors all use the > +.Tn AMD64 and Intel 64 > +processors use the > .Li TSC > register. > .Pp > > Modified: head/sys/i386/include/cpu.h > ============================================================================== > --- head/sys/i386/include/cpu.h Tue Mar 15 16:50:17 2011 (r219671) > +++ head/sys/i386/include/cpu.h Tue Mar 15 17:14:26 2011 (r219672) > @@ -70,15 +70,10 @@ void swi_vm(void *); > static __inline uint64_t > get_cyclecount(void) > { > -#if defined(I486_CPU) || defined(KLD_MODULE) > struct bintime bt; > > - if (!tsc_present) { > - binuptime(&bt); > - return ((uint64_t)bt.sec << 56 | bt.frac >> 8); > - } > -#endif > - return (rdtsc()); > + binuptime(&bt); > + return ((uint64_t)bt.sec << 56 | bt.frac >> 8); > } > > #endif > _______________________________________________ > svn-src-all@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/svn-src-all > To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"