Skip to content

x86/nestedvmx: Fix nested VMX bugs

[email protected] xen-devel 2 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest7 patches 0 repliesNew
  2. v18 patches 0 repliesSuperseded

Changes in v2 from the cover letter

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

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/7x86/nestedvmx: Preserve hardware access bits in reflected EPT violationsxen/arch/x86/mm/hap/nested_ept.c+6 -10 replies
2/7x86/nestedvmx: Emulate L2 accesses to L1's LAPIC pagexen/arch/x86/mm/hap/nested_hap.c+12 -00 replies
3/7x86/nestedvmx: Reflect EPT holes hit during L2 emulationxen/arch/x86/hvm/hvm.c xen/arch/x86/hvm/vmx/vvmx.c xen/arch/x86/include/asm/hvm/vmx/vvmx.h +1 more+47 -10 replies
4/7x86/nestedvmx: Load L2's EFER on VM entry and restore L1's on VM exitxen/arch/x86/hvm/vmx/vvmx.c+28 -20 replies
5/7x86/p2m: invalidate EPT caches after flushing a nested p2mxen/arch/x86/mm/p2m.c+11 -00 replies
6/7x86/nestedhap: Retry nested page fault if the np2m changes during walkxen/arch/x86/mm/hap/nested_hap.c+39 -10 replies
7/7x86/vmx: Fix nested VPID handlingxen/arch/x86/hvm/vmx/vmx.c xen/arch/x86/hvm/vmx/vvmx.c xen/arch/x86/mm/hap/nested_ept.c+9 -80 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

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

From: Chunjie Zhu <[email protected]>

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(-)
Signature · 1 line
2.34.1