Skip to content

x86/vvmx: Read instruction operands correctly on VM exit

Euan Harris xen-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest9 patches 14 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/9x86/vvmx: Remove enum vmx_regs_encxen/arch/x86/hvm/vmx/vvmx.c xen/include/asm-x86/hvm/vmx/vvmx.h+4 -260 replies
2/9x86/vvmx: Unify operands in struct vmx_inst_decodedxen/arch/x86/hvm/vmx/vvmx.c+28 -240 replies
3/9x86/vvmx: Extract operand reading logic into operand_read()xen/arch/x86/hvm/vmx/vvmx.c+47 -124 replies
4/9x86/vvmx: Remove unnecessary VMX operand readsxen/arch/x86/hvm/vmx/vvmx.c+2 -32 replies
5/9x86/vvmx: Replace direct calls to reg_read() with operand_read()xen/arch/x86/hvm/vmx/vvmx.c+24 -50 replies
6/9x86/vvmx: Remove operand reading from decode_vmx_inst()xen/arch/x86/hvm/vmx/vvmx.c+31 -260 replies
7/9x86/vvmx: Use correct sizes when reading operandsxen/arch/x86/hvm/vmx/vvmx.c+25 -233 replies
8/9x86/hvm: Add hvm_copy_{to, from}_guest_virt() helpersxen/arch/x86/hvm/hvm.c xen/include/asm-x86/hvm/support.h+69 -01 reply
9/9x86/vvmx: Use hvm_copy_{to, from}_guest_virt() to read operandsxen/arch/x86/hvm/vmx/vvmx.c+26 -541 reply

Reviews trailers per patch

None of the 9 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchKevin Tian
SeriesA-b
1/9
2/9
3/9
4/9
5/9
6/9
7/9
8/9
9/9

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/9] x86/vvmx: Read instruction operands correctly on VM exit

decode_vmx_inst() does not read instruction operands correctly on VM exit:

* It incorrectly uses vmx_inst_info's address_size field to calculate the sizes of the exit-causing instruction's operands. The sizes of the operands are specified in the SDM and might depend on whether the guest is running in 32-bit or 64-bit mode, but they have nothing to do with the address_size field.

* It includes its own segmentation logic, duplicating code elsewhere. This segmentation logic is also incorrect and will raise #GP fault rather than a #SS fault in response to an invalid memory access through the stack segment.

Patches 1-6 (up to 'Remove operand decoding from decode_vmx_inst()') refactor decode_vmx_inst() in preparation for fixing the bugs mentioned above. They remove unnecessary code and extract the logic for reading operands from decode_vmx_inst() into a new operand_read() function. These patches should not cause any functional changes.

Patch 7 ('Use correct sizes when reading operands') replaces the incorrect operand size calculations based on address_size with the correct sizes from the SDM.

Patches 8 and 9 add new hvm_copy_{to,from}_guest_virt() helpers and use them to read memory operands in place of the incorrect segmentation logic in decode_vmx_inst().

Euan Harris (9):
x86/vvmx: Remove enum vmx_regs_enc
x86/vvmx: Unify operands in struct vmx_inst_decoded x86/vvmx: Extract operand reading logic into operand_read() x86/vvmx: Remove unnecessary VMX operand reads x86/vvmx: Replace direct calls to reg_read() with operand_read() x86/vvmx: Remove operand reading from decode_vmx_inst() x86/vvmx: Use correct sizes when reading operands x86/hvm: Add hvm_copy_{to,from}_guest_virt() helpers x86/vvmx: Use hvm_copy_{to,from}_guest_virt() to read operands

 xen/arch/x86/hvm/hvm.c             |  57 ++++++++++
 xen/arch/x86/hvm/vmx/vvmx.c        | 216 +++++++++++++++++++++----------------
 xen/include/asm-x86/hvm/support.h  |  12 +++
 xen/include/asm-x86/hvm/vmx/vvmx.h |  22 ----
 4 files changed, 195 insertions(+), 112 deletions(-)
Signature · 7 lines
2.13.6


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel