Andy Lutomirski
2014-Sep-19 17:21 UTC
Standardizing an MSR or other hypercall to get an RNG seed?
On Sep 19, 2014 9:40 AM, "H. Peter Anvin" <hpa at zytor.com> wrote:> > On 09/19/2014 09:14 AM, Nakajima, Jun wrote: > > > > I slept on it, and I think using the CPUID instruction alone would be > > simple and efficient: > > - We have a huge space for CPUID leaves > > - CPUID also works for user-level > > - It can take an additional 32-bit parameter (ECX), and returns 4 > > 32-bit values (EAX, EBX, ECX, and EDX). RDMSR, for example, returns a > > 64-bit value. > > > > Basically we can use it to implement a hypercall (rather than VMCALL). > > > > For example, > > - CPUID 0x48000001.EAX would return the feature presence (e.g. in > > EBX), and the result in EDX:EAX (if present) at the same time, or > > - CPUID 0x48000001.EAX would return the feature presence only, and > > CPUID 0x48000002.EAX (acts like a hypercall) returns up to 4 32-bit > > values. > > > > There is a huge disadvantage to the fact that CPUID is a user space > instruction, though.We can always make cpuid on the leaf in question return all zeros if CPL > 0.> > -hpa >
H. Peter Anvin
2014-Sep-19 17:36 UTC
Standardizing an MSR or other hypercall to get an RNG seed?
On 09/19/2014 10:21 AM, Andy Lutomirski wrote:>> >> There is a huge disadvantage to the fact that CPUID is a user space >> instruction, though. > > We can always make cpuid on the leaf in question return all zeros if CPL > 0. >Not sure that is better... -hpa
Andy Lutomirski
2014-Sep-19 17:39 UTC
Standardizing an MSR or other hypercall to get an RNG seed?
On Fri, Sep 19, 2014 at 10:36 AM, H. Peter Anvin <hpa at zytor.com> wrote:> On 09/19/2014 10:21 AM, Andy Lutomirski wrote: >>> >>> There is a huge disadvantage to the fact that CPUID is a user space >>> instruction, though. >> >> We can always make cpuid on the leaf in question return all zeros if CPL > 0. >> > > Not sure that is better...It's better than #GP... This is why I prefer rdmsr: the privilege semantics are already appropriate. Also, I wouldn't be surprised if shoehorning non-constant results into cpuid implementations might be awkward for some hypervisors. --Andy
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?