From owner-freebsd-current@FreeBSD.ORG Fri Oct 12 16:49: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 45CAAB61 for ; Fri, 12 Oct 2012 16:49:04 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id CDD128FC0C for ; Fri, 12 Oct 2012 16:49:03 +0000 (UTC) Received: from skuns.kiev.zoral.com.ua (localhost [127.0.0.1]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id q9CGn92i049818; Fri, 12 Oct 2012 19:49:09 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5) with ESMTP id q9CGmvJw094615; Fri, 12 Oct 2012 19:48:57 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5/Submit) id q9CGmvA4094614; Fri, 12 Oct 2012 19:48:57 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 12 Oct 2012 19:48:57 +0300 From: Konstantin Belousov To: Harald Schmalzbauer Subject: Re: Bull Mountain (IvyBridge +) random number generator Message-ID: <20121012164857.GS35915@deviant.kiev.zoral.com.ua> References: <20120902103406.GU33100@deviant.kiev.zoral.com.ua> <5077D9EF.4040500@omnilan.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="iPQdpvQZPHatbiDE" Content-Disposition: inline In-Reply-To: <5077D9EF.4040500@omnilan.de> User-Agent: Mutt/1.5.21 (2010-09-15) X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.0 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua 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 16:49:04 -0000 --iPQdpvQZPHatbiDE Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Oct 12, 2012 at 10:50:55AM +0200, Harald Schmalzbauer wrote: > 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-privileged > > RDRAND instruction. It is claimed that CPU performs sanitization of the > > random sequence. In particular, it seems that paranoid AES encryption of > > 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 can > > start with http://lists.gnupg.org/pipermail/gnupg-devel/2000-March/0163= 28.html. >=20 > 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 >=20 > But unfortunately accessing /dev/random doesn't work with IVY_RNG enabled. > '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. >=20 > 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. >=20 > I guess using RDRAND in an hypervisor environment should make no > difference but please correct me if I'm wrong. Try the stable/9 instead. The code was merged in r240950. There was a bug in the original patch with the similar description. --iPQdpvQZPHatbiDE Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (FreeBSD) iEYEARECAAYFAlB4SfkACgkQC3+MBN1Mb4ho+wCfX6upQWcGde9FFE/cu1GWqj2z iC8AoI+89FDdJjbXXc3RXkLmhd/pKdJZ =7B27 -----END PGP SIGNATURE----- --iPQdpvQZPHatbiDE--