From mboxrd@z Thu Jan 1 00:00:00 1970 From: "H. Peter Anvin" Subject: Re: Standardizing an MSR or other hypercall to get an RNG seed? Date: Fri, 19 Sep 2014 10:18:37 -0700 Message-ID: <541C656D.9030400@zytor.com> References: <1969371640.51211843.1411066715223.JavaMail.zimbra@redhat.com> <0180a8dfcad746a895755c4374853c16@BY2PR03MB585.namprd03.prod.outlook.com> <20140919163749.GI26540@minantech.com> <541C5C67.6040608@zytor.com> <20140919165349.GJ26540@minantech.com> <541C6304.3080903@zytor.com> <20140919171545.GK26540@minantech.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: Mathew John , Theodore Ts'o , David Hepkin , kvm list , Niels Ferguson , Andy Lutomirski , Jake Oshins , Paolo Bonzini , Linux Virtualization , John Starks To: Gleb Natapov Return-path: In-Reply-To: <20140919171545.GK26540@minantech.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: virtualization-bounces@lists.linux-foundation.org Errors-To: virtualization-bounces@lists.linux-foundation.org List-Id: kvm.vger.kernel.org On 09/19/2014 10:15 AM, Gleb Natapov wrote: > On Fri, Sep 19, 2014 at 10:08:20AM -0700, H. Peter Anvin wrote: >> On 09/19/2014 09:53 AM, Gleb Natapov wrote: >>> On Fri, Sep 19, 2014 at 09:40:07AM -0700, H. Peter Anvin wrote: >>>> On 09/19/2014 09:37 AM, Gleb Natapov wrote: >>>>> >>>>> Linux detects what hypervior it runs on very early >>>> >>>> Not anywhere close to early enough. We're talking for uses like kASLR. >>>> >>> Still to early to do: >>> >>> h = cpuid(HYPERVIOR_SIGNATURE) >>> if (h == KVMKVMKVM) { >>> if (cpuid(kvm_features) & kvm_rnd) >>> rdmsr(kvm_rnd) >>> else (h == HyperV) { >>> if (cpuid(hv_features) & hv_rnd) >>> rdmsr(hv_rnd) >>> else (h == XenXenXen) { >>> if (cpuid(xen_features) & xen_rnd) >>> rdmsr(xen_rnd) >>> } >>> >> >> If we need to do chase loops, especially not so... >> > What loops exactly? As a non native English speaker I fail to understand > if your answer is "yes" or "no" ;) > The above isn't actually the full algorithm used. -hpa