VMX: nested migration fixes for 32 bit nested guests
Status from this message: Queued with some further edits and nested_vmx_check_address_state_size renamed to nested_vmx_check_address_*space*_size.
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v2 Latest2 patches 3 repliesApplied
- v13 patches 7 repliesSuperseded
Changes in v2 from the cover letter
Thanks to Sean and Paolo for helping me make more correct fixes for both of the issues.
Patches in v2 Applied
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | KVM: nVMX: don't use vcpu->arch.efer when checking host state on nested state loadarch/ | +17 | 2 replies | |
| 2/2 | KVM: x86/mmu: include efer.lma in extended mmu rolearch/ arch/ | +2 | 1 reply |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.
Cover letter [PATCH v2 0/2] VMX: nested migration fixes for 32 bit nested guests
This is hopefully the last issue I was tracking in regard to nested migration, as far as I know.
The issue is that migration of L1 which is normal 64 bit guest,
but is running a 32 bit nested guest is broken on VMX and I finally found out why.
There are two bugs, both related to the fact that qemu first restores SREGS of L2, and only then sets the nested state. That haunts us till this day.
First issue is that vmx_set_nested_state does some checks on the host state stored in vmcs12, but it uses the current IA32_EFER which is from L2. Thus, consistency checks fail.
Second issue (happens on both VMX and SVM with npt/ept enabled in both L0 and L1) is that after migration L1 mmu (aka root_mmu) is initialized by L2's IA32_EFER due to the way qemu loads SREGS before the nested state, and later is not initialized again because in this particular case the 32 bitness of L2's IA32_EFER is not captured in mmu role.
V2:
Thanks to Sean and Paolo for helping me make more correct fixes for both of the issues.
I still haven't researched the 'fixes' tag, since I suspect that 32 bit nested migration wasn't tested much ever, so this bug might be present since long time ago.
Best regards,
Maxim Levitsky
Maxim Levitsky (2):
KVM: nVMX: don't use vcpu->arch.efer when checking host state on
nested state load
KVM: x86/mmu: include efer.lma in extended mmu role
arch/x86/include/asm/kvm_host.h | 1 + arch/x86/kvm/mmu/mmu.c | 1 + arch/x86/kvm/vmx/nested.c | 22 +++++++++++++++++----- 3 files changed, 19 insertions(+), 5 deletions(-)
Signature · 1 line
2.26.3