[PATCH v2 0/7] x86/nestedvmx: Fix nested VMX bugs

chunjie.zhu@citrix.com posted 7 patches 3 weeks, 4 days ago
xen/arch/x86/hvm/hvm.c                  |  6 +++
xen/arch/x86/hvm/vmx/vmx.c              |  4 +-
xen/arch/x86/hvm/vmx/vvmx.c             | 71 ++++++++++++++++++++++---
xen/arch/x86/include/asm/hvm/vmx/vvmx.h |  4 ++
xen/arch/x86/mm/hap/nested_ept.c        |  9 +++-
xen/arch/x86/mm/hap/nested_hap.c        | 52 +++++++++++++++++-
xen/arch/x86/mm/p2m.c                   | 19 ++++++-
7 files changed, 152 insertions(+), 13 deletions(-)
[PATCH v2 0/7] x86/nestedvmx: Fix nested VMX bugs
Posted by chunjie.zhu@citrix.com 3 weeks, 4 days ago
From: Chunjie Zhu <chunjie.zhu@citrix.com>

This series fixes several bugs found while running nested VMX guests
(L1 Xen running an L2 guest) on top of Xen:

 - Patch 1: stop leaking L0's widened access bits into the EPT violation
   exit qualification reflected to L1.
 - Patch 2: emulate L2 accesses that hit the APIC-access dummy page
   against L1's vLAPIC instead of mapping the page directly.
 - Patch 3: reflect EPT holes hit during L2 emulation to L1 as EPT
   violations rather than injecting a bogus #PF into L2.
 - Patch 4: load L2's EFER on VM entry and restore L1's on VM exit, so
   L2 neither sees L0's LME nor fails VM entry with invalid guest state.
 - Patch 5: invalidate EPT caches after flushing a nested p2m, to avoid
   L2 walking stale paging-structure caches into freed pages.
 - Patch 6: retry a nested page fault if the np2m changes while L1/L0
   p2m are being walked without the np2m lock held.
 - Patch 7: fix several nested VPID problems.

Changes in v2:
 - Drop V1 patch 2 (Implement nhvm_hap_walk_L1_p2m2), a temporary change.
 - Rebased onto current master.

Chunjie Zhu (7):
  x86/nestedvmx: Preserve hardware access bits in reflected EPT
    violations
  x86/nestedvmx: Emulate L2 accesses to L1's LAPIC page
  x86/nestedvmx: Reflect EPT holes hit during L2 emulation
  x86/nestedvmx: Load L2's EFER on VM entry and restore L1's on VM exit
  x86/p2m: invalidate EPT caches after flushing a nested p2m
  x86/nestedhap: Retry nested page fault if the np2m changes during walk
  x86/vmx: Fix nested VPID handling

 xen/arch/x86/hvm/hvm.c                  |  6 +++
 xen/arch/x86/hvm/vmx/vmx.c              |  4 +-
 xen/arch/x86/hvm/vmx/vvmx.c             | 71 ++++++++++++++++++++++---
 xen/arch/x86/include/asm/hvm/vmx/vvmx.h |  4 ++
 xen/arch/x86/mm/hap/nested_ept.c        |  9 +++-
 xen/arch/x86/mm/hap/nested_hap.c        | 52 +++++++++++++++++-
 xen/arch/x86/mm/p2m.c                   | 19 ++++++-
 7 files changed, 152 insertions(+), 13 deletions(-)

-- 
2.34.1