From owner-freebsd-current@FreeBSD.ORG Fri Oct 12 08:51:04 2012 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 55B832C08 for ; Fri, 12 Oct 2012 08:51:04 +0000 (UTC) (envelope-from h.schmalzbauer@omnilan.de) Received: from host.omnilan.net (s1.omnilan.net [62.245.232.135]) by mx1.freebsd.org (Postfix) with ESMTP id CB2E88FC0C for ; Fri, 12 Oct 2012 08:51:02 +0000 (UTC) Received: from titan.inop.wdn.omnilan.net (titan.inop.wdn.omnilan.net [172.21.3.1]) (authenticated bits=0) by host.omnilan.net (8.13.8/8.13.8) with ESMTP id q9C8q7Yg052529 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 12 Oct 2012 10:52:07 +0200 (CEST) (envelope-from h.schmalzbauer@omnilan.de) Message-ID: <5077D9EF.4040500@omnilan.de> Date: Fri, 12 Oct 2012 10:50:55 +0200 From: Harald Schmalzbauer Organization: OmniLAN User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; de-DE; rv:1.9.2.8) Gecko/20100906 Lightning/1.0b2 Thunderbird/3.1.2 MIME-Version: 1.0 To: Konstantin Belousov Subject: Re: Bull Mountain (IvyBridge +) random number generator References: <20120902103406.GU33100@deviant.kiev.zoral.com.ua> In-Reply-To: <20120902103406.GU33100@deviant.kiev.zoral.com.ua> X-Enigmail-Version: 1.1.2 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig77E0D30FCB304C4E5095328C" Cc: current@freebsd.org 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: Fri, 12 Oct 2012 08:51:04 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig77E0D30FCB304C4E5095328C Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable schrieb Konstantin Belousov am 02.09.2012 12:34 (localtime): > It is relatively well known that Ivy Bridge CPUs (Core iX 3XXX) have > built-in hardware random number generator, which is claimed to be both > very fast and high quality. Generator is accessible using non-privilege= d > RDRAND instruction. It is claimed that CPU performs sanitization of the= > random sequence. In particular, it seems that paranoid AES encryption o= f > the raw random stream, performed by our padlock driver, is not needed > for Bull Mountain (there are hints that hardware performs it already). > > See > http://spectrum.ieee.org/computing/hardware/behind-intels-new-randomnum= ber-generator/0 > http://software.intel.com/en-us/articles/intel-digital-random-number-ge= nerator-drng-software-implementation-guide/ > and IA32 ADM. > > Patch at > http://people.freebsd.org/~kib/misc/bull_mountain.2.patch > implements support for the generator. I do not own any IvyBridge machin= es, > so I cannot test. Patch makes both padlock and bull generators the opti= ons, > you need to enable IVY_RNG to get support for the generator. > > I would be interested in seeing reports including verbose boot dmesg, > and some tests of /dev/random quality on the IvyBridge machines, you ca= n > start with http://lists.gnupg.org/pipermail/gnupg-devel/2000-March/0163= 28.html. Thanks a lot for implementing this! I have an ESXi host with Ivy Brindge CPU. FreeBSD guest reports the following: CPU: Intel(R) Xeon(R) CPU E3-1270 V2 @ 3.50GHz (3492.07-MHz K8-class CPU)= Origin =3D "GenuineIntel" Id =3D 0x306a9 Family =3D 6 Model =3D 3a=20 Stepping =3D 9 =20 Features=3D0x1fa3fbff =20 Features2=3D0xfeba2203 AMD Features=3D0x28100800 AMD Features2=3D0x1 TSC: P-state invariant real memory =3D 8589934592 (8192 MB) avail memory =3D 8235110400 (7853 MB) Event timer "LAPIC" quality 600 ACPI APIC Table: FreeBSD/SMP: Multiprocessor System Detected: 4 CPUs FreeBSD/SMP: 1 package(s) x 4 core(s) cpu0 (BSP): APIC ID: 0 cpu1 (AP): APIC ID: 1 cpu2 (AP): APIC ID: 2 cpu3 (AP): APIC ID: 3 MADT: Forcing active-low polarity and level trigger for SCI But unfortunately accessing /dev/random doesn't work with IVY_RNG enabled= =2E 'dd' consumes 100% wcpu bound to one core but never finishes (dd if=3D/dev/random bs=3D1k count=3D100|./ent) Also some other functions are blocked, logging in for example (doesn't matter if it's console or ssh). But I can walk arround in already established sessions. I made a 9.1-RC-2 debug kernel but no info appears. Also IVY_RNG isn't reported after kldloading, nor during boot, but this is the expected behaviour if I unterstand your patch correctly. I guess using RDRAND in an hypervisor environment should make no difference but please correct me if I'm wrong. Thanks, -Harry --------------enig77E0D30FCB304C4E5095328C Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (FreeBSD) iEYEARECAAYFAlB32e8ACgkQLDqVQ9VXb8joVwCg0kZhUEjh0ZEDPya63etS1kRB NJ4AoInWyDMMMceGFdozWViMQwAIree9 =U2f4 -----END PGP SIGNATURE----- --------------enig77E0D30FCB304C4E5095328C--