Re: [PATCH] KVM: nSVM: prepare guest save area while is_guest_mode is true

From: Paolo Bonzini
Date: Thu Feb 18 2021 - 14:24:17 EST


On 18/02/21 19:12, Sean Christopherson wrote:
Yeah, the problem is I don't understand why 06fc7772690d fixed things in 11
year old KVM instead of breaking them, because effectively this patch is
reverting it.

11 year old KVM didn't grab a different VMCB when updating the intercepts, it
had already copied/merged L1's stuff to L0's VMCB, and then updated L0's VMCB
regardless of is_nested().

Ok, so the bug was introduced when adding recalc_intercepts, which threw away the intercept manipulations that svm_set_cr0 had done in the meanwhile. That's commit 384c63684397 ("KVM: SVM: Add function to recalculate intercept masks", 2011-01-12).

That piece of information makes me feel less uneasy about missing something. recalc_intercepts has been there for a long time, but not as long as 06fc7772690d.

Paolo