Re: [PATCH v6 08/42] x86/sev-es: initialize sev_status/features within #VC handler

From: Dr. David Alan Gilbert
Date: Thu Oct 21 2021 - 13:48:07 EST


* Borislav Petkov (bp@xxxxxxxxx) wrote:
> On Thu, Oct 21, 2021 at 06:12:53PM +0100, Dr. David Alan Gilbert wrote:
> > OK, so that bit is 8...21 Eax ext2eax bit 6 page 1-109
> >
> > then 2.1.5.3 CPUID policy enforcement shows 8...21 EAX as
> > 'bitmask'
> > 'bits set in the GuestVal must also be set in HostVal.
> > This is often applied to feature fields where each bit indicates
> > support for a feature'
> >
> > So that's right isn't it?
>
> Yap, AFAIRC, it would fail the check if:
>
> (GuestVal & HostVal) != GuestVal
>
> and GuestVal is "the CPUID result value created by the hypervisor that
> it wants to give to the guest". Let's say it clears bit 6 there.
^^^^^^^

> Then HostVal comes in which is "the actual CPUID result value specified
> in this PPR" and there the guest catches the HV lying its *ss off.
>
> :-)

Hang on, I think it's perfectly fine for it to clear that bit - it just
gets caught if it *sets* it (i.e. claims to be a chip unaffected by the
bug).

i.e. if guestval=0 then (GustVal & whatever) == GuestVal
fine

?

Dave

>
> --
> Regards/Gruss,
> Boris.
>
> https://people.kernel.org/tglx/notes-about-netiquette
>
--
Dr. David Alan Gilbert / dgilbert@xxxxxxxxxx / Manchester, UK