Gleb Natapov
2014-Sep-19 17:15 UTC
Standardizing an MSR or other hypercall to get an RNG seed?
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" ;) -- Gleb.
H. Peter Anvin
2014-Sep-19 17:18 UTC
Standardizing an MSR or other hypercall to get an RNG seed?
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
H. Peter Anvin
2014-Sep-19 17:18 UTC
Standardizing an MSR or other hypercall to get an RNG seed?
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
Gleb Natapov
2014-Sep-19 17:49 UTC
Standardizing an MSR or other hypercall to get an RNG seed?
On Fri, Sep 19, 2014 at 10:18:37AM -0700, H. Peter Anvin wrote:> 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. >What part of actually algorithm cannot be implemented? Loop that searches for KVM leaf in case KVM pretend to be HyperV (is this what you called "chase loops"?)? First of all there is no need to implement it, if KVM pretends to be HyperV use HyperV's way to obtain RNG, but what is the problem with the loop? -- Gleb.
Maybe Matching Threads
- Standardizing an MSR or other hypercall to get an RNG seed?
- Standardizing an MSR or other hypercall to get an RNG seed?
- Standardizing an MSR or other hypercall to get an RNG seed?
- Standardizing an MSR or other hypercall to get an RNG seed?
- Standardizing an MSR or other hypercall to get an RNG seed?