Re: [PATCH 0/2] KVM: SVM: Fix unexpected #UD on INT3 in SEV guests

From: Sean Christopherson
Date: Tue Aug 22 2023 - 11:14:55 EST


On Tue, Aug 22, 2023, Tom Lendacky wrote:
> On 8/10/23 18:49, Sean Christopherson wrote:
> > Fix a bug where KVM injects a bogus #UD for SEV guests when trying to skip
> > an INT3 as part of re-injecting the associated #BP that got kinda sorta
> > intercepted due to a #NPF occuring while vectoring/delivering the #BP.
> >
> > I haven't actually confirmed that patch 1 fixes the bug, as it's a
> > different change than what I originally proposed. I'm 99% certain it will
> > work, but I definitely need verification that it fixes the problem
> >
> > Patch 2 is a tangentially related cleanup to make NRIPS a requirement for
> > enabling SEV, e.g. so that we don't ever get "bug" reports of SEV guests
> > not working when NRIPS is disabled.
> >
> > Sean Christopherson (2):
> > KVM: SVM: Don't inject #UD if KVM attempts emulation of SEV guest w/o
> > insn
> > KVM: SVM: Require nrips support for SEV guests (and beyond)
> >
> > arch/x86/kvm/svm/sev.c | 2 +-
> > arch/x86/kvm/svm/svm.c | 37 ++++++++++++++++++++-----------------
> > arch/x86/kvm/svm/svm.h | 1 +
> > 3 files changed, 22 insertions(+), 18 deletions(-)
>
> We ran some stress tests against a version of the kernel without this fix
> and we're able to reproduce the issue, but not reliably, after a few hours.
> With this patch, it has not reproduced after running for a week.
>
> Not as reliable a scenario as the original reporter, but this looks like it
> resolves the issue.

Thanks Tom! I'll apply this for v6.6, that'll give us plenty of time to change
course if necessary.