Re: [PATCH 3/9] KVM: x86: SVM: Pass through shadow stack MSRs

From: Sean Christopherson
Date: Mon Nov 06 2023 - 11:45:57 EST


On Thu, Nov 02, 2023, Maxim Levitsky wrote:
> On Wed, 2023-10-18 at 16:57 +0530, Nikunj A. Dadhania wrote:
> > On 10/17/2023 11:47 PM, John Allen wrote:
> > In that case, intercept should be cleared from the very beginning.
> >
> > + { .index = MSR_IA32_PL0_SSP, .always = true },
> > + { .index = MSR_IA32_PL1_SSP, .always = true },
> > + { .index = MSR_IA32_PL2_SSP, .always = true },
> > + { .index = MSR_IA32_PL3_SSP, .always = true },
>
> .always is only true when a MSR is *always* passed through. CET msrs are only
> passed through when CET is supported.
>
> Therefore I don't expect that we ever add another msr to this list which has
> .always = true.
>
> In fact the .always = True for X86_64 arch msrs like MSR_GS_BASE/MSR_FS_BASE
> and such is not 100% correct too - when we start a VM which doesn't have
> cpuid bit X86_FEATURE_LM, these msrs should not exist and I think that we
> have a kvm unit test that fails because of this on 32 bit but I didn't bother
> yet to fix it.
>
> .always probably needs to be dropped completely.

FWIW, I have a half-baked series to clean up SVM's MSR interception code and
converge the SVM and VMX APIs. E.g. set_msr_interception_bitmap()'s inverted
polarity confuses me every time I look at its usage.

I can hunt down the branch if someone plans on tackling this code.