Re: [Question] int3 instruction generates a #UD in SEV VM

From: Sean Christopherson
Date: Wed Aug 02 2023 - 11:36:04 EST


On Wed, Aug 02, 2023, Tom Lendacky wrote:
> On 8/2/23 10:04, Sean Christopherson wrote:
> > Side topic, KVM should require nrips for SEV and beyond, I don't see how SEV can
> > possibly work if KVM doesn't utilize nrips. E.g. this
> >
> > diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c
> > index 2eace114a934..43e500503d48 100644
> > --- a/arch/x86/kvm/svm/svm.c
> > +++ b/arch/x86/kvm/svm/svm.c
> > @@ -5111,9 +5111,11 @@ static __init int svm_hardware_setup(void)
> > svm_adjust_mmio_mask();
> > + nrips = nrips && boot_cpu_has(X86_FEATURE_NRIPS);
> > +
> > /*
> > * Note, SEV setup consumes npt_enabled and enable_mmio_caching (which
> > - * may be modified by svm_adjust_mmio_mask()).
> > + * may be modified by svm_adjust_mmio_mask()), as well as nrips.
> > */
> > sev_hardware_setup();
>
> You moved the setting of nrips up, I'm assuming you then want to add a check
> in sev_hardware_setup() for nrips?

Doh. I like to think I would have noticed that I forgot to add that check before
postinga patch, but I give myself 50/50 odds at best.