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

From: Borislav Petkov
Date: Wed Oct 27 2021 - 07:17:16 EST


On Mon, Oct 25, 2021 at 11:35:18AM -0500, Michael Roth wrote:
> As counter-intuitive as it sounds, it actually doesn't buy us if the CPUID
> table is part of the PSP attestation report, since:

Thanks for taking the time to explain in detail - I think I know now
what's going on, and David explained some additional stuff to me
yesterday.

So, to cut to the chase:

- yeah, ok, I guess guest owner attestation is what should happen.

- as to the boot detection, I think you should do in sme_enable(), in
pseudo:

bool snp_guest_detected;

if (CPUID page address) {
read SEV_STATUS;

snp_guest_detected = SEV_STATUS & MSR_AMD64_SEV_SNP_ENABLED;
}

/* old SME/SEV detection path */
read 0x8000_001F_EAX and look at bits SME and SEV, yadda yadda.

if (snp_guest_detected && (!SME || !SEV))
/*
* HV is lying to me, do something there, dunno what. I guess we can
* continue booting unencrypted so that the guest owner knows that
* detection has failed and maybe the HV didn't want us to force SNP.
* This way, attestation will fail and the user will know why.
* Or something like that.
*/


/* normal feature detection continues. */

How does that sound?

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette