Re: [PATCH v2 2/2] KVM: SVM: Use a separate vmcb for the nested L2 guest

From: Paolo Bonzini
Date: Fri Nov 13 2020 - 15:38:46 EST


On 13/11/20 18:58, Paolo Bonzini wrote:

+    svm->nested.vmcb02->save.cr4 = svm->vmcb01->save.cr4;

I cannot understand this statement.

I wonder if it has something to do with

unsigned long old_cr4 = to_svm(vcpu)->vmcb->save.cr4;

whereas vmx.c has

unsigned long old_cr4 = vcpu->arch.cr4;

without this assignment, the old_cr4 would be taken from the last value stored in the vmcb02, instead of the current value for the vCPU.

In general uses of svm->vmcb01 (in svm.c especially) needs to be audited carefully.

Paolo