Re: [PATCH v7 01/72] KVM: SVM: nested: Don't allocate VMCB structures on stack

From: Borislav Petkov
Date: Thu Nov 05 2020 - 11:38:29 EST


On Thu, Nov 05, 2020 at 10:24:37AM -0600, Michael Roth wrote:
> > out_set_gif:
> > svm_set_gif(svm, !!(kvm_state->flags & KVM_STATE_NESTED_GIF_SET));
> > - return 0;
> > +
> > + ret = 0;
> > +out_free:
> > + kfree(save);
> > + kfree(ctl);
>
> This change seems to trigger a crash via smm-test.c (and state-test.c) KVM
> selftest when we call vcpu_load_state->KVM_SET_NESTED_STATE. I think what's
> happening is we are hitting the 'goto out_set_gif;'

No out_set_gif upstream anymore after

d5cd6f340145 ("KVM: nSVM: Avoid freeing uninitialized pointers in svm_set_nested_state()")

and it looks like you hit the issue this patch is fixing.

Can you test with the above commit cherrypicked ontop of your what looks
like 5.9.1-ish tree?

If that fixes it, we should route this patch to stable.

Thx.

--
Regards/Gruss,
Boris.

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