Skip to content

RFC x86/hvm: Start unifying VMEXIT and emulated paths

Ross Lagerwall xen-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest7 patches 13 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/7x86/hvm: Move description into hvm_emulate_ctxtxen/arch/x86/hvm/emulate.c xen/arch/x86/hvm/hvm.c xen/arch/x86/hvm/io.c +4 more+13 -90 replies
2/7x86/hvm: Introduce hvm_emulate_one_ctxtxen/arch/x86/hvm/io.c xen/arch/x86/include/asm/hvm/emulate.h+12 -62 replies
3/7x86/emul: Separate out instruction completionxen/arch/x86/x86_emulate/x86_emulate.c xen/arch/x86/x86_emulate/x86_emulate.h+30 -212 replies
4/7x86/hvm: Support a fast path during emulationxen/arch/x86/hvm/emulate.c xen/arch/x86/include/asm/hvm/emulate.h+123 -400 replies
5/7x86/hvm: Move INSTR_* constants to hvm.hxen/arch/x86/hvm/svm/svm.h xen/arch/x86/include/asm/hvm/hvm.h+29 -296 replies
6/7x86/svm: Use the emulator path for VMEXIT_HLTxen/arch/x86/hvm/emulate.c xen/arch/x86/hvm/svm/emulate.c xen/arch/x86/hvm/svm/svm.c +1 more+18 -143 replies
7/7x86/svm: Use the emulator path for VMEXIT_CR*xen/arch/x86/hvm/emulate.c xen/arch/x86/hvm/svm/svm.c xen/arch/x86/include/asm/hvm/emulate.h +1 more+29 -190 replies

Reviews trailers per patch

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

Read the v1 thread

Cover letter [RFC v1 0/7] x86/hvm: Start unifying VMEXIT and emulated paths

Hi,

There are differences in instruction execution when coming from a VMEXIT vs a fully emulated path. This can result in subtle bugs, e.g. injecting #GP with trap rather than fault semantics. When using nested virt, these bugs may become security issues if it allows L2 to attack L1 (because L0 has done something unexpected).

To fix this, we plan to unify the VMEXIT (fast) path and emulated instruction paths with everything going through the emulator but the fast path short-circuiting some parts. This patch series adds the basic infrastructure and converts two SVM VMEXITs: halt and read/write CR

The other motivation to do this work is to arrange it so that there is only a single place where Xen needs to consider whether an instruction/event is something that L1 cares about.

This is very much an RFC at this point so I'm mainly looking for feedback on the overall approach.

Thanks,
Ross

Ross Lagerwall (7):
x86/hvm: Move description into hvm_emulate_ctxt
x86/hvm: Introduce hvm_emulate_one_ctxt
x86/emul: Separate out instruction completion
x86/hvm: Support a fast path during emulation
x86/hvm: Move INSTR_* constants to hvm.h
x86/svm: Use the emulator path for VMEXIT_HLT
x86/svm: Use the emulator path for VMEXIT_CR*

 xen/arch/x86/hvm/emulate.c             | 180 +++++++++++++++++++------
 xen/arch/x86/hvm/hvm.c                 |   2 +-
 xen/arch/x86/hvm/io.c                  |  19 ++-
 xen/arch/x86/hvm/ioreq.c               |   2 +-
 xen/arch/x86/hvm/svm/emulate.c         |   6 +-
 xen/arch/x86/hvm/svm/svm.c             |  52 +++----
 xen/arch/x86/hvm/svm/svm.h             |  30 +----
 xen/arch/x86/hvm/vmx/realmode.c        |   2 +-
 xen/arch/x86/include/asm/hvm/emulate.h |  13 ++
 xen/arch/x86/include/asm/hvm/hvm.h     |  31 +++++
 xen/arch/x86/x86_emulate/x86_emulate.c |  48 ++++---
 xen/arch/x86/x86_emulate/x86_emulate.h |   3 +
 12 files changed, 252 insertions(+), 136 deletions(-)
Signature · 1 line
2.53.0