Skip to content

x86/nestedhvm: Fix #VMEXITs which L0 creates for L2 events

Stephen Cheng xen-devel 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest2 patches 1 replyIn review
  2. v11 patch 1 replySuperseded

Changes in v2 from the cover letter

- Rebased on current staging.
- Reworded patch 1's commit message.
- New patch 2.

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2x86/nestedsvm: Record NextRIP with the deferred #VMEXITxen/arch/x86/hvm/svm/nestedhvm.h xen/arch/x86/hvm/svm/nestedsvm.c xen/arch/x86/hvm/svm/svm.c +1 more+35 -90 replies
2/2x86/nestedhvm: Don't treat an emulated INT $n as an exceptionxen/arch/x86/hvm/hvm.c xen/arch/x86/hvm/svm/nestedhvm.h xen/arch/x86/hvm/svm/nestedsvm.c +4 more+52 -250 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/2] x86/nestedhvm: Fix #VMEXITs which L0 creates for L2 events

When L0 handles an event of L2 itself, and L1 intercepts it, L0 creates the #VMEXIT to L1. Two parts of that #VMEXIT are wrong:

1. NextRIP is copied from an earlier hardware #VMEXIT.
2. An emulated INT $n is treated as exception n, so the software interrupt intercept is not checked. For some n, L1 is crashed with "Illegal exitcode".

Patch 1 was sent alone on 22 Oct (no replies); it is only rebased and reworded here. v1:
https://lore.kernel.org/xen-devel/[email protected]/

Patch 2 is new, and uses the NextRIP from patch 1 for INT $n, so I send them together.

Both were found with nested-SVM XTF tests using the forced emulation prefix, and tested on AMD EPYC. The VMX part of patch 2 is only build tested.

Not fixed here: an ICEBP in L2 which L0 handles (always for a native ICEBP, since Xen intercepts it, or when emulated) is checked against the #DB intercept instead of the ICEBP intercept (APM 15.12.2). I will send a fix separately.

v2:
- Rebased on current staging.
- Reworded patch 1's commit message.
- New patch 2.

Stephen Cheng (2):
x86/nestedsvm: Record NextRIP with the deferred #VMEXIT x86/nestedhvm: Don't treat an emulated INT $n as an exception

 xen/arch/x86/hvm/hvm.c                   |  3 +-
 xen/arch/x86/hvm/svm/nestedhvm.h         |  5 +-
 xen/arch/x86/hvm/svm/nestedsvm.c         | 60 ++++++++++++++++++++----
 xen/arch/x86/hvm/svm/svm.c               |  8 ++--
 xen/arch/x86/hvm/vmx/vmx.c               |  6 +--
 xen/arch/x86/hvm/vmx/vvmx.c              | 10 +++-
 xen/arch/x86/include/asm/hvm/hvm.h       |  8 ++--
 xen/arch/x86/include/asm/hvm/svm-types.h |  1 +
 xen/arch/x86/include/asm/hvm/vmx/vvmx.h  |  6 ++-
 9 files changed, 80 insertions(+), 27 deletions(-)

base-commit: 5b28c0efc1d5d73ce651ca651e103c45b6932f9d

Signature · 1 line
2.49.0